
- Convert all IIFE modules to ES6 modules with attach functions - Split webpack configs: lib build vs demo build - Add UMD wrapper for auto-initialization with jQuery - Update package.json with sequential build scripts - Clean up legacy dist files and reorganize demo structure Status: jQuery timing issues remain - attach functions not accessible Next: Debug UMD factory execution and jQuery parameter passing
424 lines
368 KiB
JavaScript
424 lines
368 KiB
JavaScript
/*
|
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
* This devtool is neither made for production nor for readable output files.
|
|
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
* or disable the default devtool with "devtool: false".
|
|
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
*/
|
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
//X-Editable Bootstrap 5 - CommonJS2
|
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
module.exports = factory(require("jquery"), require("bootstrap"));
|
|
//X-Editable Bootstrap 5 - AMD
|
|
else if(typeof define === 'function' && define.amd)
|
|
define(["jquery", "bootstrap"], factory);
|
|
//X-Editable Bootstrap 5 - CommonJS
|
|
else if(typeof exports === 'object')
|
|
exports["EditableForm"] = factory(require("jquery"), require("bootstrap"));
|
|
//X-Editable Bootstrap 5 - Auto-initializing UMD Bundle
|
|
else
|
|
root["EditableForm"] = factory(root["jQuery"], root["bootstrap"]);
|
|
})(this, (__WEBPACK_EXTERNAL_MODULE_jquery__, __WEBPACK_EXTERNAL_MODULE_bootstrap__) => {
|
|
return /******/ (() => { // webpackBootstrap
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/select2/dist/css/select2.min.css":
|
|
/*!*********************************************************************************************!*\
|
|
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/select2/dist/css/select2.min.css ***!
|
|
\*********************************************************************************************/
|
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n// Imports\n\n\nvar ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{background-color:transparent;border:none;font-size:1em}.select2-container[dir=\"rtl\"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline;list-style:none;padding:0}.select2-container .select2-selection--multiple .select2-selection__clear{background-color:transparent;border:none;font-size:1em}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;margin-left:5px;padding:0;max-width:100%;resize:none;height:18px;vertical-align:bottom;font-family:sans-serif;overflow:hidden;word-break:keep-all}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option--selectable{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;height:26px;margin-right:20px;padding-right:0px}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=\"rtl\"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=\"rtl\"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;padding-bottom:5px;padding-right:5px;position:relative}.select2-container--default .select2-selection--multiple.select2-selection--clearable{padding-right:25px}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;font-weight:bold;height:20px;margin-right:10px;margin-top:5px;position:absolute;right:0;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:inline-block;margin-left:5px;margin-top:5px;padding:0;padding-left:20px;position:relative;max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom;white-space:nowrap}.select2-container--default .select2-selection--multiple .select2-selection__choice__display{cursor:default;padding-left:2px;padding-right:5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{background-color:transparent;border:none;border-right:1px solid #aaa;border-top-left-radius:4px;border-bottom-left-radius:4px;color:#999;cursor:pointer;font-size:1em;font-weight:bold;padding:0 4px;position:absolute;left:0;top:0}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover,.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus{background-color:#f1f1f1;color:#333;outline:none}.select2-container--default[dir=\"rtl\"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=\"rtl\"] .select2-selection--multiple .select2-selection__choice__display{padding-left:5px;padding-right:2px}.select2-container--default[dir=\"rtl\"] .select2-selection--multiple .select2-selection__choice__remove{border-left:1px solid #aaa;border-right:none;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px}.select2-container--default[dir=\"rtl\"] .select2-selection--multiple .select2-selection__clear{float:left;margin-left:10px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--group{padding:0}.select2-container--default .select2-results__option--disabled{color:#999}.select2-container--default .select2-results__option--selected{background-color:#ddd}.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;height:26px;margin-right:20px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=\"rtl\"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=\"rtl\"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;padding-bottom:5px;padding-right:5px}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;display:inline-block;margin-left:5px;margin-top:5px;padding:0}.select2-container--classic .select2-selection--multiple .select2-selection__choice__display{cursor:default;padding-left:2px;padding-right:5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{background-color:transparent;border:none;border-top-left-radius:4px;border-bottom-left-radius:4px;color:#888;cursor:pointer;font-size:1em;font-weight:bold;padding:0 4px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;outline:none}.select2-container--classic[dir=\"rtl\"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir=\"rtl\"] .select2-selection--multiple .select2-selection__choice__display{padding-left:5px;padding-right:2px}.select2-container--classic[dir=\"rtl\"] .select2-selection--multiple .select2-selection__choice__remove{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option--group{padding:0}.select2-container--classic .select2-results__option--disabled{color:grey}.select2-container--classic .select2-results__option--highlighted.select2-results__option--selectable{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}\n`, \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://EditableForm/./node_modules/select2/dist/css/select2.min.css?./node_modules/css-loader/dist/cjs.js\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/css-loader/dist/runtime/api.js":
|
|
/*!*****************************************************!*\
|
|
!*** ./node_modules/css-loader/dist/runtime/api.js ***!
|
|
\*****************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
eval("{\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n content += cssWithMappingToString(item);\n if (needLayer) {\n content += \"}\";\n }\n if (item[2]) {\n content += \"}\";\n }\n if (item[4]) {\n content += \"}\";\n }\n return content;\n }).join(\"\");\n };\n\n // import a list of modules into the list\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n var alreadyImportedModules = {};\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n list.push(item);\n }\n };\n return list;\n};\n\n//# sourceURL=webpack://EditableForm/./node_modules/css-loader/dist/runtime/api.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js":
|
|
/*!**************************************************************!*\
|
|
!*** ./node_modules/css-loader/dist/runtime/noSourceMaps.js ***!
|
|
\**************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
eval("{\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=webpack://EditableForm/./node_modules/css-loader/dist/runtime/noSourceMaps.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/select2/dist/css/select2.min.css":
|
|
/*!*******************************************************!*\
|
|
!*** ./node_modules/select2/dist/css/select2.min.css ***!
|
|
\*******************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ \"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../../style-loader/dist/runtime/styleDomAPI.js */ \"./node_modules/style-loader/dist/runtime/styleDomAPI.js\");\n/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../style-loader/dist/runtime/insertBySelector.js */ \"./node_modules/style-loader/dist/runtime/insertBySelector.js\");\n/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../../../style-loader/dist/runtime/setAttributesWithoutAttributes.js */ \"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\");\n/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../../../style-loader/dist/runtime/insertStyleElement.js */ \"./node_modules/style-loader/dist/runtime/insertStyleElement.js\");\n/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../../../style-loader/dist/runtime/styleTagTransform.js */ \"./node_modules/style-loader/dist/runtime/styleTagTransform.js\");\n/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _css_loader_dist_cjs_js_select2_min_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../../../css-loader/dist/cjs.js!./select2.min.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/select2/dist/css/select2.min.css\");\n\n \n \n \n \n \n \n \n \n \n\nvar options = {};\n\noptions.styleTagTransform = (_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());\noptions.setAttributes = (_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());\noptions.insert = _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, \"head\");\noptions.domAPI = (_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());\noptions.insertStyleElement = (_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());\n\nvar update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_select2_min_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"], options);\n\n\n\n\n /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_css_loader_dist_cjs_js_select2_min_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"] && _css_loader_dist_cjs_js_select2_min_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals ? _css_loader_dist_cjs_js_select2_min_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals : undefined);\n\n\n//# sourceURL=webpack://EditableForm/./node_modules/select2/dist/css/select2.min.css?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/select2/dist/js/select2.js":
|
|
/*!*************************************************!*\
|
|
!*** ./node_modules/select2/dist/js/select2.js ***!
|
|
\*************************************************/
|
|
/***/ ((module, exports, __webpack_require__) => {
|
|
|
|
eval("{var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * Select2 4.1.0-rc.0\n * https://select2.github.io\n *\n * Released under the MIT license\n * https://github.com/select2/select2/blob/master/LICENSE.md\n */\n;(function (factory) {\n if (true) {\n // AMD. Register as an anonymous module.\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ \"jquery\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else // removed by dead control flow\n{}\n} (function (jQuery) {\n // This is needed so we can catch the AMD loader configuration and use it\n // The inner file should be wrapped (by `banner.start.js`) in a function that\n // returns the AMD loader references.\n var S2 =(function () {\n // Restore the Select2 AMD loader so it can be used\n // Needed mostly in the language files, where the loader is not inserted\n if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {\n var S2 = jQuery.fn.select2.amd;\n }\nvar S2;(function () { if (!S2 || !S2.requirejs) {\nif (!S2) { S2 = {}; } else { require = S2; }\n/**\n * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.\n * Released under MIT license, http://github.com/requirejs/almond/LICENSE\n */\n//Going sloppy to avoid 'use strict' string cost, but strict practices should\n//be followed.\n/*global setTimeout: false */\n\nvar requirejs, require, define;\n(function (undef) {\n var main, req, makeMap, handlers,\n defined = {},\n waiting = {},\n config = {},\n defining = {},\n hasOwn = Object.prototype.hasOwnProperty,\n aps = [].slice,\n jsSuffixRegExp = /\\.js$/;\n\n function hasProp(obj, prop) {\n return hasOwn.call(obj, prop);\n }\n\n /**\n * Given a relative module name, like ./something, normalize it to\n * a real name that can be mapped to a path.\n * @param {String} name the relative name\n * @param {String} baseName a real name that the name arg is relative\n * to.\n * @returns {String} normalized name\n */\n function normalize(name, baseName) {\n var nameParts, nameSegment, mapValue, foundMap, lastIndex,\n foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,\n baseParts = baseName && baseName.split(\"/\"),\n map = config.map,\n starMap = (map && map['*']) || {};\n\n //Adjust any relative paths.\n if (name) {\n name = name.split('/');\n lastIndex = name.length - 1;\n\n // If wanting node ID compatibility, strip .js from end\n // of IDs. Have to do this here, and not in nameToUrl\n // because node allows either .js or non .js to map\n // to same file.\n if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {\n name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');\n }\n\n // Starts with a '.' so need the baseName\n if (name[0].charAt(0) === '.' && baseParts) {\n //Convert baseName to array, and lop off the last part,\n //so that . matches that 'directory' and not name of the baseName's\n //module. For instance, baseName of 'one/two/three', maps to\n //'one/two/three.js', but we want the directory, 'one/two' for\n //this normalization.\n normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);\n name = normalizedBaseParts.concat(name);\n }\n\n //start trimDots\n for (i = 0; i < name.length; i++) {\n part = name[i];\n if (part === '.') {\n name.splice(i, 1);\n i -= 1;\n } else if (part === '..') {\n // If at the start, or previous value is still ..,\n // keep them so that when converted to a path it may\n // still work when converted to a path, even though\n // as an ID it is less than ideal. In larger point\n // releases, may be better to just kick out an error.\n if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {\n continue;\n } else if (i > 0) {\n name.splice(i - 1, 2);\n i -= 2;\n }\n }\n }\n //end trimDots\n\n name = name.join('/');\n }\n\n //Apply map config if available.\n if ((baseParts || starMap) && map) {\n nameParts = name.split('/');\n\n for (i = nameParts.length; i > 0; i -= 1) {\n nameSegment = nameParts.slice(0, i).join(\"/\");\n\n if (baseParts) {\n //Find the longest baseName segment match in the config.\n //So, do joins on the biggest to smallest lengths of baseParts.\n for (j = baseParts.length; j > 0; j -= 1) {\n mapValue = map[baseParts.slice(0, j).join('/')];\n\n //baseName segment has config, find if it has one for\n //this name.\n if (mapValue) {\n mapValue = mapValue[nameSegment];\n if (mapValue) {\n //Match, update name to the new value.\n foundMap = mapValue;\n foundI = i;\n break;\n }\n }\n }\n }\n\n if (foundMap) {\n break;\n }\n\n //Check for a star map match, but just hold on to it,\n //if there is a shorter segment match later in a matching\n //config, then favor over this star map.\n if (!foundStarMap && starMap && starMap[nameSegment]) {\n foundStarMap = starMap[nameSegment];\n starI = i;\n }\n }\n\n if (!foundMap && foundStarMap) {\n foundMap = foundStarMap;\n foundI = starI;\n }\n\n if (foundMap) {\n nameParts.splice(0, foundI, foundMap);\n name = nameParts.join('/');\n }\n }\n\n return name;\n }\n\n function makeRequire(relName, forceSync) {\n return function () {\n //A version of a require function that passes a moduleName\n //value for items that may need to\n //look up paths relative to the moduleName\n var args = aps.call(arguments, 0);\n\n //If first arg is not require('string'), and there is only\n //one arg, it is the array form without a callback. Insert\n //a null so that the following concat is correct.\n if (typeof args[0] !== 'string' && args.length === 1) {\n args.push(null);\n }\n return req.apply(undef, args.concat([relName, forceSync]));\n };\n }\n\n function makeNormalize(relName) {\n return function (name) {\n return normalize(name, relName);\n };\n }\n\n function makeLoad(depName) {\n return function (value) {\n defined[depName] = value;\n };\n }\n\n function callDep(name) {\n if (hasProp(waiting, name)) {\n var args = waiting[name];\n delete waiting[name];\n defining[name] = true;\n main.apply(undef, args);\n }\n\n if (!hasProp(defined, name) && !hasProp(defining, name)) {\n throw new Error('No ' + name);\n }\n return defined[name];\n }\n\n //Turns a plugin!resource to [plugin, resource]\n //with the plugin being undefined if the name\n //did not have a plugin prefix.\n function splitPrefix(name) {\n var prefix,\n index = name ? name.indexOf('!') : -1;\n if (index > -1) {\n prefix = name.substring(0, index);\n name = name.substring(index + 1, name.length);\n }\n return [prefix, name];\n }\n\n //Creates a parts array for a relName where first part is plugin ID,\n //second part is resource ID. Assumes relName has already been normalized.\n function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }\n\n /**\n * Makes a name map, normalizing the name, and using a plugin\n * for normalization if necessary. Grabs a ref to plugin\n * too, as an optimization.\n */\n makeMap = function (name, relParts) {\n var plugin,\n parts = splitPrefix(name),\n prefix = parts[0],\n relResourceName = relParts[1];\n\n name = parts[1];\n\n if (prefix) {\n prefix = normalize(prefix, relResourceName);\n plugin = callDep(prefix);\n }\n\n //Normalize according\n if (prefix) {\n if (plugin && plugin.normalize) {\n name = plugin.normalize(name, makeNormalize(relResourceName));\n } else {\n name = normalize(name, relResourceName);\n }\n } else {\n name = normalize(name, relResourceName);\n parts = splitPrefix(name);\n prefix = parts[0];\n name = parts[1];\n if (prefix) {\n plugin = callDep(prefix);\n }\n }\n\n //Using ridiculous property names for space reasons\n return {\n f: prefix ? prefix + '!' + name : name, //fullName\n n: name,\n pr: prefix,\n p: plugin\n };\n };\n\n function makeConfig(name) {\n return function () {\n return (config && config.config && config.config[name]) || {};\n };\n }\n\n handlers = {\n require: function (name) {\n return makeRequire(name);\n },\n exports: function (name) {\n var e = defined[name];\n if (typeof e !== 'undefined') {\n return e;\n } else {\n return (defined[name] = {});\n }\n },\n module: function (name) {\n return {\n id: name,\n uri: '',\n exports: defined[name],\n config: makeConfig(name)\n };\n }\n };\n\n main = function (name, deps, callback, relName) {\n var cjsModule, depName, ret, map, i, relParts,\n args = [],\n callbackType = typeof callback,\n usingExports;\n\n //Use name if no relName\n relName = relName || name;\n relParts = makeRelParts(relName);\n\n //Call the callback to define the module, if necessary.\n if (callbackType === 'undefined' || callbackType === 'function') {\n //Pull out the defined dependencies and pass the ordered\n //values to the callback.\n //Default to [require, exports, module] if no deps\n deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;\n for (i = 0; i < deps.length; i += 1) {\n map = makeMap(deps[i], relParts);\n depName = map.f;\n\n //Fast path CommonJS standard dependencies.\n if (depName === \"require\") {\n args[i] = handlers.require(name);\n } else if (depName === \"exports\") {\n //CommonJS module spec 1.1\n args[i] = handlers.exports(name);\n usingExports = true;\n } else if (depName === \"module\") {\n //CommonJS module spec 1.1\n cjsModule = args[i] = handlers.module(name);\n } else if (hasProp(defined, depName) ||\n hasProp(waiting, depName) ||\n hasProp(defining, depName)) {\n args[i] = callDep(depName);\n } else if (map.p) {\n map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});\n args[i] = defined[depName];\n } else {\n throw new Error(name + ' missing ' + depName);\n }\n }\n\n ret = callback ? callback.apply(defined[name], args) : undefined;\n\n if (name) {\n //If setting exports via \"module\" is in play,\n //favor that over return value and exports. After that,\n //favor a non-undefined return value over exports use.\n if (cjsModule && cjsModule.exports !== undef &&\n cjsModule.exports !== defined[name]) {\n defined[name] = cjsModule.exports;\n } else if (ret !== undef || !usingExports) {\n //Use the return value from the function.\n defined[name] = ret;\n }\n }\n } else if (name) {\n //May just be an object definition for the module. Only\n //worry about defining if have a module name.\n defined[name] = callback;\n }\n };\n\n requirejs = require = req = function (deps, callback, relName, forceSync, alt) {\n if (typeof deps === \"string\") {\n if (handlers[deps]) {\n //callback in this case is really relName\n return handlers[deps](callback);\n }\n //Just return the module wanted. In this scenario, the\n //deps arg is the module name, and second arg (if passed)\n //is just the relName.\n //Normalize module name, if it contains . or ..\n return callDep(makeMap(deps, makeRelParts(callback)).f);\n } else if (!deps.splice) {\n //deps is a config object, not an array.\n config = deps;\n if (config.deps) {\n req(config.deps, config.callback);\n }\n if (!callback) {\n return;\n }\n\n if (callback.splice) {\n //callback is an array, which means it is a dependency list.\n //Adjust args if there are dependencies\n deps = callback;\n callback = relName;\n relName = null;\n } else {\n deps = undef;\n }\n }\n\n //Support require(['a'])\n callback = callback || function () {};\n\n //If relName is a function, it is an errback handler,\n //so remove it.\n if (typeof relName === 'function') {\n relName = forceSync;\n forceSync = alt;\n }\n\n //Simulate async callback;\n if (forceSync) {\n main(undef, deps, callback, relName);\n } else {\n //Using a non-zero value because of concern for what old browsers\n //do, and latest browsers \"upgrade\" to 4 if lower value is used:\n //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:\n //If want a value immediately, use require('id') instead -- something\n //that works in almond on the global level, but not guaranteed and\n //unlikely to work in other AMD implementations.\n setTimeout(function () {\n main(undef, deps, callback, relName);\n }, 4);\n }\n\n return req;\n };\n\n /**\n * Just drops the config on the floor, but returns req in case\n * the config return value is used.\n */\n req.config = function (cfg) {\n return req(cfg);\n };\n\n /**\n * Expose module registry for debugging and tooling\n */\n requirejs._defined = defined;\n\n define = function (name, deps, callback) {\n if (typeof name !== 'string') {\n throw new Error('See almond README: incorrect module build, no module name');\n }\n\n //This module may not have dependencies\n if (!deps.splice) {\n //deps is not an array, so probably means\n //an object literal or factory function for\n //the value. Adjust args.\n callback = deps;\n deps = [];\n }\n\n if (!hasProp(defined, name) && !hasProp(waiting, name)) {\n waiting[name] = [name, deps, callback];\n }\n };\n\n define.amd = {\n jQuery: true\n };\n}());\n\nS2.requirejs = requirejs;S2.require = require;S2.define = define;\n}\n}());\nS2.define(\"almond\", function(){});\n\n/* global jQuery:false, $:false */\nS2.define('jquery',[],function () {\n var _$ = jQuery || $;\n\n if (_$ == null && console && console.error) {\n console.error(\n 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +\n 'found. Make sure that you are including jQuery before Select2 on your ' +\n 'web page.'\n );\n }\n\n return _$;\n});\n\nS2.define('select2/utils',[\n 'jquery'\n], function ($) {\n var Utils = {};\n\n Utils.Extend = function (ChildClass, SuperClass) {\n var __hasProp = {}.hasOwnProperty;\n\n function BaseConstructor () {\n this.constructor = ChildClass;\n }\n\n for (var key in SuperClass) {\n if (__hasProp.call(SuperClass, key)) {\n ChildClass[key] = SuperClass[key];\n }\n }\n\n BaseConstructor.prototype = SuperClass.prototype;\n ChildClass.prototype = new BaseConstructor();\n ChildClass.__super__ = SuperClass.prototype;\n\n return ChildClass;\n };\n\n function getMethods (theClass) {\n var proto = theClass.prototype;\n\n var methods = [];\n\n for (var methodName in proto) {\n var m = proto[methodName];\n\n if (typeof m !== 'function') {\n continue;\n }\n\n if (methodName === 'constructor') {\n continue;\n }\n\n methods.push(methodName);\n }\n\n return methods;\n }\n\n Utils.Decorate = function (SuperClass, DecoratorClass) {\n var decoratedMethods = getMethods(DecoratorClass);\n var superMethods = getMethods(SuperClass);\n\n function DecoratedClass () {\n var unshift = Array.prototype.unshift;\n\n var argCount = DecoratorClass.prototype.constructor.length;\n\n var calledConstructor = SuperClass.prototype.constructor;\n\n if (argCount > 0) {\n unshift.call(arguments, SuperClass.prototype.constructor);\n\n calledConstructor = DecoratorClass.prototype.constructor;\n }\n\n calledConstructor.apply(this, arguments);\n }\n\n DecoratorClass.displayName = SuperClass.displayName;\n\n function ctr () {\n this.constructor = DecoratedClass;\n }\n\n DecoratedClass.prototype = new ctr();\n\n for (var m = 0; m < superMethods.length; m++) {\n var superMethod = superMethods[m];\n\n DecoratedClass.prototype[superMethod] =\n SuperClass.prototype[superMethod];\n }\n\n var calledMethod = function (methodName) {\n // Stub out the original method if it's not decorating an actual method\n var originalMethod = function () {};\n\n if (methodName in DecoratedClass.prototype) {\n originalMethod = DecoratedClass.prototype[methodName];\n }\n\n var decoratedMethod = DecoratorClass.prototype[methodName];\n\n return function () {\n var unshift = Array.prototype.unshift;\n\n unshift.call(arguments, originalMethod);\n\n return decoratedMethod.apply(this, arguments);\n };\n };\n\n for (var d = 0; d < decoratedMethods.length; d++) {\n var decoratedMethod = decoratedMethods[d];\n\n DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);\n }\n\n return DecoratedClass;\n };\n\n var Observable = function () {\n this.listeners = {};\n };\n\n Observable.prototype.on = function (event, callback) {\n this.listeners = this.listeners || {};\n\n if (event in this.listeners) {\n this.listeners[event].push(callback);\n } else {\n this.listeners[event] = [callback];\n }\n };\n\n Observable.prototype.trigger = function (event) {\n var slice = Array.prototype.slice;\n var params = slice.call(arguments, 1);\n\n this.listeners = this.listeners || {};\n\n // Params should always come in as an array\n if (params == null) {\n params = [];\n }\n\n // If there are no arguments to the event, use a temporary object\n if (params.length === 0) {\n params.push({});\n }\n\n // Set the `_type` of the first object to the event\n params[0]._type = event;\n\n if (event in this.listeners) {\n this.invoke(this.listeners[event], slice.call(arguments, 1));\n }\n\n if ('*' in this.listeners) {\n this.invoke(this.listeners['*'], arguments);\n }\n };\n\n Observable.prototype.invoke = function (listeners, params) {\n for (var i = 0, len = listeners.length; i < len; i++) {\n listeners[i].apply(this, params);\n }\n };\n\n Utils.Observable = Observable;\n\n Utils.generateChars = function (length) {\n var chars = '';\n\n for (var i = 0; i < length; i++) {\n var randomChar = Math.floor(Math.random() * 36);\n chars += randomChar.toString(36);\n }\n\n return chars;\n };\n\n Utils.bind = function (func, context) {\n return function () {\n func.apply(context, arguments);\n };\n };\n\n Utils._convertData = function (data) {\n for (var originalKey in data) {\n var keys = originalKey.split('-');\n\n var dataLevel = data;\n\n if (keys.length === 1) {\n continue;\n }\n\n for (var k = 0; k < keys.length; k++) {\n var key = keys[k];\n\n // Lowercase the first letter\n // By default, dash-separated becomes camelCase\n key = key.substring(0, 1).toLowerCase() + key.substring(1);\n\n if (!(key in dataLevel)) {\n dataLevel[key] = {};\n }\n\n if (k == keys.length - 1) {\n dataLevel[key] = data[originalKey];\n }\n\n dataLevel = dataLevel[key];\n }\n\n delete data[originalKey];\n }\n\n return data;\n };\n\n Utils.hasScroll = function (index, el) {\n // Adapted from the function created by @ShadowScripter\n // and adapted by @BillBarry on the Stack Exchange Code Review website.\n // The original code can be found at\n // http://codereview.stackexchange.com/q/13338\n // and was designed to be used with the Sizzle selector engine.\n\n var $el = $(el);\n var overflowX = el.style.overflowX;\n var overflowY = el.style.overflowY;\n\n //Check both x and y declarations\n if (overflowX === overflowY &&\n (overflowY === 'hidden' || overflowY === 'visible')) {\n return false;\n }\n\n if (overflowX === 'scroll' || overflowY === 'scroll') {\n return true;\n }\n\n return ($el.innerHeight() < el.scrollHeight ||\n $el.innerWidth() < el.scrollWidth);\n };\n\n Utils.escapeMarkup = function (markup) {\n var replaceMap = {\n '\\\\': '\',\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n '\\'': ''',\n '/': '/'\n };\n\n // Do not try to escape the markup if it's not a string\n if (typeof markup !== 'string') {\n return markup;\n }\n\n return String(markup).replace(/[&<>\"'\\/\\\\]/g, function (match) {\n return replaceMap[match];\n });\n };\n\n // Cache objects in Utils.__cache instead of $.data (see #4346)\n Utils.__cache = {};\n\n var id = 0;\n Utils.GetUniqueElementId = function (element) {\n // Get a unique element Id. If element has no id,\n // creates a new unique number, stores it in the id\n // attribute and returns the new id with a prefix.\n // If an id already exists, it simply returns it with a prefix.\n\n var select2Id = element.getAttribute('data-select2-id');\n\n if (select2Id != null) {\n return select2Id;\n }\n\n // If element has id, use it.\n if (element.id) {\n select2Id = 'select2-data-' + element.id;\n } else {\n select2Id = 'select2-data-' + (++id).toString() +\n '-' + Utils.generateChars(4);\n }\n\n element.setAttribute('data-select2-id', select2Id);\n\n return select2Id;\n };\n\n Utils.StoreData = function (element, name, value) {\n // Stores an item in the cache for a specified element.\n // name is the cache key.\n var id = Utils.GetUniqueElementId(element);\n if (!Utils.__cache[id]) {\n Utils.__cache[id] = {};\n }\n\n Utils.__cache[id][name] = value;\n };\n\n Utils.GetData = function (element, name) {\n // Retrieves a value from the cache by its key (name)\n // name is optional. If no name specified, return\n // all cache items for the specified element.\n // and for a specified element.\n var id = Utils.GetUniqueElementId(element);\n if (name) {\n if (Utils.__cache[id]) {\n if (Utils.__cache[id][name] != null) {\n return Utils.__cache[id][name];\n }\n return $(element).data(name); // Fallback to HTML5 data attribs.\n }\n return $(element).data(name); // Fallback to HTML5 data attribs.\n } else {\n return Utils.__cache[id];\n }\n };\n\n Utils.RemoveData = function (element) {\n // Removes all cached items for a specified element.\n var id = Utils.GetUniqueElementId(element);\n if (Utils.__cache[id] != null) {\n delete Utils.__cache[id];\n }\n\n element.removeAttribute('data-select2-id');\n };\n\n Utils.copyNonInternalCssClasses = function (dest, src) {\n var classes;\n\n var destinationClasses = dest.getAttribute('class').trim().split(/\\s+/);\n\n destinationClasses = destinationClasses.filter(function (clazz) {\n // Save all Select2 classes\n return clazz.indexOf('select2-') === 0;\n });\n\n var sourceClasses = src.getAttribute('class').trim().split(/\\s+/);\n\n sourceClasses = sourceClasses.filter(function (clazz) {\n // Only copy non-Select2 classes\n return clazz.indexOf('select2-') !== 0;\n });\n\n var replacements = destinationClasses.concat(sourceClasses);\n\n dest.setAttribute('class', replacements.join(' '));\n };\n\n return Utils;\n});\n\nS2.define('select2/results',[\n 'jquery',\n './utils'\n], function ($, Utils) {\n function Results ($element, options, dataAdapter) {\n this.$element = $element;\n this.data = dataAdapter;\n this.options = options;\n\n Results.__super__.constructor.call(this);\n }\n\n Utils.Extend(Results, Utils.Observable);\n\n Results.prototype.render = function () {\n var $results = $(\n '<ul class=\"select2-results__options\" role=\"listbox\"></ul>'\n );\n\n if (this.options.get('multiple')) {\n $results.attr('aria-multiselectable', 'true');\n }\n\n this.$results = $results;\n\n return $results;\n };\n\n Results.prototype.clear = function () {\n this.$results.empty();\n };\n\n Results.prototype.displayMessage = function (params) {\n var escapeMarkup = this.options.get('escapeMarkup');\n\n this.clear();\n this.hideLoading();\n\n var $message = $(\n '<li role=\"alert\" aria-live=\"assertive\"' +\n ' class=\"select2-results__option\"></li>'\n );\n\n var message = this.options.get('translations').get(params.message);\n\n $message.append(\n escapeMarkup(\n message(params.args)\n )\n );\n\n $message[0].className += ' select2-results__message';\n\n this.$results.append($message);\n };\n\n Results.prototype.hideMessages = function () {\n this.$results.find('.select2-results__message').remove();\n };\n\n Results.prototype.append = function (data) {\n this.hideLoading();\n\n var $options = [];\n\n if (data.results == null || data.results.length === 0) {\n if (this.$results.children().length === 0) {\n this.trigger('results:message', {\n message: 'noResults'\n });\n }\n\n return;\n }\n\n data.results = this.sort(data.results);\n\n for (var d = 0; d < data.results.length; d++) {\n var item = data.results[d];\n\n var $option = this.option(item);\n\n $options.push($option);\n }\n\n this.$results.append($options);\n };\n\n Results.prototype.position = function ($results, $dropdown) {\n var $resultsContainer = $dropdown.find('.select2-results');\n $resultsContainer.append($results);\n };\n\n Results.prototype.sort = function (data) {\n var sorter = this.options.get('sorter');\n\n return sorter(data);\n };\n\n Results.prototype.highlightFirstItem = function () {\n var $options = this.$results\n .find('.select2-results__option--selectable');\n\n var $selected = $options.filter('.select2-results__option--selected');\n\n // Check if there are any selected options\n if ($selected.length > 0) {\n // If there are selected options, highlight the first\n $selected.first().trigger('mouseenter');\n } else {\n // If there are no selected options, highlight the first option\n // in the dropdown\n $options.first().trigger('mouseenter');\n }\n\n this.ensureHighlightVisible();\n };\n\n Results.prototype.setClasses = function () {\n var self = this;\n\n this.data.current(function (selected) {\n var selectedIds = selected.map(function (s) {\n return s.id.toString();\n });\n\n var $options = self.$results\n .find('.select2-results__option--selectable');\n\n $options.each(function () {\n var $option = $(this);\n\n var item = Utils.GetData(this, 'data');\n\n // id needs to be converted to a string when comparing\n var id = '' + item.id;\n\n if ((item.element != null && item.element.selected) ||\n (item.element == null && selectedIds.indexOf(id) > -1)) {\n this.classList.add('select2-results__option--selected');\n $option.attr('aria-selected', 'true');\n } else {\n this.classList.remove('select2-results__option--selected');\n $option.attr('aria-selected', 'false');\n }\n });\n\n });\n };\n\n Results.prototype.showLoading = function (params) {\n this.hideLoading();\n\n var loadingMore = this.options.get('translations').get('searching');\n\n var loading = {\n disabled: true,\n loading: true,\n text: loadingMore(params)\n };\n var $loading = this.option(loading);\n $loading.className += ' loading-results';\n\n this.$results.prepend($loading);\n };\n\n Results.prototype.hideLoading = function () {\n this.$results.find('.loading-results').remove();\n };\n\n Results.prototype.option = function (data) {\n var option = document.createElement('li');\n option.classList.add('select2-results__option');\n option.classList.add('select2-results__option--selectable');\n\n var attrs = {\n 'role': 'option'\n };\n\n var matches = window.Element.prototype.matches ||\n window.Element.prototype.msMatchesSelector ||\n window.Element.prototype.webkitMatchesSelector;\n\n if ((data.element != null && matches.call(data.element, ':disabled')) ||\n (data.element == null && data.disabled)) {\n attrs['aria-disabled'] = 'true';\n\n option.classList.remove('select2-results__option--selectable');\n option.classList.add('select2-results__option--disabled');\n }\n\n if (data.id == null) {\n option.classList.remove('select2-results__option--selectable');\n }\n\n if (data._resultId != null) {\n option.id = data._resultId;\n }\n\n if (data.title) {\n option.title = data.title;\n }\n\n if (data.children) {\n attrs.role = 'group';\n attrs['aria-label'] = data.text;\n\n option.classList.remove('select2-results__option--selectable');\n option.classList.add('select2-results__option--group');\n }\n\n for (var attr in attrs) {\n var val = attrs[attr];\n\n option.setAttribute(attr, val);\n }\n\n if (data.children) {\n var $option = $(option);\n\n var label = document.createElement('strong');\n label.className = 'select2-results__group';\n\n this.template(data, label);\n\n var $children = [];\n\n for (var c = 0; c < data.children.length; c++) {\n var child = data.children[c];\n\n var $child = this.option(child);\n\n $children.push($child);\n }\n\n var $childrenContainer = $('<ul></ul>', {\n 'class': 'select2-results__options select2-results__options--nested',\n 'role': 'none'\n });\n\n $childrenContainer.append($children);\n\n $option.append(label);\n $option.append($childrenContainer);\n } else {\n this.template(data, option);\n }\n\n Utils.StoreData(option, 'data', data);\n\n return option;\n };\n\n Results.prototype.bind = function (container, $container) {\n var self = this;\n\n var id = container.id + '-results';\n\n this.$results.attr('id', id);\n\n container.on('results:all', function (params) {\n self.clear();\n self.append(params.data);\n\n if (container.isOpen()) {\n self.setClasses();\n self.highlightFirstItem();\n }\n });\n\n container.on('results:append', function (params) {\n self.append(params.data);\n\n if (container.isOpen()) {\n self.setClasses();\n }\n });\n\n container.on('query', function (params) {\n self.hideMessages();\n self.showLoading(params);\n });\n\n container.on('select', function () {\n if (!container.isOpen()) {\n return;\n }\n\n self.setClasses();\n\n if (self.options.get('scrollAfterSelect')) {\n self.highlightFirstItem();\n }\n });\n\n container.on('unselect', function () {\n if (!container.isOpen()) {\n return;\n }\n\n self.setClasses();\n\n if (self.options.get('scrollAfterSelect')) {\n self.highlightFirstItem();\n }\n });\n\n container.on('open', function () {\n // When the dropdown is open, aria-expended=\"true\"\n self.$results.attr('aria-expanded', 'true');\n self.$results.attr('aria-hidden', 'false');\n\n self.setClasses();\n self.ensureHighlightVisible();\n });\n\n container.on('close', function () {\n // When the dropdown is closed, aria-expended=\"false\"\n self.$results.attr('aria-expanded', 'false');\n self.$results.attr('aria-hidden', 'true');\n self.$results.removeAttr('aria-activedescendant');\n });\n\n container.on('results:toggle', function () {\n var $highlighted = self.getHighlightedResults();\n\n if ($highlighted.length === 0) {\n return;\n }\n\n $highlighted.trigger('mouseup');\n });\n\n container.on('results:select', function () {\n var $highlighted = self.getHighlightedResults();\n\n if ($highlighted.length === 0) {\n return;\n }\n\n var data = Utils.GetData($highlighted[0], 'data');\n\n if ($highlighted.hasClass('select2-results__option--selected')) {\n self.trigger('close', {});\n } else {\n self.trigger('select', {\n data: data\n });\n }\n });\n\n container.on('results:previous', function () {\n var $highlighted = self.getHighlightedResults();\n\n var $options = self.$results.find('.select2-results__option--selectable');\n\n var currentIndex = $options.index($highlighted);\n\n // If we are already at the top, don't move further\n // If no options, currentIndex will be -1\n if (currentIndex <= 0) {\n return;\n }\n\n var nextIndex = currentIndex - 1;\n\n // If none are highlighted, highlight the first\n if ($highlighted.length === 0) {\n nextIndex = 0;\n }\n\n var $next = $options.eq(nextIndex);\n\n $next.trigger('mouseenter');\n\n var currentOffset = self.$results.offset().top;\n var nextTop = $next.offset().top;\n var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);\n\n if (nextIndex === 0) {\n self.$results.scrollTop(0);\n } else if (nextTop - currentOffset < 0) {\n self.$results.scrollTop(nextOffset);\n }\n });\n\n container.on('results:next', function () {\n var $highlighted = self.getHighlightedResults();\n\n var $options = self.$results.find('.select2-results__option--selectable');\n\n var currentIndex = $options.index($highlighted);\n\n var nextIndex = currentIndex + 1;\n\n // If we are at the last option, stay there\n if (nextIndex >= $options.length) {\n return;\n }\n\n var $next = $options.eq(nextIndex);\n\n $next.trigger('mouseenter');\n\n var currentOffset = self.$results.offset().top +\n self.$results.outerHeight(false);\n var nextBottom = $next.offset().top + $next.outerHeight(false);\n var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;\n\n if (nextIndex === 0) {\n self.$results.scrollTop(0);\n } else if (nextBottom > currentOffset) {\n self.$results.scrollTop(nextOffset);\n }\n });\n\n container.on('results:focus', function (params) {\n params.element[0].classList.add('select2-results__option--highlighted');\n params.element[0].setAttribute('aria-selected', 'true');\n });\n\n container.on('results:message', function (params) {\n self.displayMessage(params);\n });\n\n if ($.fn.mousewheel) {\n this.$results.on('mousewheel', function (e) {\n var top = self.$results.scrollTop();\n\n var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;\n\n var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;\n var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();\n\n if (isAtTop) {\n self.$results.scrollTop(0);\n\n e.preventDefault();\n e.stopPropagation();\n } else if (isAtBottom) {\n self.$results.scrollTop(\n self.$results.get(0).scrollHeight - self.$results.height()\n );\n\n e.preventDefault();\n e.stopPropagation();\n }\n });\n }\n\n this.$results.on('mouseup', '.select2-results__option--selectable',\n function (evt) {\n var $this = $(this);\n\n var data = Utils.GetData(this, 'data');\n\n if ($this.hasClass('select2-results__option--selected')) {\n if (self.options.get('multiple')) {\n self.trigger('unselect', {\n originalEvent: evt,\n data: data\n });\n } else {\n self.trigger('close', {});\n }\n\n return;\n }\n\n self.trigger('select', {\n originalEvent: evt,\n data: data\n });\n });\n\n this.$results.on('mouseenter', '.select2-results__option--selectable',\n function (evt) {\n var data = Utils.GetData(this, 'data');\n\n self.getHighlightedResults()\n .removeClass('select2-results__option--highlighted')\n .attr('aria-selected', 'false');\n\n self.trigger('results:focus', {\n data: data,\n element: $(this)\n });\n });\n };\n\n Results.prototype.getHighlightedResults = function () {\n var $highlighted = this.$results\n .find('.select2-results__option--highlighted');\n\n return $highlighted;\n };\n\n Results.prototype.destroy = function () {\n this.$results.remove();\n };\n\n Results.prototype.ensureHighlightVisible = function () {\n var $highlighted = this.getHighlightedResults();\n\n if ($highlighted.length === 0) {\n return;\n }\n\n var $options = this.$results.find('.select2-results__option--selectable');\n\n var currentIndex = $options.index($highlighted);\n\n var currentOffset = this.$results.offset().top;\n var nextTop = $highlighted.offset().top;\n var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);\n\n var offsetDelta = nextTop - currentOffset;\n nextOffset -= $highlighted.outerHeight(false) * 2;\n\n if (currentIndex <= 2) {\n this.$results.scrollTop(0);\n } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {\n this.$results.scrollTop(nextOffset);\n }\n };\n\n Results.prototype.template = function (result, container) {\n var template = this.options.get('templateResult');\n var escapeMarkup = this.options.get('escapeMarkup');\n\n var content = template(result, container);\n\n if (content == null) {\n container.style.display = 'none';\n } else if (typeof content === 'string') {\n container.innerHTML = escapeMarkup(content);\n } else {\n $(container).append(content);\n }\n };\n\n return Results;\n});\n\nS2.define('select2/keys',[\n\n], function () {\n var KEYS = {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n SHIFT: 16,\n CTRL: 17,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n END: 35,\n HOME: 36,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n DELETE: 46\n };\n\n return KEYS;\n});\n\nS2.define('select2/selection/base',[\n 'jquery',\n '../utils',\n '../keys'\n], function ($, Utils, KEYS) {\n function BaseSelection ($element, options) {\n this.$element = $element;\n this.options = options;\n\n BaseSelection.__super__.constructor.call(this);\n }\n\n Utils.Extend(BaseSelection, Utils.Observable);\n\n BaseSelection.prototype.render = function () {\n var $selection = $(\n '<span class=\"select2-selection\" role=\"combobox\" ' +\n ' aria-haspopup=\"true\" aria-expanded=\"false\">' +\n '</span>'\n );\n\n this._tabindex = 0;\n\n if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {\n this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');\n } else if (this.$element.attr('tabindex') != null) {\n this._tabindex = this.$element.attr('tabindex');\n }\n\n $selection.attr('title', this.$element.attr('title'));\n $selection.attr('tabindex', this._tabindex);\n $selection.attr('aria-disabled', 'false');\n\n this.$selection = $selection;\n\n return $selection;\n };\n\n BaseSelection.prototype.bind = function (container, $container) {\n var self = this;\n\n var resultsId = container.id + '-results';\n\n this.container = container;\n\n this.$selection.on('focus', function (evt) {\n self.trigger('focus', evt);\n });\n\n this.$selection.on('blur', function (evt) {\n self._handleBlur(evt);\n });\n\n this.$selection.on('keydown', function (evt) {\n self.trigger('keypress', evt);\n\n if (evt.which === KEYS.SPACE) {\n evt.preventDefault();\n }\n });\n\n container.on('results:focus', function (params) {\n self.$selection.attr('aria-activedescendant', params.data._resultId);\n });\n\n container.on('selection:update', function (params) {\n self.update(params.data);\n });\n\n container.on('open', function () {\n // When the dropdown is open, aria-expanded=\"true\"\n self.$selection.attr('aria-expanded', 'true');\n self.$selection.attr('aria-owns', resultsId);\n\n self._attachCloseHandler(container);\n });\n\n container.on('close', function () {\n // When the dropdown is closed, aria-expanded=\"false\"\n self.$selection.attr('aria-expanded', 'false');\n self.$selection.removeAttr('aria-activedescendant');\n self.$selection.removeAttr('aria-owns');\n\n self.$selection.trigger('focus');\n\n self._detachCloseHandler(container);\n });\n\n container.on('enable', function () {\n self.$selection.attr('tabindex', self._tabindex);\n self.$selection.attr('aria-disabled', 'false');\n });\n\n container.on('disable', function () {\n self.$selection.attr('tabindex', '-1');\n self.$selection.attr('aria-disabled', 'true');\n });\n };\n\n BaseSelection.prototype._handleBlur = function (evt) {\n var self = this;\n\n // This needs to be delayed as the active element is the body when the tab\n // key is pressed, possibly along with others.\n window.setTimeout(function () {\n // Don't trigger `blur` if the focus is still in the selection\n if (\n (document.activeElement == self.$selection[0]) ||\n ($.contains(self.$selection[0], document.activeElement))\n ) {\n return;\n }\n\n self.trigger('blur', evt);\n }, 1);\n };\n\n BaseSelection.prototype._attachCloseHandler = function (container) {\n\n $(document.body).on('mousedown.select2.' + container.id, function (e) {\n var $target = $(e.target);\n\n var $select = $target.closest('.select2');\n\n var $all = $('.select2.select2-container--open');\n\n $all.each(function () {\n if (this == $select[0]) {\n return;\n }\n\n var $element = Utils.GetData(this, 'element');\n\n $element.select2('close');\n });\n });\n };\n\n BaseSelection.prototype._detachCloseHandler = function (container) {\n $(document.body).off('mousedown.select2.' + container.id);\n };\n\n BaseSelection.prototype.position = function ($selection, $container) {\n var $selectionContainer = $container.find('.selection');\n $selectionContainer.append($selection);\n };\n\n BaseSelection.prototype.destroy = function () {\n this._detachCloseHandler(this.container);\n };\n\n BaseSelection.prototype.update = function (data) {\n throw new Error('The `update` method must be defined in child classes.');\n };\n\n /**\n * Helper method to abstract the \"enabled\" (not \"disabled\") state of this\n * object.\n *\n * @return {true} if the instance is not disabled.\n * @return {false} if the instance is disabled.\n */\n BaseSelection.prototype.isEnabled = function () {\n return !this.isDisabled();\n };\n\n /**\n * Helper method to abstract the \"disabled\" state of this object.\n *\n * @return {true} if the disabled option is true.\n * @return {false} if the disabled option is false.\n */\n BaseSelection.prototype.isDisabled = function () {\n return this.options.get('disabled');\n };\n\n return BaseSelection;\n});\n\nS2.define('select2/selection/single',[\n 'jquery',\n './base',\n '../utils',\n '../keys'\n], function ($, BaseSelection, Utils, KEYS) {\n function SingleSelection () {\n SingleSelection.__super__.constructor.apply(this, arguments);\n }\n\n Utils.Extend(SingleSelection, BaseSelection);\n\n SingleSelection.prototype.render = function () {\n var $selection = SingleSelection.__super__.render.call(this);\n\n $selection[0].classList.add('select2-selection--single');\n\n $selection.html(\n '<span class=\"select2-selection__rendered\"></span>' +\n '<span class=\"select2-selection__arrow\" role=\"presentation\">' +\n '<b role=\"presentation\"></b>' +\n '</span>'\n );\n\n return $selection;\n };\n\n SingleSelection.prototype.bind = function (container, $container) {\n var self = this;\n\n SingleSelection.__super__.bind.apply(this, arguments);\n\n var id = container.id + '-container';\n\n this.$selection.find('.select2-selection__rendered')\n .attr('id', id)\n .attr('role', 'textbox')\n .attr('aria-readonly', 'true');\n this.$selection.attr('aria-labelledby', id);\n this.$selection.attr('aria-controls', id);\n\n this.$selection.on('mousedown', function (evt) {\n // Only respond to left clicks\n if (evt.which !== 1) {\n return;\n }\n\n self.trigger('toggle', {\n originalEvent: evt\n });\n });\n\n this.$selection.on('focus', function (evt) {\n // User focuses on the container\n });\n\n this.$selection.on('blur', function (evt) {\n // User exits the container\n });\n\n container.on('focus', function (evt) {\n if (!container.isOpen()) {\n self.$selection.trigger('focus');\n }\n });\n };\n\n SingleSelection.prototype.clear = function () {\n var $rendered = this.$selection.find('.select2-selection__rendered');\n $rendered.empty();\n $rendered.removeAttr('title'); // clear tooltip on empty\n };\n\n SingleSelection.prototype.display = function (data, container) {\n var template = this.options.get('templateSelection');\n var escapeMarkup = this.options.get('escapeMarkup');\n\n return escapeMarkup(template(data, container));\n };\n\n SingleSelection.prototype.selectionContainer = function () {\n return $('<span></span>');\n };\n\n SingleSelection.prototype.update = function (data) {\n if (data.length === 0) {\n this.clear();\n return;\n }\n\n var selection = data[0];\n\n var $rendered = this.$selection.find('.select2-selection__rendered');\n var formatted = this.display(selection, $rendered);\n\n $rendered.empty().append(formatted);\n\n var title = selection.title || selection.text;\n\n if (title) {\n $rendered.attr('title', title);\n } else {\n $rendered.removeAttr('title');\n }\n };\n\n return SingleSelection;\n});\n\nS2.define('select2/selection/multiple',[\n 'jquery',\n './base',\n '../utils'\n], function ($, BaseSelection, Utils) {\n function MultipleSelection ($element, options) {\n MultipleSelection.__super__.constructor.apply(this, arguments);\n }\n\n Utils.Extend(MultipleSelection, BaseSelection);\n\n MultipleSelection.prototype.render = function () {\n var $selection = MultipleSelection.__super__.render.call(this);\n\n $selection[0].classList.add('select2-selection--multiple');\n\n $selection.html(\n '<ul class=\"select2-selection__rendered\"></ul>'\n );\n\n return $selection;\n };\n\n MultipleSelection.prototype.bind = function (container, $container) {\n var self = this;\n\n MultipleSelection.__super__.bind.apply(this, arguments);\n\n var id = container.id + '-container';\n this.$selection.find('.select2-selection__rendered').attr('id', id);\n\n this.$selection.on('click', function (evt) {\n self.trigger('toggle', {\n originalEvent: evt\n });\n });\n\n this.$selection.on(\n 'click',\n '.select2-selection__choice__remove',\n function (evt) {\n // Ignore the event if it is disabled\n if (self.isDisabled()) {\n return;\n }\n\n var $remove = $(this);\n var $selection = $remove.parent();\n\n var data = Utils.GetData($selection[0], 'data');\n\n self.trigger('unselect', {\n originalEvent: evt,\n data: data\n });\n }\n );\n\n this.$selection.on(\n 'keydown',\n '.select2-selection__choice__remove',\n function (evt) {\n // Ignore the event if it is disabled\n if (self.isDisabled()) {\n return;\n }\n\n evt.stopPropagation();\n }\n );\n };\n\n MultipleSelection.prototype.clear = function () {\n var $rendered = this.$selection.find('.select2-selection__rendered');\n $rendered.empty();\n $rendered.removeAttr('title');\n };\n\n MultipleSelection.prototype.display = function (data, container) {\n var template = this.options.get('templateSelection');\n var escapeMarkup = this.options.get('escapeMarkup');\n\n return escapeMarkup(template(data, container));\n };\n\n MultipleSelection.prototype.selectionContainer = function () {\n var $container = $(\n '<li class=\"select2-selection__choice\">' +\n '<button type=\"button\" class=\"select2-selection__choice__remove\" ' +\n 'tabindex=\"-1\">' +\n '<span aria-hidden=\"true\">×</span>' +\n '</button>' +\n '<span class=\"select2-selection__choice__display\"></span>' +\n '</li>'\n );\n\n return $container;\n };\n\n MultipleSelection.prototype.update = function (data) {\n this.clear();\n\n if (data.length === 0) {\n return;\n }\n\n var $selections = [];\n\n var selectionIdPrefix = this.$selection.find('.select2-selection__rendered')\n .attr('id') + '-choice-';\n\n for (var d = 0; d < data.length; d++) {\n var selection = data[d];\n\n var $selection = this.selectionContainer();\n var formatted = this.display(selection, $selection);\n\n var selectionId = selectionIdPrefix + Utils.generateChars(4) + '-';\n\n if (selection.id) {\n selectionId += selection.id;\n } else {\n selectionId += Utils.generateChars(4);\n }\n\n $selection.find('.select2-selection__choice__display')\n .append(formatted)\n .attr('id', selectionId);\n\n var title = selection.title || selection.text;\n\n if (title) {\n $selection.attr('title', title);\n }\n\n var removeItem = this.options.get('translations').get('removeItem');\n\n var $remove = $selection.find('.select2-selection__choice__remove');\n\n $remove.attr('title', removeItem());\n $remove.attr('aria-label', removeItem());\n $remove.attr('aria-describedby', selectionId);\n\n Utils.StoreData($selection[0], 'data', selection);\n\n $selections.push($selection);\n }\n\n var $rendered = this.$selection.find('.select2-selection__rendered');\n\n $rendered.append($selections);\n };\n\n return MultipleSelection;\n});\n\nS2.define('select2/selection/placeholder',[\n\n], function () {\n function Placeholder (decorated, $element, options) {\n this.placeholder = this.normalizePlaceholder(options.get('placeholder'));\n\n decorated.call(this, $element, options);\n }\n\n Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {\n if (typeof placeholder === 'string') {\n placeholder = {\n id: '',\n text: placeholder\n };\n }\n\n return placeholder;\n };\n\n Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {\n var $placeholder = this.selectionContainer();\n\n $placeholder.html(this.display(placeholder));\n $placeholder[0].classList.add('select2-selection__placeholder');\n $placeholder[0].classList.remove('select2-selection__choice');\n\n var placeholderTitle = placeholder.title ||\n placeholder.text ||\n $placeholder.text();\n\n this.$selection.find('.select2-selection__rendered').attr(\n 'title',\n placeholderTitle\n );\n\n return $placeholder;\n };\n\n Placeholder.prototype.update = function (decorated, data) {\n var singlePlaceholder = (\n data.length == 1 && data[0].id != this.placeholder.id\n );\n var multipleSelections = data.length > 1;\n\n if (multipleSelections || singlePlaceholder) {\n return decorated.call(this, data);\n }\n\n this.clear();\n\n var $placeholder = this.createPlaceholder(this.placeholder);\n\n this.$selection.find('.select2-selection__rendered').append($placeholder);\n };\n\n return Placeholder;\n});\n\nS2.define('select2/selection/allowClear',[\n 'jquery',\n '../keys',\n '../utils'\n], function ($, KEYS, Utils) {\n function AllowClear () { }\n\n AllowClear.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n if (this.placeholder == null) {\n if (this.options.get('debug') && window.console && console.error) {\n console.error(\n 'Select2: The `allowClear` option should be used in combination ' +\n 'with the `placeholder` option.'\n );\n }\n }\n\n this.$selection.on('mousedown', '.select2-selection__clear',\n function (evt) {\n self._handleClear(evt);\n });\n\n container.on('keypress', function (evt) {\n self._handleKeyboardClear(evt, container);\n });\n };\n\n AllowClear.prototype._handleClear = function (_, evt) {\n // Ignore the event if it is disabled\n if (this.isDisabled()) {\n return;\n }\n\n var $clear = this.$selection.find('.select2-selection__clear');\n\n // Ignore the event if nothing has been selected\n if ($clear.length === 0) {\n return;\n }\n\n evt.stopPropagation();\n\n var data = Utils.GetData($clear[0], 'data');\n\n var previousVal = this.$element.val();\n this.$element.val(this.placeholder.id);\n\n var unselectData = {\n data: data\n };\n this.trigger('clear', unselectData);\n if (unselectData.prevented) {\n this.$element.val(previousVal);\n return;\n }\n\n for (var d = 0; d < data.length; d++) {\n unselectData = {\n data: data[d]\n };\n\n // Trigger the `unselect` event, so people can prevent it from being\n // cleared.\n this.trigger('unselect', unselectData);\n\n // If the event was prevented, don't clear it out.\n if (unselectData.prevented) {\n this.$element.val(previousVal);\n return;\n }\n }\n\n this.$element.trigger('input').trigger('change');\n\n this.trigger('toggle', {});\n };\n\n AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {\n if (container.isOpen()) {\n return;\n }\n\n if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {\n this._handleClear(evt);\n }\n };\n\n AllowClear.prototype.update = function (decorated, data) {\n decorated.call(this, data);\n\n this.$selection.find('.select2-selection__clear').remove();\n this.$selection[0].classList.remove('select2-selection--clearable');\n\n if (this.$selection.find('.select2-selection__placeholder').length > 0 ||\n data.length === 0) {\n return;\n }\n\n var selectionId = this.$selection.find('.select2-selection__rendered')\n .attr('id');\n\n var removeAll = this.options.get('translations').get('removeAllItems');\n\n var $remove = $(\n '<button type=\"button\" class=\"select2-selection__clear\" tabindex=\"-1\">' +\n '<span aria-hidden=\"true\">×</span>' +\n '</button>'\n );\n $remove.attr('title', removeAll());\n $remove.attr('aria-label', removeAll());\n $remove.attr('aria-describedby', selectionId);\n Utils.StoreData($remove[0], 'data', data);\n\n this.$selection.prepend($remove);\n this.$selection[0].classList.add('select2-selection--clearable');\n };\n\n return AllowClear;\n});\n\nS2.define('select2/selection/search',[\n 'jquery',\n '../utils',\n '../keys'\n], function ($, Utils, KEYS) {\n function Search (decorated, $element, options) {\n decorated.call(this, $element, options);\n }\n\n Search.prototype.render = function (decorated) {\n var searchLabel = this.options.get('translations').get('search');\n var $search = $(\n '<span class=\"select2-search select2-search--inline\">' +\n '<textarea class=\"select2-search__field\"'+\n ' type=\"search\" tabindex=\"-1\"' +\n ' autocorrect=\"off\" autocapitalize=\"none\"' +\n ' spellcheck=\"false\" role=\"searchbox\" aria-autocomplete=\"list\" >' +\n '</textarea>' +\n '</span>'\n );\n\n this.$searchContainer = $search;\n this.$search = $search.find('textarea');\n\n this.$search.prop('autocomplete', this.options.get('autocomplete'));\n this.$search.attr('aria-label', searchLabel());\n\n var $rendered = decorated.call(this);\n\n this._transferTabIndex();\n $rendered.append(this.$searchContainer);\n\n return $rendered;\n };\n\n Search.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n var resultsId = container.id + '-results';\n var selectionId = container.id + '-container';\n\n decorated.call(this, container, $container);\n\n self.$search.attr('aria-describedby', selectionId);\n\n container.on('open', function () {\n self.$search.attr('aria-controls', resultsId);\n self.$search.trigger('focus');\n });\n\n container.on('close', function () {\n self.$search.val('');\n self.resizeSearch();\n self.$search.removeAttr('aria-controls');\n self.$search.removeAttr('aria-activedescendant');\n self.$search.trigger('focus');\n });\n\n container.on('enable', function () {\n self.$search.prop('disabled', false);\n\n self._transferTabIndex();\n });\n\n container.on('disable', function () {\n self.$search.prop('disabled', true);\n });\n\n container.on('focus', function (evt) {\n self.$search.trigger('focus');\n });\n\n container.on('results:focus', function (params) {\n if (params.data._resultId) {\n self.$search.attr('aria-activedescendant', params.data._resultId);\n } else {\n self.$search.removeAttr('aria-activedescendant');\n }\n });\n\n this.$selection.on('focusin', '.select2-search--inline', function (evt) {\n self.trigger('focus', evt);\n });\n\n this.$selection.on('focusout', '.select2-search--inline', function (evt) {\n self._handleBlur(evt);\n });\n\n this.$selection.on('keydown', '.select2-search--inline', function (evt) {\n evt.stopPropagation();\n\n self.trigger('keypress', evt);\n\n self._keyUpPrevented = evt.isDefaultPrevented();\n\n var key = evt.which;\n\n if (key === KEYS.BACKSPACE && self.$search.val() === '') {\n var $previousChoice = self.$selection\n .find('.select2-selection__choice').last();\n\n if ($previousChoice.length > 0) {\n var item = Utils.GetData($previousChoice[0], 'data');\n\n self.searchRemoveChoice(item);\n\n evt.preventDefault();\n }\n }\n });\n\n this.$selection.on('click', '.select2-search--inline', function (evt) {\n if (self.$search.val()) {\n evt.stopPropagation();\n }\n });\n\n // Try to detect the IE version should the `documentMode` property that\n // is stored on the document. This is only implemented in IE and is\n // slightly cleaner than doing a user agent check.\n // This property is not available in Edge, but Edge also doesn't have\n // this bug.\n var msie = document.documentMode;\n var disableInputEvents = msie && msie <= 11;\n\n // Workaround for browsers which do not support the `input` event\n // This will prevent double-triggering of events for browsers which support\n // both the `keyup` and `input` events.\n this.$selection.on(\n 'input.searchcheck',\n '.select2-search--inline',\n function (evt) {\n // IE will trigger the `input` event when a placeholder is used on a\n // search box. To get around this issue, we are forced to ignore all\n // `input` events in IE and keep using `keyup`.\n if (disableInputEvents) {\n self.$selection.off('input.search input.searchcheck');\n return;\n }\n\n // Unbind the duplicated `keyup` event\n self.$selection.off('keyup.search');\n }\n );\n\n this.$selection.on(\n 'keyup.search input.search',\n '.select2-search--inline',\n function (evt) {\n // IE will trigger the `input` event when a placeholder is used on a\n // search box. To get around this issue, we are forced to ignore all\n // `input` events in IE and keep using `keyup`.\n if (disableInputEvents && evt.type === 'input') {\n self.$selection.off('input.search input.searchcheck');\n return;\n }\n\n var key = evt.which;\n\n // We can freely ignore events from modifier keys\n if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {\n return;\n }\n\n // Tabbing will be handled during the `keydown` phase\n if (key == KEYS.TAB) {\n return;\n }\n\n self.handleSearch(evt);\n }\n );\n };\n\n /**\n * This method will transfer the tabindex attribute from the rendered\n * selection to the search box. This allows for the search box to be used as\n * the primary focus instead of the selection container.\n *\n * @private\n */\n Search.prototype._transferTabIndex = function (decorated) {\n this.$search.attr('tabindex', this.$selection.attr('tabindex'));\n this.$selection.attr('tabindex', '-1');\n };\n\n Search.prototype.createPlaceholder = function (decorated, placeholder) {\n this.$search.attr('placeholder', placeholder.text);\n };\n\n Search.prototype.update = function (decorated, data) {\n var searchHadFocus = this.$search[0] == document.activeElement;\n\n this.$search.attr('placeholder', '');\n\n decorated.call(this, data);\n\n this.resizeSearch();\n if (searchHadFocus) {\n this.$search.trigger('focus');\n }\n };\n\n Search.prototype.handleSearch = function () {\n this.resizeSearch();\n\n if (!this._keyUpPrevented) {\n var input = this.$search.val();\n\n this.trigger('query', {\n term: input\n });\n }\n\n this._keyUpPrevented = false;\n };\n\n Search.prototype.searchRemoveChoice = function (decorated, item) {\n this.trigger('unselect', {\n data: item\n });\n\n this.$search.val(item.text);\n this.handleSearch();\n };\n\n Search.prototype.resizeSearch = function () {\n this.$search.css('width', '25px');\n\n var width = '100%';\n\n if (this.$search.attr('placeholder') === '') {\n var minimumWidth = this.$search.val().length + 1;\n\n width = (minimumWidth * 0.75) + 'em';\n }\n\n this.$search.css('width', width);\n };\n\n return Search;\n});\n\nS2.define('select2/selection/selectionCss',[\n '../utils'\n], function (Utils) {\n function SelectionCSS () { }\n\n SelectionCSS.prototype.render = function (decorated) {\n var $selection = decorated.call(this);\n\n var selectionCssClass = this.options.get('selectionCssClass') || '';\n\n if (selectionCssClass.indexOf(':all:') !== -1) {\n selectionCssClass = selectionCssClass.replace(':all:', '');\n\n Utils.copyNonInternalCssClasses($selection[0], this.$element[0]);\n }\n\n $selection.addClass(selectionCssClass);\n\n return $selection;\n };\n\n return SelectionCSS;\n});\n\nS2.define('select2/selection/eventRelay',[\n 'jquery'\n], function ($) {\n function EventRelay () { }\n\n EventRelay.prototype.bind = function (decorated, container, $container) {\n var self = this;\n var relayEvents = [\n 'open', 'opening',\n 'close', 'closing',\n 'select', 'selecting',\n 'unselect', 'unselecting',\n 'clear', 'clearing'\n ];\n\n var preventableEvents = [\n 'opening', 'closing', 'selecting', 'unselecting', 'clearing'\n ];\n\n decorated.call(this, container, $container);\n\n container.on('*', function (name, params) {\n // Ignore events that should not be relayed\n if (relayEvents.indexOf(name) === -1) {\n return;\n }\n\n // The parameters should always be an object\n params = params || {};\n\n // Generate the jQuery event for the Select2 event\n var evt = $.Event('select2:' + name, {\n params: params\n });\n\n self.$element.trigger(evt);\n\n // Only handle preventable events if it was one\n if (preventableEvents.indexOf(name) === -1) {\n return;\n }\n\n params.prevented = evt.isDefaultPrevented();\n });\n };\n\n return EventRelay;\n});\n\nS2.define('select2/translation',[\n 'jquery',\n 'require'\n], function ($, require) {\n function Translation (dict) {\n this.dict = dict || {};\n }\n\n Translation.prototype.all = function () {\n return this.dict;\n };\n\n Translation.prototype.get = function (key) {\n return this.dict[key];\n };\n\n Translation.prototype.extend = function (translation) {\n this.dict = $.extend({}, translation.all(), this.dict);\n };\n\n // Static functions\n\n Translation._cache = {};\n\n Translation.loadPath = function (path) {\n if (!(path in Translation._cache)) {\n var translations = require(path);\n\n Translation._cache[path] = translations;\n }\n\n return new Translation(Translation._cache[path]);\n };\n\n return Translation;\n});\n\nS2.define('select2/diacritics',[\n\n], function () {\n var diacritics = {\n '\\u24B6': 'A',\n '\\uFF21': 'A',\n '\\u00C0': 'A',\n '\\u00C1': 'A',\n '\\u00C2': 'A',\n '\\u1EA6': 'A',\n '\\u1EA4': 'A',\n '\\u1EAA': 'A',\n '\\u1EA8': 'A',\n '\\u00C3': 'A',\n '\\u0100': 'A',\n '\\u0102': 'A',\n '\\u1EB0': 'A',\n '\\u1EAE': 'A',\n '\\u1EB4': 'A',\n '\\u1EB2': 'A',\n '\\u0226': 'A',\n '\\u01E0': 'A',\n '\\u00C4': 'A',\n '\\u01DE': 'A',\n '\\u1EA2': 'A',\n '\\u00C5': 'A',\n '\\u01FA': 'A',\n '\\u01CD': 'A',\n '\\u0200': 'A',\n '\\u0202': 'A',\n '\\u1EA0': 'A',\n '\\u1EAC': 'A',\n '\\u1EB6': 'A',\n '\\u1E00': 'A',\n '\\u0104': 'A',\n '\\u023A': 'A',\n '\\u2C6F': 'A',\n '\\uA732': 'AA',\n '\\u00C6': 'AE',\n '\\u01FC': 'AE',\n '\\u01E2': 'AE',\n '\\uA734': 'AO',\n '\\uA736': 'AU',\n '\\uA738': 'AV',\n '\\uA73A': 'AV',\n '\\uA73C': 'AY',\n '\\u24B7': 'B',\n '\\uFF22': 'B',\n '\\u1E02': 'B',\n '\\u1E04': 'B',\n '\\u1E06': 'B',\n '\\u0243': 'B',\n '\\u0182': 'B',\n '\\u0181': 'B',\n '\\u24B8': 'C',\n '\\uFF23': 'C',\n '\\u0106': 'C',\n '\\u0108': 'C',\n '\\u010A': 'C',\n '\\u010C': 'C',\n '\\u00C7': 'C',\n '\\u1E08': 'C',\n '\\u0187': 'C',\n '\\u023B': 'C',\n '\\uA73E': 'C',\n '\\u24B9': 'D',\n '\\uFF24': 'D',\n '\\u1E0A': 'D',\n '\\u010E': 'D',\n '\\u1E0C': 'D',\n '\\u1E10': 'D',\n '\\u1E12': 'D',\n '\\u1E0E': 'D',\n '\\u0110': 'D',\n '\\u018B': 'D',\n '\\u018A': 'D',\n '\\u0189': 'D',\n '\\uA779': 'D',\n '\\u01F1': 'DZ',\n '\\u01C4': 'DZ',\n '\\u01F2': 'Dz',\n '\\u01C5': 'Dz',\n '\\u24BA': 'E',\n '\\uFF25': 'E',\n '\\u00C8': 'E',\n '\\u00C9': 'E',\n '\\u00CA': 'E',\n '\\u1EC0': 'E',\n '\\u1EBE': 'E',\n '\\u1EC4': 'E',\n '\\u1EC2': 'E',\n '\\u1EBC': 'E',\n '\\u0112': 'E',\n '\\u1E14': 'E',\n '\\u1E16': 'E',\n '\\u0114': 'E',\n '\\u0116': 'E',\n '\\u00CB': 'E',\n '\\u1EBA': 'E',\n '\\u011A': 'E',\n '\\u0204': 'E',\n '\\u0206': 'E',\n '\\u1EB8': 'E',\n '\\u1EC6': 'E',\n '\\u0228': 'E',\n '\\u1E1C': 'E',\n '\\u0118': 'E',\n '\\u1E18': 'E',\n '\\u1E1A': 'E',\n '\\u0190': 'E',\n '\\u018E': 'E',\n '\\u24BB': 'F',\n '\\uFF26': 'F',\n '\\u1E1E': 'F',\n '\\u0191': 'F',\n '\\uA77B': 'F',\n '\\u24BC': 'G',\n '\\uFF27': 'G',\n '\\u01F4': 'G',\n '\\u011C': 'G',\n '\\u1E20': 'G',\n '\\u011E': 'G',\n '\\u0120': 'G',\n '\\u01E6': 'G',\n '\\u0122': 'G',\n '\\u01E4': 'G',\n '\\u0193': 'G',\n '\\uA7A0': 'G',\n '\\uA77D': 'G',\n '\\uA77E': 'G',\n '\\u24BD': 'H',\n '\\uFF28': 'H',\n '\\u0124': 'H',\n '\\u1E22': 'H',\n '\\u1E26': 'H',\n '\\u021E': 'H',\n '\\u1E24': 'H',\n '\\u1E28': 'H',\n '\\u1E2A': 'H',\n '\\u0126': 'H',\n '\\u2C67': 'H',\n '\\u2C75': 'H',\n '\\uA78D': 'H',\n '\\u24BE': 'I',\n '\\uFF29': 'I',\n '\\u00CC': 'I',\n '\\u00CD': 'I',\n '\\u00CE': 'I',\n '\\u0128': 'I',\n '\\u012A': 'I',\n '\\u012C': 'I',\n '\\u0130': 'I',\n '\\u00CF': 'I',\n '\\u1E2E': 'I',\n '\\u1EC8': 'I',\n '\\u01CF': 'I',\n '\\u0208': 'I',\n '\\u020A': 'I',\n '\\u1ECA': 'I',\n '\\u012E': 'I',\n '\\u1E2C': 'I',\n '\\u0197': 'I',\n '\\u24BF': 'J',\n '\\uFF2A': 'J',\n '\\u0134': 'J',\n '\\u0248': 'J',\n '\\u24C0': 'K',\n '\\uFF2B': 'K',\n '\\u1E30': 'K',\n '\\u01E8': 'K',\n '\\u1E32': 'K',\n '\\u0136': 'K',\n '\\u1E34': 'K',\n '\\u0198': 'K',\n '\\u2C69': 'K',\n '\\uA740': 'K',\n '\\uA742': 'K',\n '\\uA744': 'K',\n '\\uA7A2': 'K',\n '\\u24C1': 'L',\n '\\uFF2C': 'L',\n '\\u013F': 'L',\n '\\u0139': 'L',\n '\\u013D': 'L',\n '\\u1E36': 'L',\n '\\u1E38': 'L',\n '\\u013B': 'L',\n '\\u1E3C': 'L',\n '\\u1E3A': 'L',\n '\\u0141': 'L',\n '\\u023D': 'L',\n '\\u2C62': 'L',\n '\\u2C60': 'L',\n '\\uA748': 'L',\n '\\uA746': 'L',\n '\\uA780': 'L',\n '\\u01C7': 'LJ',\n '\\u01C8': 'Lj',\n '\\u24C2': 'M',\n '\\uFF2D': 'M',\n '\\u1E3E': 'M',\n '\\u1E40': 'M',\n '\\u1E42': 'M',\n '\\u2C6E': 'M',\n '\\u019C': 'M',\n '\\u24C3': 'N',\n '\\uFF2E': 'N',\n '\\u01F8': 'N',\n '\\u0143': 'N',\n '\\u00D1': 'N',\n '\\u1E44': 'N',\n '\\u0147': 'N',\n '\\u1E46': 'N',\n '\\u0145': 'N',\n '\\u1E4A': 'N',\n '\\u1E48': 'N',\n '\\u0220': 'N',\n '\\u019D': 'N',\n '\\uA790': 'N',\n '\\uA7A4': 'N',\n '\\u01CA': 'NJ',\n '\\u01CB': 'Nj',\n '\\u24C4': 'O',\n '\\uFF2F': 'O',\n '\\u00D2': 'O',\n '\\u00D3': 'O',\n '\\u00D4': 'O',\n '\\u1ED2': 'O',\n '\\u1ED0': 'O',\n '\\u1ED6': 'O',\n '\\u1ED4': 'O',\n '\\u00D5': 'O',\n '\\u1E4C': 'O',\n '\\u022C': 'O',\n '\\u1E4E': 'O',\n '\\u014C': 'O',\n '\\u1E50': 'O',\n '\\u1E52': 'O',\n '\\u014E': 'O',\n '\\u022E': 'O',\n '\\u0230': 'O',\n '\\u00D6': 'O',\n '\\u022A': 'O',\n '\\u1ECE': 'O',\n '\\u0150': 'O',\n '\\u01D1': 'O',\n '\\u020C': 'O',\n '\\u020E': 'O',\n '\\u01A0': 'O',\n '\\u1EDC': 'O',\n '\\u1EDA': 'O',\n '\\u1EE0': 'O',\n '\\u1EDE': 'O',\n '\\u1EE2': 'O',\n '\\u1ECC': 'O',\n '\\u1ED8': 'O',\n '\\u01EA': 'O',\n '\\u01EC': 'O',\n '\\u00D8': 'O',\n '\\u01FE': 'O',\n '\\u0186': 'O',\n '\\u019F': 'O',\n '\\uA74A': 'O',\n '\\uA74C': 'O',\n '\\u0152': 'OE',\n '\\u01A2': 'OI',\n '\\uA74E': 'OO',\n '\\u0222': 'OU',\n '\\u24C5': 'P',\n '\\uFF30': 'P',\n '\\u1E54': 'P',\n '\\u1E56': 'P',\n '\\u01A4': 'P',\n '\\u2C63': 'P',\n '\\uA750': 'P',\n '\\uA752': 'P',\n '\\uA754': 'P',\n '\\u24C6': 'Q',\n '\\uFF31': 'Q',\n '\\uA756': 'Q',\n '\\uA758': 'Q',\n '\\u024A': 'Q',\n '\\u24C7': 'R',\n '\\uFF32': 'R',\n '\\u0154': 'R',\n '\\u1E58': 'R',\n '\\u0158': 'R',\n '\\u0210': 'R',\n '\\u0212': 'R',\n '\\u1E5A': 'R',\n '\\u1E5C': 'R',\n '\\u0156': 'R',\n '\\u1E5E': 'R',\n '\\u024C': 'R',\n '\\u2C64': 'R',\n '\\uA75A': 'R',\n '\\uA7A6': 'R',\n '\\uA782': 'R',\n '\\u24C8': 'S',\n '\\uFF33': 'S',\n '\\u1E9E': 'S',\n '\\u015A': 'S',\n '\\u1E64': 'S',\n '\\u015C': 'S',\n '\\u1E60': 'S',\n '\\u0160': 'S',\n '\\u1E66': 'S',\n '\\u1E62': 'S',\n '\\u1E68': 'S',\n '\\u0218': 'S',\n '\\u015E': 'S',\n '\\u2C7E': 'S',\n '\\uA7A8': 'S',\n '\\uA784': 'S',\n '\\u24C9': 'T',\n '\\uFF34': 'T',\n '\\u1E6A': 'T',\n '\\u0164': 'T',\n '\\u1E6C': 'T',\n '\\u021A': 'T',\n '\\u0162': 'T',\n '\\u1E70': 'T',\n '\\u1E6E': 'T',\n '\\u0166': 'T',\n '\\u01AC': 'T',\n '\\u01AE': 'T',\n '\\u023E': 'T',\n '\\uA786': 'T',\n '\\uA728': 'TZ',\n '\\u24CA': 'U',\n '\\uFF35': 'U',\n '\\u00D9': 'U',\n '\\u00DA': 'U',\n '\\u00DB': 'U',\n '\\u0168': 'U',\n '\\u1E78': 'U',\n '\\u016A': 'U',\n '\\u1E7A': 'U',\n '\\u016C': 'U',\n '\\u00DC': 'U',\n '\\u01DB': 'U',\n '\\u01D7': 'U',\n '\\u01D5': 'U',\n '\\u01D9': 'U',\n '\\u1EE6': 'U',\n '\\u016E': 'U',\n '\\u0170': 'U',\n '\\u01D3': 'U',\n '\\u0214': 'U',\n '\\u0216': 'U',\n '\\u01AF': 'U',\n '\\u1EEA': 'U',\n '\\u1EE8': 'U',\n '\\u1EEE': 'U',\n '\\u1EEC': 'U',\n '\\u1EF0': 'U',\n '\\u1EE4': 'U',\n '\\u1E72': 'U',\n '\\u0172': 'U',\n '\\u1E76': 'U',\n '\\u1E74': 'U',\n '\\u0244': 'U',\n '\\u24CB': 'V',\n '\\uFF36': 'V',\n '\\u1E7C': 'V',\n '\\u1E7E': 'V',\n '\\u01B2': 'V',\n '\\uA75E': 'V',\n '\\u0245': 'V',\n '\\uA760': 'VY',\n '\\u24CC': 'W',\n '\\uFF37': 'W',\n '\\u1E80': 'W',\n '\\u1E82': 'W',\n '\\u0174': 'W',\n '\\u1E86': 'W',\n '\\u1E84': 'W',\n '\\u1E88': 'W',\n '\\u2C72': 'W',\n '\\u24CD': 'X',\n '\\uFF38': 'X',\n '\\u1E8A': 'X',\n '\\u1E8C': 'X',\n '\\u24CE': 'Y',\n '\\uFF39': 'Y',\n '\\u1EF2': 'Y',\n '\\u00DD': 'Y',\n '\\u0176': 'Y',\n '\\u1EF8': 'Y',\n '\\u0232': 'Y',\n '\\u1E8E': 'Y',\n '\\u0178': 'Y',\n '\\u1EF6': 'Y',\n '\\u1EF4': 'Y',\n '\\u01B3': 'Y',\n '\\u024E': 'Y',\n '\\u1EFE': 'Y',\n '\\u24CF': 'Z',\n '\\uFF3A': 'Z',\n '\\u0179': 'Z',\n '\\u1E90': 'Z',\n '\\u017B': 'Z',\n '\\u017D': 'Z',\n '\\u1E92': 'Z',\n '\\u1E94': 'Z',\n '\\u01B5': 'Z',\n '\\u0224': 'Z',\n '\\u2C7F': 'Z',\n '\\u2C6B': 'Z',\n '\\uA762': 'Z',\n '\\u24D0': 'a',\n '\\uFF41': 'a',\n '\\u1E9A': 'a',\n '\\u00E0': 'a',\n '\\u00E1': 'a',\n '\\u00E2': 'a',\n '\\u1EA7': 'a',\n '\\u1EA5': 'a',\n '\\u1EAB': 'a',\n '\\u1EA9': 'a',\n '\\u00E3': 'a',\n '\\u0101': 'a',\n '\\u0103': 'a',\n '\\u1EB1': 'a',\n '\\u1EAF': 'a',\n '\\u1EB5': 'a',\n '\\u1EB3': 'a',\n '\\u0227': 'a',\n '\\u01E1': 'a',\n '\\u00E4': 'a',\n '\\u01DF': 'a',\n '\\u1EA3': 'a',\n '\\u00E5': 'a',\n '\\u01FB': 'a',\n '\\u01CE': 'a',\n '\\u0201': 'a',\n '\\u0203': 'a',\n '\\u1EA1': 'a',\n '\\u1EAD': 'a',\n '\\u1EB7': 'a',\n '\\u1E01': 'a',\n '\\u0105': 'a',\n '\\u2C65': 'a',\n '\\u0250': 'a',\n '\\uA733': 'aa',\n '\\u00E6': 'ae',\n '\\u01FD': 'ae',\n '\\u01E3': 'ae',\n '\\uA735': 'ao',\n '\\uA737': 'au',\n '\\uA739': 'av',\n '\\uA73B': 'av',\n '\\uA73D': 'ay',\n '\\u24D1': 'b',\n '\\uFF42': 'b',\n '\\u1E03': 'b',\n '\\u1E05': 'b',\n '\\u1E07': 'b',\n '\\u0180': 'b',\n '\\u0183': 'b',\n '\\u0253': 'b',\n '\\u24D2': 'c',\n '\\uFF43': 'c',\n '\\u0107': 'c',\n '\\u0109': 'c',\n '\\u010B': 'c',\n '\\u010D': 'c',\n '\\u00E7': 'c',\n '\\u1E09': 'c',\n '\\u0188': 'c',\n '\\u023C': 'c',\n '\\uA73F': 'c',\n '\\u2184': 'c',\n '\\u24D3': 'd',\n '\\uFF44': 'd',\n '\\u1E0B': 'd',\n '\\u010F': 'd',\n '\\u1E0D': 'd',\n '\\u1E11': 'd',\n '\\u1E13': 'd',\n '\\u1E0F': 'd',\n '\\u0111': 'd',\n '\\u018C': 'd',\n '\\u0256': 'd',\n '\\u0257': 'd',\n '\\uA77A': 'd',\n '\\u01F3': 'dz',\n '\\u01C6': 'dz',\n '\\u24D4': 'e',\n '\\uFF45': 'e',\n '\\u00E8': 'e',\n '\\u00E9': 'e',\n '\\u00EA': 'e',\n '\\u1EC1': 'e',\n '\\u1EBF': 'e',\n '\\u1EC5': 'e',\n '\\u1EC3': 'e',\n '\\u1EBD': 'e',\n '\\u0113': 'e',\n '\\u1E15': 'e',\n '\\u1E17': 'e',\n '\\u0115': 'e',\n '\\u0117': 'e',\n '\\u00EB': 'e',\n '\\u1EBB': 'e',\n '\\u011B': 'e',\n '\\u0205': 'e',\n '\\u0207': 'e',\n '\\u1EB9': 'e',\n '\\u1EC7': 'e',\n '\\u0229': 'e',\n '\\u1E1D': 'e',\n '\\u0119': 'e',\n '\\u1E19': 'e',\n '\\u1E1B': 'e',\n '\\u0247': 'e',\n '\\u025B': 'e',\n '\\u01DD': 'e',\n '\\u24D5': 'f',\n '\\uFF46': 'f',\n '\\u1E1F': 'f',\n '\\u0192': 'f',\n '\\uA77C': 'f',\n '\\u24D6': 'g',\n '\\uFF47': 'g',\n '\\u01F5': 'g',\n '\\u011D': 'g',\n '\\u1E21': 'g',\n '\\u011F': 'g',\n '\\u0121': 'g',\n '\\u01E7': 'g',\n '\\u0123': 'g',\n '\\u01E5': 'g',\n '\\u0260': 'g',\n '\\uA7A1': 'g',\n '\\u1D79': 'g',\n '\\uA77F': 'g',\n '\\u24D7': 'h',\n '\\uFF48': 'h',\n '\\u0125': 'h',\n '\\u1E23': 'h',\n '\\u1E27': 'h',\n '\\u021F': 'h',\n '\\u1E25': 'h',\n '\\u1E29': 'h',\n '\\u1E2B': 'h',\n '\\u1E96': 'h',\n '\\u0127': 'h',\n '\\u2C68': 'h',\n '\\u2C76': 'h',\n '\\u0265': 'h',\n '\\u0195': 'hv',\n '\\u24D8': 'i',\n '\\uFF49': 'i',\n '\\u00EC': 'i',\n '\\u00ED': 'i',\n '\\u00EE': 'i',\n '\\u0129': 'i',\n '\\u012B': 'i',\n '\\u012D': 'i',\n '\\u00EF': 'i',\n '\\u1E2F': 'i',\n '\\u1EC9': 'i',\n '\\u01D0': 'i',\n '\\u0209': 'i',\n '\\u020B': 'i',\n '\\u1ECB': 'i',\n '\\u012F': 'i',\n '\\u1E2D': 'i',\n '\\u0268': 'i',\n '\\u0131': 'i',\n '\\u24D9': 'j',\n '\\uFF4A': 'j',\n '\\u0135': 'j',\n '\\u01F0': 'j',\n '\\u0249': 'j',\n '\\u24DA': 'k',\n '\\uFF4B': 'k',\n '\\u1E31': 'k',\n '\\u01E9': 'k',\n '\\u1E33': 'k',\n '\\u0137': 'k',\n '\\u1E35': 'k',\n '\\u0199': 'k',\n '\\u2C6A': 'k',\n '\\uA741': 'k',\n '\\uA743': 'k',\n '\\uA745': 'k',\n '\\uA7A3': 'k',\n '\\u24DB': 'l',\n '\\uFF4C': 'l',\n '\\u0140': 'l',\n '\\u013A': 'l',\n '\\u013E': 'l',\n '\\u1E37': 'l',\n '\\u1E39': 'l',\n '\\u013C': 'l',\n '\\u1E3D': 'l',\n '\\u1E3B': 'l',\n '\\u017F': 'l',\n '\\u0142': 'l',\n '\\u019A': 'l',\n '\\u026B': 'l',\n '\\u2C61': 'l',\n '\\uA749': 'l',\n '\\uA781': 'l',\n '\\uA747': 'l',\n '\\u01C9': 'lj',\n '\\u24DC': 'm',\n '\\uFF4D': 'm',\n '\\u1E3F': 'm',\n '\\u1E41': 'm',\n '\\u1E43': 'm',\n '\\u0271': 'm',\n '\\u026F': 'm',\n '\\u24DD': 'n',\n '\\uFF4E': 'n',\n '\\u01F9': 'n',\n '\\u0144': 'n',\n '\\u00F1': 'n',\n '\\u1E45': 'n',\n '\\u0148': 'n',\n '\\u1E47': 'n',\n '\\u0146': 'n',\n '\\u1E4B': 'n',\n '\\u1E49': 'n',\n '\\u019E': 'n',\n '\\u0272': 'n',\n '\\u0149': 'n',\n '\\uA791': 'n',\n '\\uA7A5': 'n',\n '\\u01CC': 'nj',\n '\\u24DE': 'o',\n '\\uFF4F': 'o',\n '\\u00F2': 'o',\n '\\u00F3': 'o',\n '\\u00F4': 'o',\n '\\u1ED3': 'o',\n '\\u1ED1': 'o',\n '\\u1ED7': 'o',\n '\\u1ED5': 'o',\n '\\u00F5': 'o',\n '\\u1E4D': 'o',\n '\\u022D': 'o',\n '\\u1E4F': 'o',\n '\\u014D': 'o',\n '\\u1E51': 'o',\n '\\u1E53': 'o',\n '\\u014F': 'o',\n '\\u022F': 'o',\n '\\u0231': 'o',\n '\\u00F6': 'o',\n '\\u022B': 'o',\n '\\u1ECF': 'o',\n '\\u0151': 'o',\n '\\u01D2': 'o',\n '\\u020D': 'o',\n '\\u020F': 'o',\n '\\u01A1': 'o',\n '\\u1EDD': 'o',\n '\\u1EDB': 'o',\n '\\u1EE1': 'o',\n '\\u1EDF': 'o',\n '\\u1EE3': 'o',\n '\\u1ECD': 'o',\n '\\u1ED9': 'o',\n '\\u01EB': 'o',\n '\\u01ED': 'o',\n '\\u00F8': 'o',\n '\\u01FF': 'o',\n '\\u0254': 'o',\n '\\uA74B': 'o',\n '\\uA74D': 'o',\n '\\u0275': 'o',\n '\\u0153': 'oe',\n '\\u01A3': 'oi',\n '\\u0223': 'ou',\n '\\uA74F': 'oo',\n '\\u24DF': 'p',\n '\\uFF50': 'p',\n '\\u1E55': 'p',\n '\\u1E57': 'p',\n '\\u01A5': 'p',\n '\\u1D7D': 'p',\n '\\uA751': 'p',\n '\\uA753': 'p',\n '\\uA755': 'p',\n '\\u24E0': 'q',\n '\\uFF51': 'q',\n '\\u024B': 'q',\n '\\uA757': 'q',\n '\\uA759': 'q',\n '\\u24E1': 'r',\n '\\uFF52': 'r',\n '\\u0155': 'r',\n '\\u1E59': 'r',\n '\\u0159': 'r',\n '\\u0211': 'r',\n '\\u0213': 'r',\n '\\u1E5B': 'r',\n '\\u1E5D': 'r',\n '\\u0157': 'r',\n '\\u1E5F': 'r',\n '\\u024D': 'r',\n '\\u027D': 'r',\n '\\uA75B': 'r',\n '\\uA7A7': 'r',\n '\\uA783': 'r',\n '\\u24E2': 's',\n '\\uFF53': 's',\n '\\u00DF': 's',\n '\\u015B': 's',\n '\\u1E65': 's',\n '\\u015D': 's',\n '\\u1E61': 's',\n '\\u0161': 's',\n '\\u1E67': 's',\n '\\u1E63': 's',\n '\\u1E69': 's',\n '\\u0219': 's',\n '\\u015F': 's',\n '\\u023F': 's',\n '\\uA7A9': 's',\n '\\uA785': 's',\n '\\u1E9B': 's',\n '\\u24E3': 't',\n '\\uFF54': 't',\n '\\u1E6B': 't',\n '\\u1E97': 't',\n '\\u0165': 't',\n '\\u1E6D': 't',\n '\\u021B': 't',\n '\\u0163': 't',\n '\\u1E71': 't',\n '\\u1E6F': 't',\n '\\u0167': 't',\n '\\u01AD': 't',\n '\\u0288': 't',\n '\\u2C66': 't',\n '\\uA787': 't',\n '\\uA729': 'tz',\n '\\u24E4': 'u',\n '\\uFF55': 'u',\n '\\u00F9': 'u',\n '\\u00FA': 'u',\n '\\u00FB': 'u',\n '\\u0169': 'u',\n '\\u1E79': 'u',\n '\\u016B': 'u',\n '\\u1E7B': 'u',\n '\\u016D': 'u',\n '\\u00FC': 'u',\n '\\u01DC': 'u',\n '\\u01D8': 'u',\n '\\u01D6': 'u',\n '\\u01DA': 'u',\n '\\u1EE7': 'u',\n '\\u016F': 'u',\n '\\u0171': 'u',\n '\\u01D4': 'u',\n '\\u0215': 'u',\n '\\u0217': 'u',\n '\\u01B0': 'u',\n '\\u1EEB': 'u',\n '\\u1EE9': 'u',\n '\\u1EEF': 'u',\n '\\u1EED': 'u',\n '\\u1EF1': 'u',\n '\\u1EE5': 'u',\n '\\u1E73': 'u',\n '\\u0173': 'u',\n '\\u1E77': 'u',\n '\\u1E75': 'u',\n '\\u0289': 'u',\n '\\u24E5': 'v',\n '\\uFF56': 'v',\n '\\u1E7D': 'v',\n '\\u1E7F': 'v',\n '\\u028B': 'v',\n '\\uA75F': 'v',\n '\\u028C': 'v',\n '\\uA761': 'vy',\n '\\u24E6': 'w',\n '\\uFF57': 'w',\n '\\u1E81': 'w',\n '\\u1E83': 'w',\n '\\u0175': 'w',\n '\\u1E87': 'w',\n '\\u1E85': 'w',\n '\\u1E98': 'w',\n '\\u1E89': 'w',\n '\\u2C73': 'w',\n '\\u24E7': 'x',\n '\\uFF58': 'x',\n '\\u1E8B': 'x',\n '\\u1E8D': 'x',\n '\\u24E8': 'y',\n '\\uFF59': 'y',\n '\\u1EF3': 'y',\n '\\u00FD': 'y',\n '\\u0177': 'y',\n '\\u1EF9': 'y',\n '\\u0233': 'y',\n '\\u1E8F': 'y',\n '\\u00FF': 'y',\n '\\u1EF7': 'y',\n '\\u1E99': 'y',\n '\\u1EF5': 'y',\n '\\u01B4': 'y',\n '\\u024F': 'y',\n '\\u1EFF': 'y',\n '\\u24E9': 'z',\n '\\uFF5A': 'z',\n '\\u017A': 'z',\n '\\u1E91': 'z',\n '\\u017C': 'z',\n '\\u017E': 'z',\n '\\u1E93': 'z',\n '\\u1E95': 'z',\n '\\u01B6': 'z',\n '\\u0225': 'z',\n '\\u0240': 'z',\n '\\u2C6C': 'z',\n '\\uA763': 'z',\n '\\u0386': '\\u0391',\n '\\u0388': '\\u0395',\n '\\u0389': '\\u0397',\n '\\u038A': '\\u0399',\n '\\u03AA': '\\u0399',\n '\\u038C': '\\u039F',\n '\\u038E': '\\u03A5',\n '\\u03AB': '\\u03A5',\n '\\u038F': '\\u03A9',\n '\\u03AC': '\\u03B1',\n '\\u03AD': '\\u03B5',\n '\\u03AE': '\\u03B7',\n '\\u03AF': '\\u03B9',\n '\\u03CA': '\\u03B9',\n '\\u0390': '\\u03B9',\n '\\u03CC': '\\u03BF',\n '\\u03CD': '\\u03C5',\n '\\u03CB': '\\u03C5',\n '\\u03B0': '\\u03C5',\n '\\u03CE': '\\u03C9',\n '\\u03C2': '\\u03C3',\n '\\u2019': '\\''\n };\n\n return diacritics;\n});\n\nS2.define('select2/data/base',[\n '../utils'\n], function (Utils) {\n function BaseAdapter ($element, options) {\n BaseAdapter.__super__.constructor.call(this);\n }\n\n Utils.Extend(BaseAdapter, Utils.Observable);\n\n BaseAdapter.prototype.current = function (callback) {\n throw new Error('The `current` method must be defined in child classes.');\n };\n\n BaseAdapter.prototype.query = function (params, callback) {\n throw new Error('The `query` method must be defined in child classes.');\n };\n\n BaseAdapter.prototype.bind = function (container, $container) {\n // Can be implemented in subclasses\n };\n\n BaseAdapter.prototype.destroy = function () {\n // Can be implemented in subclasses\n };\n\n BaseAdapter.prototype.generateResultId = function (container, data) {\n var id = container.id + '-result-';\n\n id += Utils.generateChars(4);\n\n if (data.id != null) {\n id += '-' + data.id.toString();\n } else {\n id += '-' + Utils.generateChars(4);\n }\n return id;\n };\n\n return BaseAdapter;\n});\n\nS2.define('select2/data/select',[\n './base',\n '../utils',\n 'jquery'\n], function (BaseAdapter, Utils, $) {\n function SelectAdapter ($element, options) {\n this.$element = $element;\n this.options = options;\n\n SelectAdapter.__super__.constructor.call(this);\n }\n\n Utils.Extend(SelectAdapter, BaseAdapter);\n\n SelectAdapter.prototype.current = function (callback) {\n var self = this;\n\n var data = Array.prototype.map.call(\n this.$element[0].querySelectorAll(':checked'),\n function (selectedElement) {\n return self.item($(selectedElement));\n }\n );\n\n callback(data);\n };\n\n SelectAdapter.prototype.select = function (data) {\n var self = this;\n\n data.selected = true;\n\n // If data.element is a DOM node, use it instead\n if (\n data.element != null && data.element.tagName.toLowerCase() === 'option'\n ) {\n data.element.selected = true;\n\n this.$element.trigger('input').trigger('change');\n\n return;\n }\n\n if (this.$element.prop('multiple')) {\n this.current(function (currentData) {\n var val = [];\n\n data = [data];\n data.push.apply(data, currentData);\n\n for (var d = 0; d < data.length; d++) {\n var id = data[d].id;\n\n if (val.indexOf(id) === -1) {\n val.push(id);\n }\n }\n\n self.$element.val(val);\n self.$element.trigger('input').trigger('change');\n });\n } else {\n var val = data.id;\n\n this.$element.val(val);\n this.$element.trigger('input').trigger('change');\n }\n };\n\n SelectAdapter.prototype.unselect = function (data) {\n var self = this;\n\n if (!this.$element.prop('multiple')) {\n return;\n }\n\n data.selected = false;\n\n if (\n data.element != null &&\n data.element.tagName.toLowerCase() === 'option'\n ) {\n data.element.selected = false;\n\n this.$element.trigger('input').trigger('change');\n\n return;\n }\n\n this.current(function (currentData) {\n var val = [];\n\n for (var d = 0; d < currentData.length; d++) {\n var id = currentData[d].id;\n\n if (id !== data.id && val.indexOf(id) === -1) {\n val.push(id);\n }\n }\n\n self.$element.val(val);\n\n self.$element.trigger('input').trigger('change');\n });\n };\n\n SelectAdapter.prototype.bind = function (container, $container) {\n var self = this;\n\n this.container = container;\n\n container.on('select', function (params) {\n self.select(params.data);\n });\n\n container.on('unselect', function (params) {\n self.unselect(params.data);\n });\n };\n\n SelectAdapter.prototype.destroy = function () {\n // Remove anything added to child elements\n this.$element.find('*').each(function () {\n // Remove any custom data set by Select2\n Utils.RemoveData(this);\n });\n };\n\n SelectAdapter.prototype.query = function (params, callback) {\n var data = [];\n var self = this;\n\n var $options = this.$element.children();\n\n $options.each(function () {\n if (\n this.tagName.toLowerCase() !== 'option' &&\n this.tagName.toLowerCase() !== 'optgroup'\n ) {\n return;\n }\n\n var $option = $(this);\n\n var option = self.item($option);\n\n var matches = self.matches(params, option);\n\n if (matches !== null) {\n data.push(matches);\n }\n });\n\n callback({\n results: data\n });\n };\n\n SelectAdapter.prototype.addOptions = function ($options) {\n this.$element.append($options);\n };\n\n SelectAdapter.prototype.option = function (data) {\n var option;\n\n if (data.children) {\n option = document.createElement('optgroup');\n option.label = data.text;\n } else {\n option = document.createElement('option');\n\n if (option.textContent !== undefined) {\n option.textContent = data.text;\n } else {\n option.innerText = data.text;\n }\n }\n\n if (data.id !== undefined) {\n option.value = data.id;\n }\n\n if (data.disabled) {\n option.disabled = true;\n }\n\n if (data.selected) {\n option.selected = true;\n }\n\n if (data.title) {\n option.title = data.title;\n }\n\n var normalizedData = this._normalizeItem(data);\n normalizedData.element = option;\n\n // Override the option's data with the combined data\n Utils.StoreData(option, 'data', normalizedData);\n\n return $(option);\n };\n\n SelectAdapter.prototype.item = function ($option) {\n var data = {};\n\n data = Utils.GetData($option[0], 'data');\n\n if (data != null) {\n return data;\n }\n\n var option = $option[0];\n\n if (option.tagName.toLowerCase() === 'option') {\n data = {\n id: $option.val(),\n text: $option.text(),\n disabled: $option.prop('disabled'),\n selected: $option.prop('selected'),\n title: $option.prop('title')\n };\n } else if (option.tagName.toLowerCase() === 'optgroup') {\n data = {\n text: $option.prop('label'),\n children: [],\n title: $option.prop('title')\n };\n\n var $children = $option.children('option');\n var children = [];\n\n for (var c = 0; c < $children.length; c++) {\n var $child = $($children[c]);\n\n var child = this.item($child);\n\n children.push(child);\n }\n\n data.children = children;\n }\n\n data = this._normalizeItem(data);\n data.element = $option[0];\n\n Utils.StoreData($option[0], 'data', data);\n\n return data;\n };\n\n SelectAdapter.prototype._normalizeItem = function (item) {\n if (item !== Object(item)) {\n item = {\n id: item,\n text: item\n };\n }\n\n item = $.extend({}, {\n text: ''\n }, item);\n\n var defaults = {\n selected: false,\n disabled: false\n };\n\n if (item.id != null) {\n item.id = item.id.toString();\n }\n\n if (item.text != null) {\n item.text = item.text.toString();\n }\n\n if (item._resultId == null && item.id && this.container != null) {\n item._resultId = this.generateResultId(this.container, item);\n }\n\n return $.extend({}, defaults, item);\n };\n\n SelectAdapter.prototype.matches = function (params, data) {\n var matcher = this.options.get('matcher');\n\n return matcher(params, data);\n };\n\n return SelectAdapter;\n});\n\nS2.define('select2/data/array',[\n './select',\n '../utils',\n 'jquery'\n], function (SelectAdapter, Utils, $) {\n function ArrayAdapter ($element, options) {\n this._dataToConvert = options.get('data') || [];\n\n ArrayAdapter.__super__.constructor.call(this, $element, options);\n }\n\n Utils.Extend(ArrayAdapter, SelectAdapter);\n\n ArrayAdapter.prototype.bind = function (container, $container) {\n ArrayAdapter.__super__.bind.call(this, container, $container);\n\n this.addOptions(this.convertToOptions(this._dataToConvert));\n };\n\n ArrayAdapter.prototype.select = function (data) {\n var $option = this.$element.find('option').filter(function (i, elm) {\n return elm.value == data.id.toString();\n });\n\n if ($option.length === 0) {\n $option = this.option(data);\n\n this.addOptions($option);\n }\n\n ArrayAdapter.__super__.select.call(this, data);\n };\n\n ArrayAdapter.prototype.convertToOptions = function (data) {\n var self = this;\n\n var $existing = this.$element.find('option');\n var existingIds = $existing.map(function () {\n return self.item($(this)).id;\n }).get();\n\n var $options = [];\n\n // Filter out all items except for the one passed in the argument\n function onlyItem (item) {\n return function () {\n return $(this).val() == item.id;\n };\n }\n\n for (var d = 0; d < data.length; d++) {\n var item = this._normalizeItem(data[d]);\n\n // Skip items which were pre-loaded, only merge the data\n if (existingIds.indexOf(item.id) >= 0) {\n var $existingOption = $existing.filter(onlyItem(item));\n\n var existingData = this.item($existingOption);\n var newData = $.extend(true, {}, item, existingData);\n\n var $newOption = this.option(newData);\n\n $existingOption.replaceWith($newOption);\n\n continue;\n }\n\n var $option = this.option(item);\n\n if (item.children) {\n var $children = this.convertToOptions(item.children);\n\n $option.append($children);\n }\n\n $options.push($option);\n }\n\n return $options;\n };\n\n return ArrayAdapter;\n});\n\nS2.define('select2/data/ajax',[\n './array',\n '../utils',\n 'jquery'\n], function (ArrayAdapter, Utils, $) {\n function AjaxAdapter ($element, options) {\n this.ajaxOptions = this._applyDefaults(options.get('ajax'));\n\n if (this.ajaxOptions.processResults != null) {\n this.processResults = this.ajaxOptions.processResults;\n }\n\n AjaxAdapter.__super__.constructor.call(this, $element, options);\n }\n\n Utils.Extend(AjaxAdapter, ArrayAdapter);\n\n AjaxAdapter.prototype._applyDefaults = function (options) {\n var defaults = {\n data: function (params) {\n return $.extend({}, params, {\n q: params.term\n });\n },\n transport: function (params, success, failure) {\n var $request = $.ajax(params);\n\n $request.then(success);\n $request.fail(failure);\n\n return $request;\n }\n };\n\n return $.extend({}, defaults, options, true);\n };\n\n AjaxAdapter.prototype.processResults = function (results) {\n return results;\n };\n\n AjaxAdapter.prototype.query = function (params, callback) {\n var matches = [];\n var self = this;\n\n if (this._request != null) {\n // JSONP requests cannot always be aborted\n if (typeof this._request.abort === 'function') {\n this._request.abort();\n }\n\n this._request = null;\n }\n\n var options = $.extend({\n type: 'GET'\n }, this.ajaxOptions);\n\n if (typeof options.url === 'function') {\n options.url = options.url.call(this.$element, params);\n }\n\n if (typeof options.data === 'function') {\n options.data = options.data.call(this.$element, params);\n }\n\n function request () {\n var $request = options.transport(options, function (data) {\n var results = self.processResults(data, params);\n\n if (self.options.get('debug') && window.console && console.error) {\n // Check to make sure that the response included a `results` key.\n if (!results || !results.results || !Array.isArray(results.results)) {\n console.error(\n 'Select2: The AJAX results did not return an array in the ' +\n '`results` key of the response.'\n );\n }\n }\n\n callback(results);\n }, function () {\n // Attempt to detect if a request was aborted\n // Only works if the transport exposes a status property\n if ('status' in $request &&\n ($request.status === 0 || $request.status === '0')) {\n return;\n }\n\n self.trigger('results:message', {\n message: 'errorLoading'\n });\n });\n\n self._request = $request;\n }\n\n if (this.ajaxOptions.delay && params.term != null) {\n if (this._queryTimeout) {\n window.clearTimeout(this._queryTimeout);\n }\n\n this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);\n } else {\n request();\n }\n };\n\n return AjaxAdapter;\n});\n\nS2.define('select2/data/tags',[\n 'jquery'\n], function ($) {\n function Tags (decorated, $element, options) {\n var tags = options.get('tags');\n\n var createTag = options.get('createTag');\n\n if (createTag !== undefined) {\n this.createTag = createTag;\n }\n\n var insertTag = options.get('insertTag');\n\n if (insertTag !== undefined) {\n this.insertTag = insertTag;\n }\n\n decorated.call(this, $element, options);\n\n if (Array.isArray(tags)) {\n for (var t = 0; t < tags.length; t++) {\n var tag = tags[t];\n var item = this._normalizeItem(tag);\n\n var $option = this.option(item);\n\n this.$element.append($option);\n }\n }\n }\n\n Tags.prototype.query = function (decorated, params, callback) {\n var self = this;\n\n this._removeOldTags();\n\n if (params.term == null || params.page != null) {\n decorated.call(this, params, callback);\n return;\n }\n\n function wrapper (obj, child) {\n var data = obj.results;\n\n for (var i = 0; i < data.length; i++) {\n var option = data[i];\n\n var checkChildren = (\n option.children != null &&\n !wrapper({\n results: option.children\n }, true)\n );\n\n var optionText = (option.text || '').toUpperCase();\n var paramsTerm = (params.term || '').toUpperCase();\n\n var checkText = optionText === paramsTerm;\n\n if (checkText || checkChildren) {\n if (child) {\n return false;\n }\n\n obj.data = data;\n callback(obj);\n\n return;\n }\n }\n\n if (child) {\n return true;\n }\n\n var tag = self.createTag(params);\n\n if (tag != null) {\n var $option = self.option(tag);\n $option.attr('data-select2-tag', 'true');\n\n self.addOptions([$option]);\n\n self.insertTag(data, tag);\n }\n\n obj.results = data;\n\n callback(obj);\n }\n\n decorated.call(this, params, wrapper);\n };\n\n Tags.prototype.createTag = function (decorated, params) {\n if (params.term == null) {\n return null;\n }\n\n var term = params.term.trim();\n\n if (term === '') {\n return null;\n }\n\n return {\n id: term,\n text: term\n };\n };\n\n Tags.prototype.insertTag = function (_, data, tag) {\n data.unshift(tag);\n };\n\n Tags.prototype._removeOldTags = function (_) {\n var $options = this.$element.find('option[data-select2-tag]');\n\n $options.each(function () {\n if (this.selected) {\n return;\n }\n\n $(this).remove();\n });\n };\n\n return Tags;\n});\n\nS2.define('select2/data/tokenizer',[\n 'jquery'\n], function ($) {\n function Tokenizer (decorated, $element, options) {\n var tokenizer = options.get('tokenizer');\n\n if (tokenizer !== undefined) {\n this.tokenizer = tokenizer;\n }\n\n decorated.call(this, $element, options);\n }\n\n Tokenizer.prototype.bind = function (decorated, container, $container) {\n decorated.call(this, container, $container);\n\n this.$search = container.dropdown.$search || container.selection.$search ||\n $container.find('.select2-search__field');\n };\n\n Tokenizer.prototype.query = function (decorated, params, callback) {\n var self = this;\n\n function createAndSelect (data) {\n // Normalize the data object so we can use it for checks\n var item = self._normalizeItem(data);\n\n // Check if the data object already exists as a tag\n // Select it if it doesn't\n var $existingOptions = self.$element.find('option').filter(function () {\n return $(this).val() === item.id;\n });\n\n // If an existing option wasn't found for it, create the option\n if (!$existingOptions.length) {\n var $option = self.option(item);\n $option.attr('data-select2-tag', true);\n\n self._removeOldTags();\n self.addOptions([$option]);\n }\n\n // Select the item, now that we know there is an option for it\n select(item);\n }\n\n function select (data) {\n self.trigger('select', {\n data: data\n });\n }\n\n params.term = params.term || '';\n\n var tokenData = this.tokenizer(params, this.options, createAndSelect);\n\n if (tokenData.term !== params.term) {\n // Replace the search term if we have the search box\n if (this.$search.length) {\n this.$search.val(tokenData.term);\n this.$search.trigger('focus');\n }\n\n params.term = tokenData.term;\n }\n\n decorated.call(this, params, callback);\n };\n\n Tokenizer.prototype.tokenizer = function (_, params, options, callback) {\n var separators = options.get('tokenSeparators') || [];\n var term = params.term;\n var i = 0;\n\n var createTag = this.createTag || function (params) {\n return {\n id: params.term,\n text: params.term\n };\n };\n\n while (i < term.length) {\n var termChar = term[i];\n\n if (separators.indexOf(termChar) === -1) {\n i++;\n\n continue;\n }\n\n var part = term.substr(0, i);\n var partParams = $.extend({}, params, {\n term: part\n });\n\n var data = createTag(partParams);\n\n if (data == null) {\n i++;\n continue;\n }\n\n callback(data);\n\n // Reset the term to not include the tokenized portion\n term = term.substr(i + 1) || '';\n i = 0;\n }\n\n return {\n term: term\n };\n };\n\n return Tokenizer;\n});\n\nS2.define('select2/data/minimumInputLength',[\n\n], function () {\n function MinimumInputLength (decorated, $e, options) {\n this.minimumInputLength = options.get('minimumInputLength');\n\n decorated.call(this, $e, options);\n }\n\n MinimumInputLength.prototype.query = function (decorated, params, callback) {\n params.term = params.term || '';\n\n if (params.term.length < this.minimumInputLength) {\n this.trigger('results:message', {\n message: 'inputTooShort',\n args: {\n minimum: this.minimumInputLength,\n input: params.term,\n params: params\n }\n });\n\n return;\n }\n\n decorated.call(this, params, callback);\n };\n\n return MinimumInputLength;\n});\n\nS2.define('select2/data/maximumInputLength',[\n\n], function () {\n function MaximumInputLength (decorated, $e, options) {\n this.maximumInputLength = options.get('maximumInputLength');\n\n decorated.call(this, $e, options);\n }\n\n MaximumInputLength.prototype.query = function (decorated, params, callback) {\n params.term = params.term || '';\n\n if (this.maximumInputLength > 0 &&\n params.term.length > this.maximumInputLength) {\n this.trigger('results:message', {\n message: 'inputTooLong',\n args: {\n maximum: this.maximumInputLength,\n input: params.term,\n params: params\n }\n });\n\n return;\n }\n\n decorated.call(this, params, callback);\n };\n\n return MaximumInputLength;\n});\n\nS2.define('select2/data/maximumSelectionLength',[\n\n], function (){\n function MaximumSelectionLength (decorated, $e, options) {\n this.maximumSelectionLength = options.get('maximumSelectionLength');\n\n decorated.call(this, $e, options);\n }\n\n MaximumSelectionLength.prototype.bind =\n function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('select', function () {\n self._checkIfMaximumSelected();\n });\n };\n\n MaximumSelectionLength.prototype.query =\n function (decorated, params, callback) {\n var self = this;\n\n this._checkIfMaximumSelected(function () {\n decorated.call(self, params, callback);\n });\n };\n\n MaximumSelectionLength.prototype._checkIfMaximumSelected =\n function (_, successCallback) {\n var self = this;\n\n this.current(function (currentData) {\n var count = currentData != null ? currentData.length : 0;\n if (self.maximumSelectionLength > 0 &&\n count >= self.maximumSelectionLength) {\n self.trigger('results:message', {\n message: 'maximumSelected',\n args: {\n maximum: self.maximumSelectionLength\n }\n });\n return;\n }\n\n if (successCallback) {\n successCallback();\n }\n });\n };\n\n return MaximumSelectionLength;\n});\n\nS2.define('select2/dropdown',[\n 'jquery',\n './utils'\n], function ($, Utils) {\n function Dropdown ($element, options) {\n this.$element = $element;\n this.options = options;\n\n Dropdown.__super__.constructor.call(this);\n }\n\n Utils.Extend(Dropdown, Utils.Observable);\n\n Dropdown.prototype.render = function () {\n var $dropdown = $(\n '<span class=\"select2-dropdown\">' +\n '<span class=\"select2-results\"></span>' +\n '</span>'\n );\n\n $dropdown.attr('dir', this.options.get('dir'));\n\n this.$dropdown = $dropdown;\n\n return $dropdown;\n };\n\n Dropdown.prototype.bind = function () {\n // Should be implemented in subclasses\n };\n\n Dropdown.prototype.position = function ($dropdown, $container) {\n // Should be implemented in subclasses\n };\n\n Dropdown.prototype.destroy = function () {\n // Remove the dropdown from the DOM\n this.$dropdown.remove();\n };\n\n return Dropdown;\n});\n\nS2.define('select2/dropdown/search',[\n 'jquery'\n], function ($) {\n function Search () { }\n\n Search.prototype.render = function (decorated) {\n var $rendered = decorated.call(this);\n var searchLabel = this.options.get('translations').get('search');\n\n var $search = $(\n '<span class=\"select2-search select2-search--dropdown\">' +\n '<input class=\"select2-search__field\" type=\"search\" tabindex=\"-1\"' +\n ' autocorrect=\"off\" autocapitalize=\"none\"' +\n ' spellcheck=\"false\" role=\"searchbox\" aria-autocomplete=\"list\" />' +\n '</span>'\n );\n\n this.$searchContainer = $search;\n this.$search = $search.find('input');\n\n this.$search.prop('autocomplete', this.options.get('autocomplete'));\n this.$search.attr('aria-label', searchLabel());\n\n $rendered.prepend($search);\n\n return $rendered;\n };\n\n Search.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n var resultsId = container.id + '-results';\n\n decorated.call(this, container, $container);\n\n this.$search.on('keydown', function (evt) {\n self.trigger('keypress', evt);\n\n self._keyUpPrevented = evt.isDefaultPrevented();\n });\n\n // Workaround for browsers which do not support the `input` event\n // This will prevent double-triggering of events for browsers which support\n // both the `keyup` and `input` events.\n this.$search.on('input', function (evt) {\n // Unbind the duplicated `keyup` event\n $(this).off('keyup');\n });\n\n this.$search.on('keyup input', function (evt) {\n self.handleSearch(evt);\n });\n\n container.on('open', function () {\n self.$search.attr('tabindex', 0);\n self.$search.attr('aria-controls', resultsId);\n\n self.$search.trigger('focus');\n\n window.setTimeout(function () {\n self.$search.trigger('focus');\n }, 0);\n });\n\n container.on('close', function () {\n self.$search.attr('tabindex', -1);\n self.$search.removeAttr('aria-controls');\n self.$search.removeAttr('aria-activedescendant');\n\n self.$search.val('');\n self.$search.trigger('blur');\n });\n\n container.on('focus', function () {\n if (!container.isOpen()) {\n self.$search.trigger('focus');\n }\n });\n\n container.on('results:all', function (params) {\n if (params.query.term == null || params.query.term === '') {\n var showSearch = self.showSearch(params);\n\n if (showSearch) {\n self.$searchContainer[0].classList.remove('select2-search--hide');\n } else {\n self.$searchContainer[0].classList.add('select2-search--hide');\n }\n }\n });\n\n container.on('results:focus', function (params) {\n if (params.data._resultId) {\n self.$search.attr('aria-activedescendant', params.data._resultId);\n } else {\n self.$search.removeAttr('aria-activedescendant');\n }\n });\n };\n\n Search.prototype.handleSearch = function (evt) {\n if (!this._keyUpPrevented) {\n var input = this.$search.val();\n\n this.trigger('query', {\n term: input\n });\n }\n\n this._keyUpPrevented = false;\n };\n\n Search.prototype.showSearch = function (_, params) {\n return true;\n };\n\n return Search;\n});\n\nS2.define('select2/dropdown/hidePlaceholder',[\n\n], function () {\n function HidePlaceholder (decorated, $element, options, dataAdapter) {\n this.placeholder = this.normalizePlaceholder(options.get('placeholder'));\n\n decorated.call(this, $element, options, dataAdapter);\n }\n\n HidePlaceholder.prototype.append = function (decorated, data) {\n data.results = this.removePlaceholder(data.results);\n\n decorated.call(this, data);\n };\n\n HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {\n if (typeof placeholder === 'string') {\n placeholder = {\n id: '',\n text: placeholder\n };\n }\n\n return placeholder;\n };\n\n HidePlaceholder.prototype.removePlaceholder = function (_, data) {\n var modifiedData = data.slice(0);\n\n for (var d = data.length - 1; d >= 0; d--) {\n var item = data[d];\n\n if (this.placeholder.id === item.id) {\n modifiedData.splice(d, 1);\n }\n }\n\n return modifiedData;\n };\n\n return HidePlaceholder;\n});\n\nS2.define('select2/dropdown/infiniteScroll',[\n 'jquery'\n], function ($) {\n function InfiniteScroll (decorated, $element, options, dataAdapter) {\n this.lastParams = {};\n\n decorated.call(this, $element, options, dataAdapter);\n\n this.$loadingMore = this.createLoadingMore();\n this.loading = false;\n }\n\n InfiniteScroll.prototype.append = function (decorated, data) {\n this.$loadingMore.remove();\n this.loading = false;\n\n decorated.call(this, data);\n\n if (this.showLoadingMore(data)) {\n this.$results.append(this.$loadingMore);\n this.loadMoreIfNeeded();\n }\n };\n\n InfiniteScroll.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('query', function (params) {\n self.lastParams = params;\n self.loading = true;\n });\n\n container.on('query:append', function (params) {\n self.lastParams = params;\n self.loading = true;\n });\n\n this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));\n };\n\n InfiniteScroll.prototype.loadMoreIfNeeded = function () {\n var isLoadMoreVisible = $.contains(\n document.documentElement,\n this.$loadingMore[0]\n );\n\n if (this.loading || !isLoadMoreVisible) {\n return;\n }\n\n var currentOffset = this.$results.offset().top +\n this.$results.outerHeight(false);\n var loadingMoreOffset = this.$loadingMore.offset().top +\n this.$loadingMore.outerHeight(false);\n\n if (currentOffset + 50 >= loadingMoreOffset) {\n this.loadMore();\n }\n };\n\n InfiniteScroll.prototype.loadMore = function () {\n this.loading = true;\n\n var params = $.extend({}, {page: 1}, this.lastParams);\n\n params.page++;\n\n this.trigger('query:append', params);\n };\n\n InfiniteScroll.prototype.showLoadingMore = function (_, data) {\n return data.pagination && data.pagination.more;\n };\n\n InfiniteScroll.prototype.createLoadingMore = function () {\n var $option = $(\n '<li ' +\n 'class=\"select2-results__option select2-results__option--load-more\"' +\n 'role=\"option\" aria-disabled=\"true\"></li>'\n );\n\n var message = this.options.get('translations').get('loadingMore');\n\n $option.html(message(this.lastParams));\n\n return $option;\n };\n\n return InfiniteScroll;\n});\n\nS2.define('select2/dropdown/attachBody',[\n 'jquery',\n '../utils'\n], function ($, Utils) {\n function AttachBody (decorated, $element, options) {\n this.$dropdownParent = $(options.get('dropdownParent') || document.body);\n\n decorated.call(this, $element, options);\n }\n\n AttachBody.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('open', function () {\n self._showDropdown();\n self._attachPositioningHandler(container);\n\n // Must bind after the results handlers to ensure correct sizing\n self._bindContainerResultHandlers(container);\n });\n\n container.on('close', function () {\n self._hideDropdown();\n self._detachPositioningHandler(container);\n });\n\n this.$dropdownContainer.on('mousedown', function (evt) {\n evt.stopPropagation();\n });\n };\n\n AttachBody.prototype.destroy = function (decorated) {\n decorated.call(this);\n\n this.$dropdownContainer.remove();\n };\n\n AttachBody.prototype.position = function (decorated, $dropdown, $container) {\n // Clone all of the container classes\n $dropdown.attr('class', $container.attr('class'));\n\n $dropdown[0].classList.remove('select2');\n $dropdown[0].classList.add('select2-container--open');\n\n $dropdown.css({\n position: 'absolute',\n top: -999999\n });\n\n this.$container = $container;\n };\n\n AttachBody.prototype.render = function (decorated) {\n var $container = $('<span></span>');\n\n var $dropdown = decorated.call(this);\n $container.append($dropdown);\n\n this.$dropdownContainer = $container;\n\n return $container;\n };\n\n AttachBody.prototype._hideDropdown = function (decorated) {\n this.$dropdownContainer.detach();\n };\n\n AttachBody.prototype._bindContainerResultHandlers =\n function (decorated, container) {\n\n // These should only be bound once\n if (this._containerResultsHandlersBound) {\n return;\n }\n\n var self = this;\n\n container.on('results:all', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('results:append', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('results:message', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('select', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n container.on('unselect', function () {\n self._positionDropdown();\n self._resizeDropdown();\n });\n\n this._containerResultsHandlersBound = true;\n };\n\n AttachBody.prototype._attachPositioningHandler =\n function (decorated, container) {\n var self = this;\n\n var scrollEvent = 'scroll.select2.' + container.id;\n var resizeEvent = 'resize.select2.' + container.id;\n var orientationEvent = 'orientationchange.select2.' + container.id;\n\n var $watchers = this.$container.parents().filter(Utils.hasScroll);\n $watchers.each(function () {\n Utils.StoreData(this, 'select2-scroll-position', {\n x: $(this).scrollLeft(),\n y: $(this).scrollTop()\n });\n });\n\n $watchers.on(scrollEvent, function (ev) {\n var position = Utils.GetData(this, 'select2-scroll-position');\n $(this).scrollTop(position.y);\n });\n\n $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,\n function (e) {\n self._positionDropdown();\n self._resizeDropdown();\n });\n };\n\n AttachBody.prototype._detachPositioningHandler =\n function (decorated, container) {\n var scrollEvent = 'scroll.select2.' + container.id;\n var resizeEvent = 'resize.select2.' + container.id;\n var orientationEvent = 'orientationchange.select2.' + container.id;\n\n var $watchers = this.$container.parents().filter(Utils.hasScroll);\n $watchers.off(scrollEvent);\n\n $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);\n };\n\n AttachBody.prototype._positionDropdown = function () {\n var $window = $(window);\n\n var isCurrentlyAbove = this.$dropdown[0].classList\n .contains('select2-dropdown--above');\n var isCurrentlyBelow = this.$dropdown[0].classList\n .contains('select2-dropdown--below');\n\n var newDirection = null;\n\n var offset = this.$container.offset();\n\n offset.bottom = offset.top + this.$container.outerHeight(false);\n\n var container = {\n height: this.$container.outerHeight(false)\n };\n\n container.top = offset.top;\n container.bottom = offset.top + container.height;\n\n var dropdown = {\n height: this.$dropdown.outerHeight(false)\n };\n\n var viewport = {\n top: $window.scrollTop(),\n bottom: $window.scrollTop() + $window.height()\n };\n\n var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);\n var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);\n\n var css = {\n left: offset.left,\n top: container.bottom\n };\n\n // Determine what the parent element is to use for calculating the offset\n var $offsetParent = this.$dropdownParent;\n\n // For statically positioned elements, we need to get the element\n // that is determining the offset\n if ($offsetParent.css('position') === 'static') {\n $offsetParent = $offsetParent.offsetParent();\n }\n\n var parentOffset = {\n top: 0,\n left: 0\n };\n\n if (\n $.contains(document.body, $offsetParent[0]) ||\n $offsetParent[0].isConnected\n ) {\n parentOffset = $offsetParent.offset();\n }\n\n css.top -= parentOffset.top;\n css.left -= parentOffset.left;\n\n if (!isCurrentlyAbove && !isCurrentlyBelow) {\n newDirection = 'below';\n }\n\n if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {\n newDirection = 'above';\n } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {\n newDirection = 'below';\n }\n\n if (newDirection == 'above' ||\n (isCurrentlyAbove && newDirection !== 'below')) {\n css.top = container.top - parentOffset.top - dropdown.height;\n }\n\n if (newDirection != null) {\n this.$dropdown[0].classList.remove('select2-dropdown--below');\n this.$dropdown[0].classList.remove('select2-dropdown--above');\n this.$dropdown[0].classList.add('select2-dropdown--' + newDirection);\n\n this.$container[0].classList.remove('select2-container--below');\n this.$container[0].classList.remove('select2-container--above');\n this.$container[0].classList.add('select2-container--' + newDirection);\n }\n\n this.$dropdownContainer.css(css);\n };\n\n AttachBody.prototype._resizeDropdown = function () {\n var css = {\n width: this.$container.outerWidth(false) + 'px'\n };\n\n if (this.options.get('dropdownAutoWidth')) {\n css.minWidth = css.width;\n css.position = 'relative';\n css.width = 'auto';\n }\n\n this.$dropdown.css(css);\n };\n\n AttachBody.prototype._showDropdown = function (decorated) {\n this.$dropdownContainer.appendTo(this.$dropdownParent);\n\n this._positionDropdown();\n this._resizeDropdown();\n };\n\n return AttachBody;\n});\n\nS2.define('select2/dropdown/minimumResultsForSearch',[\n\n], function () {\n function countResults (data) {\n var count = 0;\n\n for (var d = 0; d < data.length; d++) {\n var item = data[d];\n\n if (item.children) {\n count += countResults(item.children);\n } else {\n count++;\n }\n }\n\n return count;\n }\n\n function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {\n this.minimumResultsForSearch = options.get('minimumResultsForSearch');\n\n if (this.minimumResultsForSearch < 0) {\n this.minimumResultsForSearch = Infinity;\n }\n\n decorated.call(this, $element, options, dataAdapter);\n }\n\n MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {\n if (countResults(params.data.results) < this.minimumResultsForSearch) {\n return false;\n }\n\n return decorated.call(this, params);\n };\n\n return MinimumResultsForSearch;\n});\n\nS2.define('select2/dropdown/selectOnClose',[\n '../utils'\n], function (Utils) {\n function SelectOnClose () { }\n\n SelectOnClose.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('close', function (params) {\n self._handleSelectOnClose(params);\n });\n };\n\n SelectOnClose.prototype._handleSelectOnClose = function (_, params) {\n if (params && params.originalSelect2Event != null) {\n var event = params.originalSelect2Event;\n\n // Don't select an item if the close event was triggered from a select or\n // unselect event\n if (event._type === 'select' || event._type === 'unselect') {\n return;\n }\n }\n\n var $highlightedResults = this.getHighlightedResults();\n\n // Only select highlighted results\n if ($highlightedResults.length < 1) {\n return;\n }\n\n var data = Utils.GetData($highlightedResults[0], 'data');\n\n // Don't re-select already selected resulte\n if (\n (data.element != null && data.element.selected) ||\n (data.element == null && data.selected)\n ) {\n return;\n }\n\n this.trigger('select', {\n data: data\n });\n };\n\n return SelectOnClose;\n});\n\nS2.define('select2/dropdown/closeOnSelect',[\n\n], function () {\n function CloseOnSelect () { }\n\n CloseOnSelect.prototype.bind = function (decorated, container, $container) {\n var self = this;\n\n decorated.call(this, container, $container);\n\n container.on('select', function (evt) {\n self._selectTriggered(evt);\n });\n\n container.on('unselect', function (evt) {\n self._selectTriggered(evt);\n });\n };\n\n CloseOnSelect.prototype._selectTriggered = function (_, evt) {\n var originalEvent = evt.originalEvent;\n\n // Don't close if the control key is being held\n if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {\n return;\n }\n\n this.trigger('close', {\n originalEvent: originalEvent,\n originalSelect2Event: evt\n });\n };\n\n return CloseOnSelect;\n});\n\nS2.define('select2/dropdown/dropdownCss',[\n '../utils'\n], function (Utils) {\n function DropdownCSS () { }\n\n DropdownCSS.prototype.render = function (decorated) {\n var $dropdown = decorated.call(this);\n\n var dropdownCssClass = this.options.get('dropdownCssClass') || '';\n\n if (dropdownCssClass.indexOf(':all:') !== -1) {\n dropdownCssClass = dropdownCssClass.replace(':all:', '');\n\n Utils.copyNonInternalCssClasses($dropdown[0], this.$element[0]);\n }\n\n $dropdown.addClass(dropdownCssClass);\n\n return $dropdown;\n };\n\n return DropdownCSS;\n});\n\nS2.define('select2/dropdown/tagsSearchHighlight',[\n '../utils'\n], function (Utils) {\n function TagsSearchHighlight () { }\n\n TagsSearchHighlight.prototype.highlightFirstItem = function (decorated) {\n var $options = this.$results\n .find(\n '.select2-results__option--selectable' +\n ':not(.select2-results__option--selected)'\n );\n\n if ($options.length > 0) {\n var $firstOption = $options.first();\n var data = Utils.GetData($firstOption[0], 'data');\n var firstElement = data.element;\n\n if (firstElement && firstElement.getAttribute) {\n if (firstElement.getAttribute('data-select2-tag') === 'true') {\n $firstOption.trigger('mouseenter');\n\n return;\n }\n }\n }\n\n decorated.call(this);\n };\n\n return TagsSearchHighlight;\n});\n\nS2.define('select2/i18n/en',[],function () {\n // English\n return {\n errorLoading: function () {\n return 'The results could not be loaded.';\n },\n inputTooLong: function (args) {\n var overChars = args.input.length - args.maximum;\n\n var message = 'Please delete ' + overChars + ' character';\n\n if (overChars != 1) {\n message += 's';\n }\n\n return message;\n },\n inputTooShort: function (args) {\n var remainingChars = args.minimum - args.input.length;\n\n var message = 'Please enter ' + remainingChars + ' or more characters';\n\n return message;\n },\n loadingMore: function () {\n return 'Loading more results…';\n },\n maximumSelected: function (args) {\n var message = 'You can only select ' + args.maximum + ' item';\n\n if (args.maximum != 1) {\n message += 's';\n }\n\n return message;\n },\n noResults: function () {\n return 'No results found';\n },\n searching: function () {\n return 'Searching…';\n },\n removeAllItems: function () {\n return 'Remove all items';\n },\n removeItem: function () {\n return 'Remove item';\n },\n search: function() {\n return 'Search';\n }\n };\n});\n\nS2.define('select2/defaults',[\n 'jquery',\n\n './results',\n\n './selection/single',\n './selection/multiple',\n './selection/placeholder',\n './selection/allowClear',\n './selection/search',\n './selection/selectionCss',\n './selection/eventRelay',\n\n './utils',\n './translation',\n './diacritics',\n\n './data/select',\n './data/array',\n './data/ajax',\n './data/tags',\n './data/tokenizer',\n './data/minimumInputLength',\n './data/maximumInputLength',\n './data/maximumSelectionLength',\n\n './dropdown',\n './dropdown/search',\n './dropdown/hidePlaceholder',\n './dropdown/infiniteScroll',\n './dropdown/attachBody',\n './dropdown/minimumResultsForSearch',\n './dropdown/selectOnClose',\n './dropdown/closeOnSelect',\n './dropdown/dropdownCss',\n './dropdown/tagsSearchHighlight',\n\n './i18n/en'\n], function ($,\n\n ResultsList,\n\n SingleSelection, MultipleSelection, Placeholder, AllowClear,\n SelectionSearch, SelectionCSS, EventRelay,\n\n Utils, Translation, DIACRITICS,\n\n SelectData, ArrayData, AjaxData, Tags, Tokenizer,\n MinimumInputLength, MaximumInputLength, MaximumSelectionLength,\n\n Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,\n AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,\n DropdownCSS, TagsSearchHighlight,\n\n EnglishTranslation) {\n function Defaults () {\n this.reset();\n }\n\n Defaults.prototype.apply = function (options) {\n options = $.extend(true, {}, this.defaults, options);\n\n if (options.dataAdapter == null) {\n if (options.ajax != null) {\n options.dataAdapter = AjaxData;\n } else if (options.data != null) {\n options.dataAdapter = ArrayData;\n } else {\n options.dataAdapter = SelectData;\n }\n\n if (options.minimumInputLength > 0) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n MinimumInputLength\n );\n }\n\n if (options.maximumInputLength > 0) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n MaximumInputLength\n );\n }\n\n if (options.maximumSelectionLength > 0) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n MaximumSelectionLength\n );\n }\n\n if (options.tags) {\n options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);\n }\n\n if (options.tokenSeparators != null || options.tokenizer != null) {\n options.dataAdapter = Utils.Decorate(\n options.dataAdapter,\n Tokenizer\n );\n }\n }\n\n if (options.resultsAdapter == null) {\n options.resultsAdapter = ResultsList;\n\n if (options.ajax != null) {\n options.resultsAdapter = Utils.Decorate(\n options.resultsAdapter,\n InfiniteScroll\n );\n }\n\n if (options.placeholder != null) {\n options.resultsAdapter = Utils.Decorate(\n options.resultsAdapter,\n HidePlaceholder\n );\n }\n\n if (options.selectOnClose) {\n options.resultsAdapter = Utils.Decorate(\n options.resultsAdapter,\n SelectOnClose\n );\n }\n\n if (options.tags) {\n options.resultsAdapter = Utils.Decorate(\n options.resultsAdapter,\n TagsSearchHighlight\n );\n }\n }\n\n if (options.dropdownAdapter == null) {\n if (options.multiple) {\n options.dropdownAdapter = Dropdown;\n } else {\n var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);\n\n options.dropdownAdapter = SearchableDropdown;\n }\n\n if (options.minimumResultsForSearch !== 0) {\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n MinimumResultsForSearch\n );\n }\n\n if (options.closeOnSelect) {\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n CloseOnSelect\n );\n }\n\n if (options.dropdownCssClass != null) {\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n DropdownCSS\n );\n }\n\n options.dropdownAdapter = Utils.Decorate(\n options.dropdownAdapter,\n AttachBody\n );\n }\n\n if (options.selectionAdapter == null) {\n if (options.multiple) {\n options.selectionAdapter = MultipleSelection;\n } else {\n options.selectionAdapter = SingleSelection;\n }\n\n // Add the placeholder mixin if a placeholder was specified\n if (options.placeholder != null) {\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n Placeholder\n );\n }\n\n if (options.allowClear) {\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n AllowClear\n );\n }\n\n if (options.multiple) {\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n SelectionSearch\n );\n }\n\n if (options.selectionCssClass != null) {\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n SelectionCSS\n );\n }\n\n options.selectionAdapter = Utils.Decorate(\n options.selectionAdapter,\n EventRelay\n );\n }\n\n // If the defaults were not previously applied from an element, it is\n // possible for the language option to have not been resolved\n options.language = this._resolveLanguage(options.language);\n\n // Always fall back to English since it will always be complete\n options.language.push('en');\n\n var uniqueLanguages = [];\n\n for (var l = 0; l < options.language.length; l++) {\n var language = options.language[l];\n\n if (uniqueLanguages.indexOf(language) === -1) {\n uniqueLanguages.push(language);\n }\n }\n\n options.language = uniqueLanguages;\n\n options.translations = this._processTranslations(\n options.language,\n options.debug\n );\n\n return options;\n };\n\n Defaults.prototype.reset = function () {\n function stripDiacritics (text) {\n // Used 'uni range + named function' from http://jsperf.com/diacritics/18\n function match(a) {\n return DIACRITICS[a] || a;\n }\n\n return text.replace(/[^\\u0000-\\u007E]/g, match);\n }\n\n function matcher (params, data) {\n // Always return the object if there is nothing to compare\n if (params.term == null || params.term.trim() === '') {\n return data;\n }\n\n // Do a recursive check for options with children\n if (data.children && data.children.length > 0) {\n // Clone the data object if there are children\n // This is required as we modify the object to remove any non-matches\n var match = $.extend(true, {}, data);\n\n // Check each child of the option\n for (var c = data.children.length - 1; c >= 0; c--) {\n var child = data.children[c];\n\n var matches = matcher(params, child);\n\n // If there wasn't a match, remove the object in the array\n if (matches == null) {\n match.children.splice(c, 1);\n }\n }\n\n // If any children matched, return the new object\n if (match.children.length > 0) {\n return match;\n }\n\n // If there were no matching children, check just the plain object\n return matcher(params, match);\n }\n\n var original = stripDiacritics(data.text).toUpperCase();\n var term = stripDiacritics(params.term).toUpperCase();\n\n // Check if the text contains the term\n if (original.indexOf(term) > -1) {\n return data;\n }\n\n // If it doesn't contain the term, don't return anything\n return null;\n }\n\n this.defaults = {\n amdLanguageBase: './i18n/',\n autocomplete: 'off',\n closeOnSelect: true,\n debug: false,\n dropdownAutoWidth: false,\n escapeMarkup: Utils.escapeMarkup,\n language: {},\n matcher: matcher,\n minimumInputLength: 0,\n maximumInputLength: 0,\n maximumSelectionLength: 0,\n minimumResultsForSearch: 0,\n selectOnClose: false,\n scrollAfterSelect: false,\n sorter: function (data) {\n return data;\n },\n templateResult: function (result) {\n return result.text;\n },\n templateSelection: function (selection) {\n return selection.text;\n },\n theme: 'default',\n width: 'resolve'\n };\n };\n\n Defaults.prototype.applyFromElement = function (options, $element) {\n var optionLanguage = options.language;\n var defaultLanguage = this.defaults.language;\n var elementLanguage = $element.prop('lang');\n var parentLanguage = $element.closest('[lang]').prop('lang');\n\n var languages = Array.prototype.concat.call(\n this._resolveLanguage(elementLanguage),\n this._resolveLanguage(optionLanguage),\n this._resolveLanguage(defaultLanguage),\n this._resolveLanguage(parentLanguage)\n );\n\n options.language = languages;\n\n return options;\n };\n\n Defaults.prototype._resolveLanguage = function (language) {\n if (!language) {\n return [];\n }\n\n if ($.isEmptyObject(language)) {\n return [];\n }\n\n if ($.isPlainObject(language)) {\n return [language];\n }\n\n var languages;\n\n if (!Array.isArray(language)) {\n languages = [language];\n } else {\n languages = language;\n }\n\n var resolvedLanguages = [];\n\n for (var l = 0; l < languages.length; l++) {\n resolvedLanguages.push(languages[l]);\n\n if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {\n // Extract the region information if it is included\n var languageParts = languages[l].split('-');\n var baseLanguage = languageParts[0];\n\n resolvedLanguages.push(baseLanguage);\n }\n }\n\n return resolvedLanguages;\n };\n\n Defaults.prototype._processTranslations = function (languages, debug) {\n var translations = new Translation();\n\n for (var l = 0; l < languages.length; l++) {\n var languageData = new Translation();\n\n var language = languages[l];\n\n if (typeof language === 'string') {\n try {\n // Try to load it with the original name\n languageData = Translation.loadPath(language);\n } catch (e) {\n try {\n // If we couldn't load it, check if it wasn't the full path\n language = this.defaults.amdLanguageBase + language;\n languageData = Translation.loadPath(language);\n } catch (ex) {\n // The translation could not be loaded at all. Sometimes this is\n // because of a configuration problem, other times this can be\n // because of how Select2 helps load all possible translation files\n if (debug && window.console && console.warn) {\n console.warn(\n 'Select2: The language file for \"' + language + '\" could ' +\n 'not be automatically loaded. A fallback will be used instead.'\n );\n }\n }\n }\n } else if ($.isPlainObject(language)) {\n languageData = new Translation(language);\n } else {\n languageData = language;\n }\n\n translations.extend(languageData);\n }\n\n return translations;\n };\n\n Defaults.prototype.set = function (key, value) {\n var camelKey = $.camelCase(key);\n\n var data = {};\n data[camelKey] = value;\n\n var convertedData = Utils._convertData(data);\n\n $.extend(true, this.defaults, convertedData);\n };\n\n var defaults = new Defaults();\n\n return defaults;\n});\n\nS2.define('select2/options',[\n 'jquery',\n './defaults',\n './utils'\n], function ($, Defaults, Utils) {\n function Options (options, $element) {\n this.options = options;\n\n if ($element != null) {\n this.fromElement($element);\n }\n\n if ($element != null) {\n this.options = Defaults.applyFromElement(this.options, $element);\n }\n\n this.options = Defaults.apply(this.options);\n }\n\n Options.prototype.fromElement = function ($e) {\n var excludedData = ['select2'];\n\n if (this.options.multiple == null) {\n this.options.multiple = $e.prop('multiple');\n }\n\n if (this.options.disabled == null) {\n this.options.disabled = $e.prop('disabled');\n }\n\n if (this.options.autocomplete == null && $e.prop('autocomplete')) {\n this.options.autocomplete = $e.prop('autocomplete');\n }\n\n if (this.options.dir == null) {\n if ($e.prop('dir')) {\n this.options.dir = $e.prop('dir');\n } else if ($e.closest('[dir]').prop('dir')) {\n this.options.dir = $e.closest('[dir]').prop('dir');\n } else {\n this.options.dir = 'ltr';\n }\n }\n\n $e.prop('disabled', this.options.disabled);\n $e.prop('multiple', this.options.multiple);\n\n if (Utils.GetData($e[0], 'select2Tags')) {\n if (this.options.debug && window.console && console.warn) {\n console.warn(\n 'Select2: The `data-select2-tags` attribute has been changed to ' +\n 'use the `data-data` and `data-tags=\"true\"` attributes and will be ' +\n 'removed in future versions of Select2.'\n );\n }\n\n Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));\n Utils.StoreData($e[0], 'tags', true);\n }\n\n if (Utils.GetData($e[0], 'ajaxUrl')) {\n if (this.options.debug && window.console && console.warn) {\n console.warn(\n 'Select2: The `data-ajax-url` attribute has been changed to ' +\n '`data-ajax--url` and support for the old attribute will be removed' +\n ' in future versions of Select2.'\n );\n }\n\n $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));\n Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));\n }\n\n var dataset = {};\n\n function upperCaseLetter(_, letter) {\n return letter.toUpperCase();\n }\n\n // Pre-load all of the attributes which are prefixed with `data-`\n for (var attr = 0; attr < $e[0].attributes.length; attr++) {\n var attributeName = $e[0].attributes[attr].name;\n var prefix = 'data-';\n\n if (attributeName.substr(0, prefix.length) == prefix) {\n // Get the contents of the attribute after `data-`\n var dataName = attributeName.substring(prefix.length);\n\n // Get the data contents from the consistent source\n // This is more than likely the jQuery data helper\n var dataValue = Utils.GetData($e[0], dataName);\n\n // camelCase the attribute name to match the spec\n var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);\n\n // Store the data attribute contents into the dataset since\n dataset[camelDataName] = dataValue;\n }\n }\n\n // Prefer the element's `dataset` attribute if it exists\n // jQuery 1.x does not correctly handle data attributes with multiple dashes\n if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {\n dataset = $.extend(true, {}, $e[0].dataset, dataset);\n }\n\n // Prefer our internal data cache if it exists\n var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);\n\n data = Utils._convertData(data);\n\n for (var key in data) {\n if (excludedData.indexOf(key) > -1) {\n continue;\n }\n\n if ($.isPlainObject(this.options[key])) {\n $.extend(this.options[key], data[key]);\n } else {\n this.options[key] = data[key];\n }\n }\n\n return this;\n };\n\n Options.prototype.get = function (key) {\n return this.options[key];\n };\n\n Options.prototype.set = function (key, val) {\n this.options[key] = val;\n };\n\n return Options;\n});\n\nS2.define('select2/core',[\n 'jquery',\n './options',\n './utils',\n './keys'\n], function ($, Options, Utils, KEYS) {\n var Select2 = function ($element, options) {\n if (Utils.GetData($element[0], 'select2') != null) {\n Utils.GetData($element[0], 'select2').destroy();\n }\n\n this.$element = $element;\n\n this.id = this._generateId($element);\n\n options = options || {};\n\n this.options = new Options(options, $element);\n\n Select2.__super__.constructor.call(this);\n\n // Set up the tabindex\n\n var tabindex = $element.attr('tabindex') || 0;\n Utils.StoreData($element[0], 'old-tabindex', tabindex);\n $element.attr('tabindex', '-1');\n\n // Set up containers and adapters\n\n var DataAdapter = this.options.get('dataAdapter');\n this.dataAdapter = new DataAdapter($element, this.options);\n\n var $container = this.render();\n\n this._placeContainer($container);\n\n var SelectionAdapter = this.options.get('selectionAdapter');\n this.selection = new SelectionAdapter($element, this.options);\n this.$selection = this.selection.render();\n\n this.selection.position(this.$selection, $container);\n\n var DropdownAdapter = this.options.get('dropdownAdapter');\n this.dropdown = new DropdownAdapter($element, this.options);\n this.$dropdown = this.dropdown.render();\n\n this.dropdown.position(this.$dropdown, $container);\n\n var ResultsAdapter = this.options.get('resultsAdapter');\n this.results = new ResultsAdapter($element, this.options, this.dataAdapter);\n this.$results = this.results.render();\n\n this.results.position(this.$results, this.$dropdown);\n\n // Bind events\n\n var self = this;\n\n // Bind the container to all of the adapters\n this._bindAdapters();\n\n // Register any DOM event handlers\n this._registerDomEvents();\n\n // Register any internal event handlers\n this._registerDataEvents();\n this._registerSelectionEvents();\n this._registerDropdownEvents();\n this._registerResultsEvents();\n this._registerEvents();\n\n // Set the initial state\n this.dataAdapter.current(function (initialData) {\n self.trigger('selection:update', {\n data: initialData\n });\n });\n\n // Hide the original select\n $element[0].classList.add('select2-hidden-accessible');\n $element.attr('aria-hidden', 'true');\n\n // Synchronize any monitored attributes\n this._syncAttributes();\n\n Utils.StoreData($element[0], 'select2', this);\n\n // Ensure backwards compatibility with $element.data('select2').\n $element.data('select2', this);\n };\n\n Utils.Extend(Select2, Utils.Observable);\n\n Select2.prototype._generateId = function ($element) {\n var id = '';\n\n if ($element.attr('id') != null) {\n id = $element.attr('id');\n } else if ($element.attr('name') != null) {\n id = $element.attr('name') + '-' + Utils.generateChars(2);\n } else {\n id = Utils.generateChars(4);\n }\n\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = 'select2-' + id;\n\n return id;\n };\n\n Select2.prototype._placeContainer = function ($container) {\n $container.insertAfter(this.$element);\n\n var width = this._resolveWidth(this.$element, this.options.get('width'));\n\n if (width != null) {\n $container.css('width', width);\n }\n };\n\n Select2.prototype._resolveWidth = function ($element, method) {\n var WIDTH = /^width:(([-+]?([0-9]*\\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;\n\n if (method == 'resolve') {\n var styleWidth = this._resolveWidth($element, 'style');\n\n if (styleWidth != null) {\n return styleWidth;\n }\n\n return this._resolveWidth($element, 'element');\n }\n\n if (method == 'element') {\n var elementWidth = $element.outerWidth(false);\n\n if (elementWidth <= 0) {\n return 'auto';\n }\n\n return elementWidth + 'px';\n }\n\n if (method == 'style') {\n var style = $element.attr('style');\n\n if (typeof(style) !== 'string') {\n return null;\n }\n\n var attrs = style.split(';');\n\n for (var i = 0, l = attrs.length; i < l; i = i + 1) {\n var attr = attrs[i].replace(/\\s/g, '');\n var matches = attr.match(WIDTH);\n\n if (matches !== null && matches.length >= 1) {\n return matches[1];\n }\n }\n\n return null;\n }\n\n if (method == 'computedstyle') {\n var computedStyle = window.getComputedStyle($element[0]);\n\n return computedStyle.width;\n }\n\n return method;\n };\n\n Select2.prototype._bindAdapters = function () {\n this.dataAdapter.bind(this, this.$container);\n this.selection.bind(this, this.$container);\n\n this.dropdown.bind(this, this.$container);\n this.results.bind(this, this.$container);\n };\n\n Select2.prototype._registerDomEvents = function () {\n var self = this;\n\n this.$element.on('change.select2', function () {\n self.dataAdapter.current(function (data) {\n self.trigger('selection:update', {\n data: data\n });\n });\n });\n\n this.$element.on('focus.select2', function (evt) {\n self.trigger('focus', evt);\n });\n\n this._syncA = Utils.bind(this._syncAttributes, this);\n this._syncS = Utils.bind(this._syncSubtree, this);\n\n this._observer = new window.MutationObserver(function (mutations) {\n self._syncA();\n self._syncS(mutations);\n });\n this._observer.observe(this.$element[0], {\n attributes: true,\n childList: true,\n subtree: false\n });\n };\n\n Select2.prototype._registerDataEvents = function () {\n var self = this;\n\n this.dataAdapter.on('*', function (name, params) {\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerSelectionEvents = function () {\n var self = this;\n var nonRelayEvents = ['toggle', 'focus'];\n\n this.selection.on('toggle', function () {\n self.toggleDropdown();\n });\n\n this.selection.on('focus', function (params) {\n self.focus(params);\n });\n\n this.selection.on('*', function (name, params) {\n if (nonRelayEvents.indexOf(name) !== -1) {\n return;\n }\n\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerDropdownEvents = function () {\n var self = this;\n\n this.dropdown.on('*', function (name, params) {\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerResultsEvents = function () {\n var self = this;\n\n this.results.on('*', function (name, params) {\n self.trigger(name, params);\n });\n };\n\n Select2.prototype._registerEvents = function () {\n var self = this;\n\n this.on('open', function () {\n self.$container[0].classList.add('select2-container--open');\n });\n\n this.on('close', function () {\n self.$container[0].classList.remove('select2-container--open');\n });\n\n this.on('enable', function () {\n self.$container[0].classList.remove('select2-container--disabled');\n });\n\n this.on('disable', function () {\n self.$container[0].classList.add('select2-container--disabled');\n });\n\n this.on('blur', function () {\n self.$container[0].classList.remove('select2-container--focus');\n });\n\n this.on('query', function (params) {\n if (!self.isOpen()) {\n self.trigger('open', {});\n }\n\n this.dataAdapter.query(params, function (data) {\n self.trigger('results:all', {\n data: data,\n query: params\n });\n });\n });\n\n this.on('query:append', function (params) {\n this.dataAdapter.query(params, function (data) {\n self.trigger('results:append', {\n data: data,\n query: params\n });\n });\n });\n\n this.on('keypress', function (evt) {\n var key = evt.which;\n\n if (self.isOpen()) {\n if (key === KEYS.ESC || (key === KEYS.UP && evt.altKey)) {\n self.close(evt);\n\n evt.preventDefault();\n } else if (key === KEYS.ENTER || key === KEYS.TAB) {\n self.trigger('results:select', {});\n\n evt.preventDefault();\n } else if ((key === KEYS.SPACE && evt.ctrlKey)) {\n self.trigger('results:toggle', {});\n\n evt.preventDefault();\n } else if (key === KEYS.UP) {\n self.trigger('results:previous', {});\n\n evt.preventDefault();\n } else if (key === KEYS.DOWN) {\n self.trigger('results:next', {});\n\n evt.preventDefault();\n }\n } else {\n if (key === KEYS.ENTER || key === KEYS.SPACE ||\n (key === KEYS.DOWN && evt.altKey)) {\n self.open();\n\n evt.preventDefault();\n }\n }\n });\n };\n\n Select2.prototype._syncAttributes = function () {\n this.options.set('disabled', this.$element.prop('disabled'));\n\n if (this.isDisabled()) {\n if (this.isOpen()) {\n this.close();\n }\n\n this.trigger('disable', {});\n } else {\n this.trigger('enable', {});\n }\n };\n\n Select2.prototype._isChangeMutation = function (mutations) {\n var self = this;\n\n if (mutations.addedNodes && mutations.addedNodes.length > 0) {\n for (var n = 0; n < mutations.addedNodes.length; n++) {\n var node = mutations.addedNodes[n];\n\n if (node.selected) {\n return true;\n }\n }\n } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {\n return true;\n } else if (Array.isArray(mutations)) {\n return mutations.some(function (mutation) {\n return self._isChangeMutation(mutation);\n });\n }\n\n return false;\n };\n\n Select2.prototype._syncSubtree = function (mutations) {\n var changed = this._isChangeMutation(mutations);\n var self = this;\n\n // Only re-pull the data if we think there is a change\n if (changed) {\n this.dataAdapter.current(function (currentData) {\n self.trigger('selection:update', {\n data: currentData\n });\n });\n }\n };\n\n /**\n * Override the trigger method to automatically trigger pre-events when\n * there are events that can be prevented.\n */\n Select2.prototype.trigger = function (name, args) {\n var actualTrigger = Select2.__super__.trigger;\n var preTriggerMap = {\n 'open': 'opening',\n 'close': 'closing',\n 'select': 'selecting',\n 'unselect': 'unselecting',\n 'clear': 'clearing'\n };\n\n if (args === undefined) {\n args = {};\n }\n\n if (name in preTriggerMap) {\n var preTriggerName = preTriggerMap[name];\n var preTriggerArgs = {\n prevented: false,\n name: name,\n args: args\n };\n\n actualTrigger.call(this, preTriggerName, preTriggerArgs);\n\n if (preTriggerArgs.prevented) {\n args.prevented = true;\n\n return;\n }\n }\n\n actualTrigger.call(this, name, args);\n };\n\n Select2.prototype.toggleDropdown = function () {\n if (this.isDisabled()) {\n return;\n }\n\n if (this.isOpen()) {\n this.close();\n } else {\n this.open();\n }\n };\n\n Select2.prototype.open = function () {\n if (this.isOpen()) {\n return;\n }\n\n if (this.isDisabled()) {\n return;\n }\n\n this.trigger('query', {});\n };\n\n Select2.prototype.close = function (evt) {\n if (!this.isOpen()) {\n return;\n }\n\n this.trigger('close', { originalEvent : evt });\n };\n\n /**\n * Helper method to abstract the \"enabled\" (not \"disabled\") state of this\n * object.\n *\n * @return {true} if the instance is not disabled.\n * @return {false} if the instance is disabled.\n */\n Select2.prototype.isEnabled = function () {\n return !this.isDisabled();\n };\n\n /**\n * Helper method to abstract the \"disabled\" state of this object.\n *\n * @return {true} if the disabled option is true.\n * @return {false} if the disabled option is false.\n */\n Select2.prototype.isDisabled = function () {\n return this.options.get('disabled');\n };\n\n Select2.prototype.isOpen = function () {\n return this.$container[0].classList.contains('select2-container--open');\n };\n\n Select2.prototype.hasFocus = function () {\n return this.$container[0].classList.contains('select2-container--focus');\n };\n\n Select2.prototype.focus = function (data) {\n // No need to re-trigger focus events if we are already focused\n if (this.hasFocus()) {\n return;\n }\n\n this.$container[0].classList.add('select2-container--focus');\n this.trigger('focus', {});\n };\n\n Select2.prototype.enable = function (args) {\n if (this.options.get('debug') && window.console && console.warn) {\n console.warn(\n 'Select2: The `select2(\"enable\")` method has been deprecated and will' +\n ' be removed in later Select2 versions. Use $element.prop(\"disabled\")' +\n ' instead.'\n );\n }\n\n if (args == null || args.length === 0) {\n args = [true];\n }\n\n var disabled = !args[0];\n\n this.$element.prop('disabled', disabled);\n };\n\n Select2.prototype.data = function () {\n if (this.options.get('debug') &&\n arguments.length > 0 && window.console && console.warn) {\n console.warn(\n 'Select2: Data can no longer be set using `select2(\"data\")`. You ' +\n 'should consider setting the value instead using `$element.val()`.'\n );\n }\n\n var data = [];\n\n this.dataAdapter.current(function (currentData) {\n data = currentData;\n });\n\n return data;\n };\n\n Select2.prototype.val = function (args) {\n if (this.options.get('debug') && window.console && console.warn) {\n console.warn(\n 'Select2: The `select2(\"val\")` method has been deprecated and will be' +\n ' removed in later Select2 versions. Use $element.val() instead.'\n );\n }\n\n if (args == null || args.length === 0) {\n return this.$element.val();\n }\n\n var newVal = args[0];\n\n if (Array.isArray(newVal)) {\n newVal = newVal.map(function (obj) {\n return obj.toString();\n });\n }\n\n this.$element.val(newVal).trigger('input').trigger('change');\n };\n\n Select2.prototype.destroy = function () {\n Utils.RemoveData(this.$container[0]);\n this.$container.remove();\n\n this._observer.disconnect();\n this._observer = null;\n\n this._syncA = null;\n this._syncS = null;\n\n this.$element.off('.select2');\n this.$element.attr('tabindex',\n Utils.GetData(this.$element[0], 'old-tabindex'));\n\n this.$element[0].classList.remove('select2-hidden-accessible');\n this.$element.attr('aria-hidden', 'false');\n Utils.RemoveData(this.$element[0]);\n this.$element.removeData('select2');\n\n this.dataAdapter.destroy();\n this.selection.destroy();\n this.dropdown.destroy();\n this.results.destroy();\n\n this.dataAdapter = null;\n this.selection = null;\n this.dropdown = null;\n this.results = null;\n };\n\n Select2.prototype.render = function () {\n var $container = $(\n '<span class=\"select2 select2-container\">' +\n '<span class=\"selection\"></span>' +\n '<span class=\"dropdown-wrapper\" aria-hidden=\"true\"></span>' +\n '</span>'\n );\n\n $container.attr('dir', this.options.get('dir'));\n\n this.$container = $container;\n\n this.$container[0].classList\n .add('select2-container--' + this.options.get('theme'));\n\n Utils.StoreData($container[0], 'element', this.$element);\n\n return $container;\n };\n\n return Select2;\n});\n\nS2.define('jquery-mousewheel',[\n 'jquery'\n], function ($) {\n // Used to shim jQuery.mousewheel for non-full builds.\n return $;\n});\n\nS2.define('jquery.select2',[\n 'jquery',\n 'jquery-mousewheel',\n\n './select2/core',\n './select2/defaults',\n './select2/utils'\n], function ($, _, Select2, Defaults, Utils) {\n if ($.fn.select2 == null) {\n // All methods that should return the element\n var thisMethods = ['open', 'close', 'destroy'];\n\n $.fn.select2 = function (options) {\n options = options || {};\n\n if (typeof options === 'object') {\n this.each(function () {\n var instanceOptions = $.extend(true, {}, options);\n\n var instance = new Select2($(this), instanceOptions);\n });\n\n return this;\n } else if (typeof options === 'string') {\n var ret;\n var args = Array.prototype.slice.call(arguments, 1);\n\n this.each(function () {\n var instance = Utils.GetData(this, 'select2');\n\n if (instance == null && window.console && console.error) {\n console.error(\n 'The select2(\\'' + options + '\\') method was called on an ' +\n 'element that is not using Select2.'\n );\n }\n\n ret = instance[options].apply(instance, args);\n });\n\n // Check if we should be returning `this`\n if (thisMethods.indexOf(options) > -1) {\n return this;\n }\n\n return ret;\n } else {\n throw new Error('Invalid arguments for Select2: ' + options);\n }\n };\n }\n\n if ($.fn.select2.defaults == null) {\n $.fn.select2.defaults = Defaults;\n }\n\n return Select2;\n});\n\n // Return the AMD loader configuration so it can be used outside of this file\n return {\n define: S2.define,\n require: S2.require\n };\n}());\n\n // Autoload the jQuery bindings\n // We know that all of the modules exist above this, so we're safe\n var select2 = S2.require('jquery.select2');\n\n // Hold the AMD module references on the jQuery function that was just loaded\n // This allows Select2 to use the internal loader outside of this file, such\n // as in the language files.\n jQuery.fn.select2.amd = S2;\n\n // Return the Select2 instance for anyone who is importing it.\n return select2;\n}));\n\n\n//# sourceURL=webpack://EditableForm/./node_modules/select2/dist/js/select2.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
|
|
/*!****************************************************************************!*\
|
|
!*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
|
|
\****************************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
eval("{\n\nvar stylesInDOM = [];\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n for (var i = 0; i < stylesInDOM.length; i++) {\n if (stylesInDOM[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n return result;\n}\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var indexByIdentifier = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3],\n supports: item[4],\n layer: item[5]\n };\n if (indexByIdentifier !== -1) {\n stylesInDOM[indexByIdentifier].references++;\n stylesInDOM[indexByIdentifier].updater(obj);\n } else {\n var updater = addElementStyle(obj, options);\n options.byIndex = i;\n stylesInDOM.splice(i, 0, {\n identifier: identifier,\n updater: updater,\n references: 1\n });\n }\n identifiers.push(identifier);\n }\n return identifiers;\n}\nfunction addElementStyle(obj, options) {\n var api = options.domAPI(options);\n api.update(obj);\n var updater = function updater(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {\n return;\n }\n api.update(obj = newObj);\n } else {\n api.remove();\n }\n };\n return updater;\n}\nmodule.exports = function (list, options) {\n options = options || {};\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDOM[index].references--;\n }\n var newLastIdentifiers = modulesToDom(newList, options);\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n var _index = getIndexByIdentifier(_identifier);\n if (stylesInDOM[_index].references === 0) {\n stylesInDOM[_index].updater();\n stylesInDOM.splice(_index, 1);\n }\n }\n lastIdentifiers = newLastIdentifiers;\n };\n};\n\n//# sourceURL=webpack://EditableForm/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js":
|
|
/*!********************************************************************!*\
|
|
!*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***!
|
|
\********************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
eval("{\n\nvar memo = {};\n\n/* istanbul ignore next */\nfunction getTarget(target) {\n if (typeof memo[target] === \"undefined\") {\n var styleTarget = document.querySelector(target);\n\n // Special case to return head of iframe instead of iframe itself\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n memo[target] = styleTarget;\n }\n return memo[target];\n}\n\n/* istanbul ignore next */\nfunction insertBySelector(insert, style) {\n var target = getTarget(insert);\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n target.appendChild(style);\n}\nmodule.exports = insertBySelector;\n\n//# sourceURL=webpack://EditableForm/./node_modules/style-loader/dist/runtime/insertBySelector.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js":
|
|
/*!**********************************************************************!*\
|
|
!*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***!
|
|
\**********************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
eval("{\n\n/* istanbul ignore next */\nfunction insertStyleElement(options) {\n var element = document.createElement(\"style\");\n options.setAttributes(element, options.attributes);\n options.insert(element, options.options);\n return element;\n}\nmodule.exports = insertStyleElement;\n\n//# sourceURL=webpack://EditableForm/./node_modules/style-loader/dist/runtime/insertStyleElement.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":
|
|
/*!**********************************************************************************!*\
|
|
!*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***!
|
|
\**********************************************************************************/
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
eval("{\n\n/* istanbul ignore next */\nfunction setAttributesWithoutAttributes(styleElement) {\n var nonce = true ? __webpack_require__.nc : 0;\n if (nonce) {\n styleElement.setAttribute(\"nonce\", nonce);\n }\n}\nmodule.exports = setAttributesWithoutAttributes;\n\n//# sourceURL=webpack://EditableForm/./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js":
|
|
/*!***************************************************************!*\
|
|
!*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***!
|
|
\***************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
eval("{\n\n/* istanbul ignore next */\nfunction apply(styleElement, options, obj) {\n var css = \"\";\n if (obj.supports) {\n css += \"@supports (\".concat(obj.supports, \") {\");\n }\n if (obj.media) {\n css += \"@media \".concat(obj.media, \" {\");\n }\n var needLayer = typeof obj.layer !== \"undefined\";\n if (needLayer) {\n css += \"@layer\".concat(obj.layer.length > 0 ? \" \".concat(obj.layer) : \"\", \" {\");\n }\n css += obj.css;\n if (needLayer) {\n css += \"}\";\n }\n if (obj.media) {\n css += \"}\";\n }\n if (obj.supports) {\n css += \"}\";\n }\n var sourceMap = obj.sourceMap;\n if (sourceMap && typeof btoa !== \"undefined\") {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n }\n\n // For old IE\n /* istanbul ignore if */\n options.styleTagTransform(css, styleElement, options.options);\n}\nfunction removeStyleElement(styleElement) {\n // istanbul ignore if\n if (styleElement.parentNode === null) {\n return false;\n }\n styleElement.parentNode.removeChild(styleElement);\n}\n\n/* istanbul ignore next */\nfunction domAPI(options) {\n if (typeof document === \"undefined\") {\n return {\n update: function update() {},\n remove: function remove() {}\n };\n }\n var styleElement = options.insertStyleElement(options);\n return {\n update: function update(obj) {\n apply(styleElement, options, obj);\n },\n remove: function remove() {\n removeStyleElement(styleElement);\n }\n };\n}\nmodule.exports = domAPI;\n\n//# sourceURL=webpack://EditableForm/./node_modules/style-loader/dist/runtime/styleDomAPI.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js":
|
|
/*!*********************************************************************!*\
|
|
!*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***!
|
|
\*********************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
eval("{\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElement) {\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText = css;\n } else {\n while (styleElement.firstChild) {\n styleElement.removeChild(styleElement.firstChild);\n }\n styleElement.appendChild(document.createTextNode(css));\n }\n}\nmodule.exports = styleTagTransform;\n\n//# sourceURL=webpack://EditableForm/./node_modules/style-loader/dist/runtime/styleTagTransform.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/bootstrap5-editable.js":
|
|
/*!************************************!*\
|
|
!*** ./src/bootstrap5-editable.js ***!
|
|
\************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ initializeXEditable)\n/* harmony export */ });\n/* harmony import */ var select2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! select2 */ \"./node_modules/select2/dist/js/select2.js\");\n/* harmony import */ var select2__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(select2__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var select2_dist_css_select2_min_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! select2/dist/css/select2.min.css */ \"./node_modules/select2/dist/css/select2.min.css\");\n/* harmony import */ var _editable_form_editable_form_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editable-form/editable-form-utils.js */ \"./src/editable-form/editable-form-utils.js\");\n/* harmony import */ var _editable_form_editable_form_utils_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_editable_form_editable_form_utils_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _inputs_abstract_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./inputs/abstract.js */ \"./src/inputs/abstract.js\");\n/* harmony import */ var _inputs_abstract_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_inputs_abstract_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _element_editable_element_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./element/editable-element.js */ \"./src/element/editable-element.js\");\n/* harmony import */ var _element_editable_element_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_element_editable_element_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _inputs_list_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./inputs/list.js */ \"./src/inputs/list.js\");\n/* harmony import */ var _inputs_list_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_inputs_list_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _inputs_text_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./inputs/text.js */ \"./src/inputs/text.js\");\n/* harmony import */ var _inputs_text_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_inputs_text_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _inputs_textarea_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./inputs/textarea.js */ \"./src/inputs/textarea.js\");\n/* harmony import */ var _inputs_textarea_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_inputs_textarea_js__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _inputs_select_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./inputs/select.js */ \"./src/inputs/select.js\");\n/* harmony import */ var _inputs_select_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_inputs_select_js__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _inputs_select2_select2_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./inputs/select2/select2.js */ \"./src/inputs/select2/select2.js\");\n/* harmony import */ var _inputs_select2_select2_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_inputs_select2_select2_js__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _inputs_date_date_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./inputs/date/date.js */ \"./src/inputs/date/date.js\");\n/* harmony import */ var _inputs_date_date_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_inputs_date_date_js__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var _inputs_date_datefield_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./inputs/date/datefield.js */ \"./src/inputs/date/datefield.js\");\n/* harmony import */ var _inputs_date_datefield_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_inputs_date_datefield_js__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var _editable_form_editable_form_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./editable-form/editable-form.js */ \"./src/editable-form/editable-form.js\");\n/* harmony import */ var _editable_form_editable_form_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_editable_form_editable_form_js__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var _containers_editable_container_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./containers/editable-container.js */ \"./src/containers/editable-container.js\");\n/* harmony import */ var _containers_editable_container_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_containers_editable_container_js__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var _containers_editable_inline_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./containers/editable-inline.js */ \"./src/containers/editable-inline.js\");\n/* harmony import */ var _containers_editable_inline_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_containers_editable_inline_js__WEBPACK_IMPORTED_MODULE_14__);\n/* harmony import */ var _containers_editable_popover5_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./containers/editable-popover5.js */ \"./src/containers/editable-popover5.js\");\n/* harmony import */ var _editable_form_editable_form_bootstrap5_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./editable-form/editable-form-bootstrap5.js */ \"./src/editable-form/editable-form-bootstrap5.js\");\n/* harmony import */ var _editable_form_editable_form_bootstrap5_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_editable_form_editable_form_bootstrap5_js__WEBPACK_IMPORTED_MODULE_16__);\n/*\nX-Editable Bootstrap 5 - Complete Bundle\nClean ES6 Module approach - all modules converted\n*/\n\n\n\n\n// Import all modules (functions will be available globally after import)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Export initialization function - UMD will call this with jQuery\nfunction initializeXEditable($) {\n // UMD factory will pass jQuery as first parameter\n if (!$ || !$.fn) {\n console.error('x-editable: jQuery not found or invalid jQuery instance provided');\n return;\n }\n\n console.log('x-editable build: Using jQuery version =', $.fn.jquery);\n\n // Initialize x-editable synchronously in correct order\n // Step 1: Attach foundational utilities\n attachEditableUtils($);\n attachAbstractInput($);\n\n // Step 2: Attach all input types and containers\n attachList($);\n attachText($);\n attachTextarea($);\n attachSelect($);\n attachSelect2($);\n attachDate($);\n attachDateField($);\n attachEditableForm($);\n attachEditableContainer($);\n attachEditableInline($);\n attachEditablePopover($);\n attachEditableFormBootstrap($);\n\n // Step 3: Finally attach the main editable functionality\n attachEditable($);\n\n console.log('x-editable build: Editable attached =', typeof $.fn.editable);\n console.log('x-editable build: Select2 attached =', typeof $.fn.select2);\n \n return $; // Return jQuery instance for chaining\n}\n\n//# sourceURL=webpack://EditableForm/./src/bootstrap5-editable.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/containers/editable-container.js":
|
|
/*!**********************************************!*\
|
|
!*** ./src/containers/editable-container.js ***!
|
|
\**********************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\n Attaches stand-alone container with editable-form to HTML element. Element is used only for positioning, value is not stored anywhere.<br>\n This method applied internally in <code>$().editable()</code>. You should subscribe on it's events (save / cancel) to get profit of it.<br>\n Final realization can be different: bootstrap-popover, jqueryui-tooltip, poshytip, inline-div. It depends on which js file you include.<br>\n Applied as jQuery method.\n\n @class editableContainer\n @uses editableform\n **/\nfunction attachEditableContainer($) {\n \"use strict\";\n\n var Popup = function (element, options) {\n this.init(element, options);\n };\n\n var Inline = function (element, options) {\n this.init(element, options);\n };\n\n //methods\n Popup.prototype = {\n containerName: null, //method to call container on element\n containerDataName: null, //object name in element's .data()\n innerCss: null, //tbd in child class\n containerClass: 'editable-container editable-popup', //css class applied to container element\n defaults: {}, //container itself defaults\n\n init: function(element, options) {\n this.$element = $(element);\n //since 1.4.1 container do not use data-* directly as they already merged into options.\n this.options = $.extend({}, $.fn.editableContainer.defaults, options);\n this.splitOptions();\n\n //set scope of form callbacks to element\n this.formOptions.scope = this.$element[0];\n\n this.initContainer();\n\n //flag to hide container, when saving value will finish\n this.delayedHide = false;\n\n //bind 'destroyed' listener to destroy container when element is removed from dom\n this.$element.on('destroyed', $.proxy(function(){\n this.destroy();\n }, this));\n\n //attach document handler to close containers on click / escape\n if(!$(document).data('editable-handlers-attached')) {\n //close all on escape\n $(document).on('keyup.editable', function (e) {\n if (e.which === 27) {\n $('.editable-open').editableContainer('hide', 'cancel');\n //todo: return focus on element\n }\n });\n\n //close containers when click outside\n //(mousedown could be better than click, it closes everything also on drag drop)\n $(document).on('click.editable', function(e) {\n var $target = $(e.target), i,\n exclude_classes = ['.editable-container',\n '.ui-datepicker-header',\n '.datepicker', //in inline mode datepicker is rendered into body\n '.modal-backdrop',\n '.bootstrap-wysihtml5-insert-image-modal',\n '.bootstrap-wysihtml5-insert-link-modal'\n ];\n\n // select2 has extra body click in IE\n // see: https://github.com/ivaynberg/select2/issues/1058\n if ($('.select2-drop-mask').is(':visible')) {\n return;\n }\n\n //check if element is detached. It occurs when clicking in bootstrap datepicker\n if (!$.contains(document.documentElement, e.target)) {\n return;\n }\n\n //for some reason FF 20 generates extra event (click) in select2 widget with e.target = document\n //we need to filter it via construction below. See https://github.com/vitalets/x-editable/issues/199\n //Possibly related to http://stackoverflow.com/questions/10119793/why-does-firefox-react-differently-from-webkit-and-ie-to-click-event-on-selec\n if($target.is(document)) {\n return;\n }\n\n //if click inside one of exclude classes --> no nothing\n for(i=0; i<exclude_classes.length; i++) {\n if($target.is(exclude_classes[i]) || $target.parents(exclude_classes[i]).length) {\n return;\n }\n }\n\n //close all open containers (except one - target)\n Popup.prototype.closeOthers(e.target);\n });\n\n $(document).data('editable-handlers-attached', true);\n }\n },\n\n //split options on containerOptions and formOptions\n splitOptions: function() {\n this.containerOptions = {};\n this.formOptions = {};\n\n if(!$.fn[this.containerName]) {\n throw new Error(this.containerName + ' not found. Have you included corresponding js file?');\n }\n\n //keys defined in container defaults go to container, others go to form\n for(var k in this.options) {\n if(k in this.defaults) {\n this.containerOptions[k] = this.options[k];\n } else {\n this.formOptions[k] = this.options[k];\n }\n }\n },\n\n /*\n Returns jquery object of container\n @method tip()\n */\n tip: function() {\n return this.container() ? this.container().$tip : null;\n },\n\n /* returns container object */\n container: function() {\n var container;\n //first, try get it by `containerDataName`\n if(this.containerDataName) {\n if(container = this.$element.data(this.containerDataName)) {\n return container;\n }\n }\n //second, try `containerName`\n container = this.$element.data(this.containerName);\n return container;\n },\n\n /* call native method of underlying container, e.g. this.$element.popover('method') */\n call: function() {\n this.$element[this.containerName].apply(this.$element, arguments);\n },\n\n initContainer: function(){\n this.call(this.containerOptions);\n },\n\n renderForm: function() {\n this.$form\n .editableform(this.formOptions)\n .on({\n save: $.proxy(this.save, this), //click on submit button (value changed)\n nochange: $.proxy(function(){ this.hide('nochange'); }, this), //click on submit button (value NOT changed)\n cancel: $.proxy(function(){ this.hide('cancel'); }, this), //click on cancel button\n show: $.proxy(function() {\n if(this.delayedHide) {\n this.hide(this.delayedHide.reason);\n this.delayedHide = false;\n } else {\n this.setPosition();\n }\n }, this), //re-position container every time form is shown (occurs each time after loading state)\n rendering: $.proxy(this.setPosition, this), //this allows to place container correctly when loading shown\n resize: $.proxy(this.setPosition, this), //this allows to re-position container when form size is changed\n rendered: $.proxy(function(){\n /**\n Fired when container is shown and form is rendered (for select will wait for loading dropdown options).\n **Note:** Bootstrap popover has own `shown` event that now cannot be separated from x-editable's one.\n The workaround is to check `arguments.length` that is always `2` for x-editable.\n\n @event shown\n @param {Object} event event object\n @example\n $('#username').on('shown', function(e, editable) {\n editable.input.$input.val('overwriting value of input..');\n });\n **/\n /*\n TODO: added second param mainly to distinguish from bootstrap's shown event. It's a hotfix that will be solved in future versions via namespaced events.\n */\n this.$element.triggerHandler('shown', $(this.options.scope).data('editable'));\n }, this)\n })\n .editableform('render');\n },\n\n /**\n Shows container with form\n @method show()\n @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.\n **/\n /* Note: poshytip owerwrites this method totally! */\n show: function (closeAll) {\n this.$element.addClass('editable-open');\n if(closeAll !== false) {\n //close all open containers (except this)\n this.closeOthers(this.$element[0]);\n }\n\n //show container itself\n this.innerShow();\n this.tip().addClass(this.containerClass);\n\n /*\n Currently, form is re-rendered on every show.\n The main reason is that we dont know, what will container do with content when closed:\n remove(), detach() or just hide() - it depends on container.\n\n Detaching form itself before hide and re-insert before show is good solution,\n but visually it looks ugly --> container changes size before hide.\n */\n\n //if form already exist - delete previous data\n if(this.$form) {\n //todo: destroy prev data!\n this.$form.remove();\n }\n\n this.$form = $('<div>');\n\n //insert form into container body\n if(this.tip().is(this.innerCss)) {\n //for inline container\n this.tip().append(this.$form);\n } else {\n this.tip().find(this.innerCss).append(this.$form);\n }\n\n //render form\n this.renderForm();\n },\n\n /**\n Hides container with form\n @method hide()\n @param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|undefined (=manual)</code>\n **/\n hide: function(reason) {\n if(!this.tip() || !this.tip().is(':visible') || !this.$element.hasClass('editable-open')) {\n return;\n }\n\n //if form is saving value, schedule hide\n if(this.$form.data('editableform').isSaving) {\n this.delayedHide = {reason: reason};\n return;\n } else {\n this.delayedHide = false;\n }\n\n this.$element.removeClass('editable-open');\n this.innerHide();\n\n /**\n Fired when container was hidden. It occurs on both save or cancel.\n **Note:** Bootstrap popover has own `hidden` event that now cannot be separated from x-editable's one.\n The workaround is to check `arguments.length` that is always `2` for x-editable.\n\n @event hidden\n @param {object} event event object\n @param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|manual</code>\n @example\n $('#username').on('hidden', function(e, reason) {\n if(reason === 'save' || reason === 'cancel') {\n //auto-open next editable\n $(this).closest('tr').next().find('.editable').editable('show');\n }\n });\n **/\n this.$element.triggerHandler('hidden', reason || 'manual');\n },\n\n /* internal show method. To be overwritten in child classes */\n innerShow: function () {\n\n },\n\n /* internal hide method. To be overwritten in child classes */\n innerHide: function () {\n\n },\n\n /**\n Toggles container visibility (show / hide)\n @method toggle()\n @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.\n **/\n toggle: function(closeAll) {\n if(this.container() && this.tip() && this.tip().is(':visible')) {\n this.hide();\n } else {\n this.show(closeAll);\n }\n },\n\n /*\n Updates the position of container when content changed.\n @method setPosition()\n */\n setPosition: function() {\n //tbd in child class\n },\n\n save: function(e, params) {\n /**\n Fired when new value was submitted. You can use <code>$(this).data('editableContainer')</code> inside handler to access to editableContainer instance\n\n @event save\n @param {Object} event event object\n @param {Object} params additional params\n @param {mixed} params.newValue submitted value\n @param {Object} params.response ajax response\n @example\n $('#username').on('save', function(e, params) {\n //assuming server response: '{success: true}'\n var pk = $(this).data('editableContainer').options.pk;\n if(params.response && params.response.success) {\n alert('value: ' + params.newValue + ' with pk: ' + pk + ' saved!');\n } else {\n alert('error!');\n }\n });\n **/\n this.$element.triggerHandler('save', params);\n\n //hide must be after trigger, as saving value may require methods of plugin, applied to input\n this.hide('save');\n },\n\n /**\n Sets new option\n\n @method option(key, value)\n @param {string} key\n @param {mixed} value\n **/\n option: function(key, value) {\n this.options[key] = value;\n if(key in this.containerOptions) {\n this.containerOptions[key] = value;\n this.setContainerOption(key, value);\n } else {\n this.formOptions[key] = value;\n if(this.$form) {\n this.$form.editableform('option', key, value);\n }\n }\n },\n\n setContainerOption: function(key, value) {\n this.call('option', key, value);\n },\n\n /**\n Destroys the container instance\n @method destroy()\n **/\n destroy: function() {\n this.hide();\n this.innerDestroy();\n this.$element.off('destroyed');\n this.$element.removeData('editableContainer');\n },\n\n /* to be overwritten in child classes */\n innerDestroy: function() {\n\n },\n\n /*\n Closes other containers except one related to passed element.\n Other containers can be cancelled or submitted (depends on onblur option)\n */\n closeOthers: function(element) {\n $('.editable-open').each(function(i, el){\n //do nothing with passed element and it's children\n if(el === element || $(el).find(element).length) {\n return;\n }\n\n //otherwise cancel or submit all open containers\n var $el = $(el),\n ec = $el.data('editableContainer');\n\n if(!ec) {\n return;\n }\n\n if(ec.options.onblur === 'cancel') {\n $el.data('editableContainer').hide('onblur');\n } else if(ec.options.onblur === 'submit') {\n $el.data('editableContainer').tip().find('form').submit();\n }\n });\n\n },\n\n /**\n Activates input of visible container (e.g. set focus)\n @method activate()\n **/\n activate: function() {\n if(this.tip && this.tip().is(':visible') && this.$form) {\n this.$form.data('editableform').input.activate();\n }\n }\n\n };\n\n /**\n jQuery method to initialize editableContainer.\n\n @method $().editableContainer(options)\n @params {Object} options\n @example\n $('#edit').editableContainer({\n type: 'text',\n url: '/post',\n pk: 1,\n value: 'hello'\n });\n **/\n $.fn.editableContainer = function (option) {\n var args = arguments;\n return this.each(function () {\n var $this = $(this),\n dataKey = 'editableContainer',\n data = $this.data(dataKey),\n options = typeof option === 'object' && option,\n Constructor = (options.mode === 'inline') ? Inline : Popup;\n\n if (!data) {\n $this.data(dataKey, (data = new Constructor(this, options)));\n }\n\n if (typeof option === 'string') { //call method\n data[option].apply(data, Array.prototype.slice.call(args, 1));\n }\n });\n };\n\n //store constructors\n $.fn.editableContainer.Popup = Popup;\n $.fn.editableContainer.Inline = Inline;\n\n //defaults\n $.fn.editableContainer.defaults = {\n /**\n Initial value of form input\n\n @property value\n @type mixed\n @default null\n @private\n **/\n value: null,\n /**\n Placement of container relative to element. Can be <code>top|right|bottom|left</code>. Not used for inline container.\n\n @property placement\n @type string\n @default 'top'\n **/\n placement: 'top',\n /**\n Whether to hide container on save/cancel.\n\n @property autohide\n @type boolean\n @default true\n @private\n **/\n autohide: true,\n /**\n Action when user clicks outside the container. Can be <code>cancel|submit|ignore</code>.\n Setting <code>ignore</code> allows to have several containers open.\n\n @property onblur\n @type string\n @default 'cancel'\n @since 1.1.1\n **/\n onblur: 'cancel',\n\n /**\n Animation speed (inline mode only)\n @property anim\n @type string\n @default false\n **/\n anim: false,\n\n /**\n Mode of editable, can be `popup` or `inline`\n\n @property mode\n @type string\n @default 'popup'\n @since 1.4.0\n **/\n mode: 'popup'\n };\n\n /*\n * workaround to have 'destroyed' event to destroy popover when element is destroyed\n * see http://stackoverflow.com/questions/2200494/jquery-trigger-event-when-an-element-is-removed-from-the-dom\n */\n jQuery.event.special.destroyed = {\n remove: function(o) {\n if (o.handler) {\n o.handler();\n }\n }\n };\n\n return $;\n}\n\n//# sourceURL=webpack://EditableForm/./src/containers/editable-container.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/containers/editable-inline.js":
|
|
/*!*******************************************!*\
|
|
!*** ./src/containers/editable-inline.js ***!
|
|
\*******************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\n* Editable Inline \n* ---------------------\n*/\nfunction attachEditableInline($) {\n \"use strict\";\n \n //copy prototype from EditableContainer\n //extend methods\n $.extend($.fn.editableContainer.Inline.prototype, $.fn.editableContainer.Popup.prototype, {\n containerName: 'editableform',\n innerCss: '.editable-inline',\n containerClass: 'editable-container editable-inline', //css class applied to container element\n \n initContainer: function(){\n //container is <span> element\n this.$tip = $('<span></span>');\n \n //convert anim to miliseconds (int)\n if(!this.options.anim) {\n this.options.anim = 0;\n } \n },\n \n splitOptions: function() {\n //all options are passed to form\n this.containerOptions = {};\n this.formOptions = this.options;\n },\n \n tip: function() {\n return this.$tip; \n },\n \n innerShow: function () {\n this.$element.hide();\n this.tip().insertAfter(this.$element).show();\n }, \n \n innerHide: function () {\n this.$tip.hide(this.options.anim, $.proxy(function() {\n this.$element.show();\n this.innerDestroy();\n }, this)); \n },\n \n innerDestroy: function() {\n if(this.tip()) {\n this.tip().empty().remove();\n }\n } \n });\n\n return $;\n}\n\n//# sourceURL=webpack://EditableForm/./src/containers/editable-inline.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/containers/editable-popover5.js":
|
|
/*!*********************************************!*\
|
|
!*** ./src/containers/editable-popover5.js ***!
|
|
\*********************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bootstrap */ \"bootstrap\");\n/* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bootstrap__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * Editable Popover for Bootstrap 5 based on Popper.js\n * ---------------------\n * requires bootstrap-popover.js\n */\n\n\nfunction attachEditablePopover($) {\n \"use strict\";\n\n //extend methods\n $.extend($.fn.editableContainer.Popup.prototype, {\n containerName: 'popover',\n containerDataName: 'bs.popover',\n innerCss: '.popover-body',\n defaults: bootstrap__WEBPACK_IMPORTED_MODULE_0__.Popover.Default,\n\n initContainer: function(){\n $.extend(this.containerOptions, {\n trigger: 'manual',\n selector: false,\n content: ' ',\n template: this.defaults.template\n });\n\n //as template property is used in inputs, hide it from popover\n var t;\n if(this.$element.data('template')) {\n t = this.$element.data('template');\n this.$element.removeData('template');\n }\n\n this.call(this.containerOptions);\n\n if(t) {\n //restore data('template')\n this.$element.data('template', t);\n }\n },\n\n /* show */\n innerShow: function () {\n this.call('show');\n },\n\n /* hide */\n innerHide: function () {\n this.call('hide');\n },\n\n /* destroy */\n innerDestroy: function() {\n this.call('dispose');\n },\n\n setContainerOption: function(key, value) {\n this.container().options[key] = value;\n },\n\n setPosition: function () {\n (function() {}).call(this.container());\n },\n\n call: function() {\n if ( ! $(this.$element).data(this.containerDataName)) {\n $(this.$element).data(this.containerDataName,\n bootstrap__WEBPACK_IMPORTED_MODULE_0__.Popover.getOrCreateInstance(this.$element, this.containerOptions)\n );\n }\n\n return this.$element[this.containerName].apply(this.$element, arguments);\n },\n\n tip: function() {\n return this.container() ? $(this.container().tip) : null;\n }\n });\n \n return $;\n}\n\n//# sourceURL=webpack://EditableForm/./src/containers/editable-popover5.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/editable-form/editable-form-bootstrap5.js":
|
|
/*!*******************************************************!*\
|
|
!*** ./src/editable-form/editable-form-bootstrap5.js ***!
|
|
\*******************************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/*\nEditableform based on Twitter Bootstrap 5\n*/\nfunction attachEditableFormBootstrap5($) {\n \"use strict\";\n\n //store parent methods\n const pInitInput = $.fn.editableform.Constructor.prototype.initInput;\n\n $.extend($.fn.editableform.Constructor.prototype, {\n initTemplate: function() {\n this.$form = $($.fn.editableform.template);\n this.$form.find('.control-group').removeClass('control-group');\n this.$form.find('.editable-error-block').removeClass('help-block').addClass('invalid-feedback');\n },\n initInput: function() {\n pInitInput.apply(this);\n\n //for bs5 set default class `form-select-sm` to standard inputs\n var emptyInputClass = this.input.options.inputclass === null || this.input.options.inputclass === false;\n var defaultClass = 'form-select-sm';\n\n //bs5 add `form-select` class to standard inputs\n var stdtypes = 'text,select,textarea,password,email,url,tel,number,range,time,typeaheadjs'.split(',');\n if(~$.inArray(this.input.type, stdtypes)) {\n this.input.$input.addClass('form-select');\n if(emptyInputClass) {\n this.input.options.inputclass = defaultClass;\n this.input.$input.addClass(defaultClass);\n }\n }\n\n //apply bs3 size class also to buttons (to fit size of control)\n var $btn = this.$form.find('.editable-buttons');\n var classes = emptyInputClass ? [defaultClass] : this.input.options.inputclass.split(' ');\n for(var i=0; i<classes.length; i++) {\n if(classes[i].toLowerCase() === 'input-lg') {\n $btn.find('button').removeClass('btn-sm').addClass('btn-lg');\n }\n }\n }\n });\n\n //buttons\n $.fn.editableform.buttons =\n '<button type=\"submit\" class=\"btn btn-primary btn-sm editable-submit\">'+\n '<i class=\"bi bi-check\"></i>'+\n '</button>'+\n '<button type=\"button\" class=\"btn btn-secondary btn-sm editable-cancel\">'+\n '<i class=\"bi bi-x\"></i>'+\n '</button>';\n\n //error classes\n $.fn.editableform.errorGroupClass = 'has-error';\n $.fn.editableform.errorBlockClass = null;\n //engine\n $.fn.editableform.engine = 'bs5';\n \n return $;\n}\n\n//# sourceURL=webpack://EditableForm/./src/editable-form/editable-form-bootstrap5.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/editable-form/editable-form-utils.js":
|
|
/*!**************************************************!*\
|
|
!*** ./src/editable-form/editable-form-utils.js ***!
|
|
\**************************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\n* EditableForm utilites\n*/\n\nfunction attachEditableUtils($) {\n \"use strict\";\n \n //utils\n $.fn.editableutils = {\n /**\n * classic JS inheritance function\n */ \n inherit: function (Child, Parent) {\n var F = function() { };\n F.prototype = Parent.prototype;\n Child.prototype = new F();\n Child.prototype.constructor = Child;\n Child.superclass = Parent.prototype;\n },\n\n /**\n * set caret position in input\n * see http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area\n */ \n setCursorPosition: function(elem, pos) {\n if (elem.setSelectionRange) {\n elem.setSelectionRange(pos, pos);\n } else if (elem.createTextRange) {\n var range = elem.createTextRange();\n range.collapse(true);\n range.moveEnd('character', pos);\n range.moveStart('character', pos);\n range.select();\n }\n },\n\n /**\n * function to parse JSON in *single* quotes. (jquery automatically parse only double quotes)\n * That allows such code as: <a data-source=\"{'a': 'b', 'c': 'd'}\">\n * safe = true --> means no exception will be thrown\n * for details see http://stackoverflow.com/questions/7410348/how-to-set-json-format-to-html5-data-attributes-in-the-jquery\n */\n tryParseJson: function(s, safe) {\n if (typeof s === 'string' && s.length && s.match(/^[\\{\\[].*[\\}\\]]$/)) {\n if (safe) {\n try {\n /*jslint evil: true*/\n s = (new Function('return ' + s))();\n /*jslint evil: false*/\n } catch (e) {} finally {\n return s;\n }\n } else {\n /*jslint evil: true*/\n s = (new Function('return ' + s))();\n /*jslint evil: false*/\n }\n }\n return s;\n },\n\n /**\n * slice object by specified keys\n */\n sliceObj: function(obj, keys, caseSensitive /* default: false */) {\n var key, keyLower, newObj = {};\n\n if (!Array.isArray(keys) || !keys.length) {\n return newObj;\n }\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n if (obj.hasOwnProperty(key)) {\n newObj[key] = obj[key];\n }\n\n if(caseSensitive === true) {\n continue;\n }\n\n //when getting data-* attributes via $.data() it's converted to lowercase.\n //details: http://stackoverflow.com/questions/7602565/using-data-attributes-with-jquery\n //workaround is code below.\n keyLower = key.toLowerCase();\n if (obj.hasOwnProperty(keyLower)) {\n newObj[key] = obj[keyLower];\n }\n }\n\n return newObj;\n },\n\n /*\n exclude complex objects from $.data() before pass to config\n */\n getConfigData: function($element) {\n var data = {};\n $.each($element.data(), function(k, v) {\n if(typeof v !== 'object' || (v && typeof v === 'object' && (v.constructor === Object || v.constructor === Array))) {\n data[k] = v;\n }\n });\n return data;\n },\n\n /*\n returns keys of object\n */\n objectKeys: function(o) {\n if (Object.keys) {\n return Object.keys(o); \n } else {\n if (o !== Object(o)) {\n throw new TypeError('Object.keys called on a non-object');\n }\n var k=[], p;\n for (p in o) {\n if (Object.prototype.hasOwnProperty.call(o,p)) {\n k.push(p);\n }\n }\n return k;\n }\n\n },\n \n /**\n method to escape html.\n **/\n escape: function(str) {\n return $('<div>').text(str).html();\n },\n \n /*\n returns array items from sourceData having value property equal or inArray of 'value'\n */\n itemsByValue: function(value, sourceData, valueProp) {\n if(!sourceData || value === null) {\n return [];\n }\n \n if (typeof(valueProp) !== \"function\") {\n var idKey = valueProp || 'value';\n valueProp = function (e) { return e[idKey]; };\n }\n \n var isValArray = Array.isArray(value),\n result = [], \n that = this;\n\n $.each(sourceData, function(i, o) {\n if(o.children) {\n result = result.concat(that.itemsByValue(value, o.children, valueProp));\n } else {\n /*jslint eqeq: true*/\n if(isValArray) {\n if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? valueProp(o) : o); }).length) {\n result.push(o); \n }\n } else {\n var itemValue = (o && (typeof o === 'object')) ? valueProp(o) : o;\n if(value == itemValue) {\n result.push(o); \n }\n }\n /*jslint eqeq: false*/\n }\n });\n \n return result;\n },\n \n /*\n Returns input by options: type, mode. \n */\n createInput: function(options) {\n var TypeConstructor, typeOptions, input,\n type = options.type;\n\n //`date` is some kind of virtual type that is transformed to one of exact types\n //depending on mode and core lib\n if(type === 'date') {\n //inline\n if(options.mode === 'inline') {\n if($.fn.editabletypes.datefield) {\n type = 'datefield';\n } else if($.fn.editabletypes.dateuifield) {\n type = 'dateuifield';\n }\n //popup\n } else {\n if($.fn.editabletypes.date) {\n type = 'date';\n } else if($.fn.editabletypes.dateui) {\n type = 'dateui';\n }\n }\n \n //if type still `date` and not exist in types, replace with `combodate` that is base input\n if(type === 'date' && !$.fn.editabletypes.date) {\n type = 'combodate';\n } \n }\n \n //`datetime` should be datetimefield in 'inline' mode\n if(type === 'datetime' && options.mode === 'inline') {\n type = 'datetimefield'; \n } \n\n //change wysihtml5 to textarea for jquery UI and plain versions\n if(type === 'wysihtml5' && !$.fn.editabletypes[type]) {\n type = 'textarea';\n }\n\n //create input of specified type. Input will be used for converting value, not in form\n if(typeof $.fn.editabletypes[type] === 'function') {\n TypeConstructor = $.fn.editabletypes[type];\n typeOptions = this.sliceObj(options, this.objectKeys(TypeConstructor.defaults));\n input = new TypeConstructor(typeOptions);\n return input;\n } else {\n $.error('Unknown type: '+ type);\n return false; \n } \n },\n \n //see http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr\n supportsTransitions: function () {\n var b = document.body || document.documentElement,\n s = b.style,\n p = 'transition',\n v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'];\n \n if(typeof s[p] === 'string') {\n return true; \n }\n\n // Tests for vendor specific prop\n p = p.charAt(0).toUpperCase() + p.substr(1);\n for(var i=0; i<v.length; i++) {\n if(typeof s[v[i] + p] === 'string') { \n return true; \n }\n }\n return false;\n } \n \n }; \n \n // Return the jQuery object with attached utilities\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/editable-form/editable-form-utils.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/editable-form/editable-form.js":
|
|
/*!********************************************!*\
|
|
!*** ./src/editable-form/editable-form.js ***!
|
|
\********************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nForm with single input element, two buttons and two states: normal/loading.\nApplied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown.\nEditableform is linked with one of input types, e.g. 'text', 'select' etc.\n\n@class editableform\n@uses text\n@uses textarea\n**/\nfunction attachEditableForm($) {\n \"use strict\";\n \n var EditableForm = function (div, options) {\n this.options = $.extend({}, $.fn.editableform.defaults, options);\n this.$div = $(div); //div, containing form. Not form tag. Not editable-element.\n if(!this.options.scope) {\n this.options.scope = this;\n }\n //nothing shown after init\n };\n\n EditableForm.prototype = {\n constructor: EditableForm,\n initInput: function() { //called once\n //take input from options (as it is created in editable-element)\n this.input = this.options.input;\n \n //set initial value\n //todo: may be add check: typeof str === 'string' ? \n this.value = this.input.str2value(this.options.value); \n \n //prerender: get input.$input\n this.input.prerender();\n },\n initTemplate: function() {\n this.$form = $($.fn.editableform.template); \n },\n initButtons: function() {\n var $btn = this.$form.find('.editable-buttons');\n $btn.append($.fn.editableform.buttons);\n if(this.options.showbuttons === 'bottom') {\n $btn.addClass('editable-buttons-bottom');\n }\n },\n /**\n Renders editableform\n\n @method render\n **/ \n render: function() {\n //init loader\n this.$loading = $($.fn.editableform.loading); \n this.$div.empty().append(this.$loading);\n \n //init form template and buttons\n this.initTemplate();\n if(this.options.showbuttons) {\n this.initButtons();\n } else {\n this.$form.find('.editable-buttons').remove();\n }\n\n //show loading state\n this.showLoading(); \n \n //flag showing is form now saving value to server. \n //It is needed to wait when closing form.\n this.isSaving = false;\n \n /** \n Fired when rendering starts\n @event rendering \n @param {Object} event event object\n **/ \n this.$div.triggerHandler('rendering');\n \n //init input\n this.initInput();\n \n //append input to form\n this.$form.find('div.editable-input').append(this.input.$tpl); \n \n //append form to container\n this.$div.append(this.$form);\n \n //render input\n $.when(this.input.render())\n .then($.proxy(function () {\n //setup input to submit automatically when no buttons shown\n if(!this.options.showbuttons) {\n this.input.autosubmit(); \n }\n \n //attach 'cancel' handler\n this.$form.find('.editable-cancel').click($.proxy(this.cancel, this));\n \n if(this.input.error) {\n this.error(this.input.error);\n this.$form.find('.editable-submit').attr('disabled', true);\n this.input.$input.attr('disabled', true);\n //prevent form from submitting\n this.$form.submit(function(e){ e.preventDefault(); });\n } else {\n this.error(false);\n this.input.$input.removeAttr('disabled');\n this.$form.find('.editable-submit').removeAttr('disabled');\n var value = (this.value === null || this.value === undefined || this.value === '') ? this.options.defaultValue : this.value;\n this.input.value2input(value);\n //attach submit handler\n this.$form.submit($.proxy(this.submit, this));\n }\n\n /** \n Fired when form is rendered\n @event rendered\n @param {Object} event event object\n **/ \n this.$div.triggerHandler('rendered'); \n\n this.showForm();\n \n //call postrender method to perform actions required visibility of form\n if(this.input.postrender) {\n this.input.postrender();\n } \n }, this));\n },\n cancel: function() { \n /** \n Fired when form was cancelled by user\n @event cancel \n @param {Object} event event object\n **/ \n this.$div.triggerHandler('cancel');\n },\n showLoading: function() {\n var w, h;\n if(this.$form) {\n //set loading size equal to form\n w = this.$form.outerWidth();\n h = this.$form.outerHeight(); \n if(w) {\n this.$loading.width(w);\n }\n if(h) {\n this.$loading.height(h);\n }\n this.$form.hide();\n } else {\n //stretch loading to fill container width\n w = this.$loading.parent().width();\n if(w) {\n this.$loading.width(w);\n }\n }\n this.$loading.show(); \n },\n\n showForm: function(activate) {\n this.$loading.hide();\n this.$form.show();\n if(activate !== false) {\n this.input.activate(); \n }\n /** \n Fired when form is shown\n @event show \n @param {Object} event event object\n **/ \n this.$div.triggerHandler('show');\n },\n\n error: function(msg) {\n var $group = this.$form.find('.control-group'),\n $block = this.$form.find('.editable-error-block'),\n lines;\n\n if(msg === false) {\n $group.removeClass($.fn.editableform.errorGroupClass);\n $block.removeClass($.fn.editableform.errorBlockClass).empty().hide(); \n } else {\n //convert newline to <br> for more pretty error display\n if(msg) {\n lines = (''+msg).split('\\n');\n for (var i = 0; i < lines.length; i++) {\n lines[i] = $('<div>').text(lines[i]).html();\n }\n msg = lines.join('<br>');\n }\n $group.addClass($.fn.editableform.errorGroupClass);\n $block.addClass($.fn.editableform.errorBlockClass).html(msg).show();\n }\n },\n\n submit: function(e) {\n e.stopPropagation();\n e.preventDefault();\n \n //get new value from input\n var newValue = this.input.input2value();\n\n //validation: if validate returns string or truthy value - means error\n //if returns object like {newValue: '...'} => submitted value is reassigned to it\n var error = this.validate(newValue);\n if ($.type(error) === 'object' && error.newValue !== undefined) {\n newValue = error.newValue;\n this.input.value2input(newValue);\n if(typeof error.msg === 'string') {\n this.error(error.msg);\n this.showForm();\n return;\n }\n } else if (error) {\n this.error(error);\n this.showForm();\n return;\n } \n \n //if value not changed --> trigger 'nochange' event and return\n /*jslint eqeq: true*/\n if (!this.options.savenochange && this.input.value2str(newValue) == this.input.value2str(this.value)) {\n /*jslint eqeq: false*/ \n /** \n Fired when value not changed but form is submitted. Requires savenochange = false.\n @event nochange \n @param {Object} event event object\n **/ \n this.$div.triggerHandler('nochange'); \n return;\n } \n\n //convert value for submitting to server\n var submitValue = this.input.value2submit(newValue);\n \n this.isSaving = true;\n \n //sending data to server\n $.when(this.save(submitValue))\n .done($.proxy(function(response) {\n this.isSaving = false;\n\n //run success callback\n var res = typeof this.options.success === 'function' ? this.options.success.call(this.options.scope, response, newValue) : null;\n\n //if success callback returns false --> keep form open and do not activate input\n if(res === false) {\n this.error(false);\n this.showForm(false);\n return;\n }\n\n //if success callback returns string --> keep form open, show error and activate input \n if(typeof res === 'string') {\n this.error(res);\n this.showForm();\n return;\n }\n\n //if success callback returns object like {newValue: <something>} --> use that value instead of submitted\n //it is usefull if you want to chnage value in url-function\n if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {\n newValue = res.newValue;\n }\n\n //clear error message\n this.error(false); \n this.value = newValue;\n /** \n Fired when form is submitted\n @event save \n @param {Object} event event object\n @param {Object} params additional params\n @param {mixed} params.newValue raw new value\n @param {mixed} params.submitValue submitted value as string\n @param {Object} params.response ajax response\n\n @example\n $('#form-div').on('save'), function(e, params){\n if(params.newValue === 'username') {...}\n });\n **/\n this.$div.triggerHandler('save', {newValue: newValue, submitValue: submitValue, response: response});\n }, this))\n .fail($.proxy(function(xhr) {\n this.isSaving = false;\n\n var msg;\n if(typeof this.options.error === 'function') {\n msg = this.options.error.call(this.options.scope, xhr, newValue);\n } else {\n msg = typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!';\n }\n\n this.error(msg);\n this.showForm();\n }, this));\n },\n\n save: function(submitValue) {\n //try parse composite pk defined as json string in data-pk \n this.options.pk = $.fn.editableutils.tryParseJson(this.options.pk, true); \n \n var pk = (typeof this.options.pk === 'function') ? this.options.pk.call(this.options.scope) : this.options.pk,\n /*\n send on server in following cases:\n 1. url is function\n 2. url is string AND (pk defined OR send option = always) \n */\n send = !!(typeof this.options.url === 'function' || (this.options.url && ((this.options.send === 'always') || (this.options.send === 'auto' && pk !== null && pk !== undefined)))),\n params;\n\n if (send) { //send to server\n this.showLoading();\n\n //standard params\n params = {\n name: this.options.name || '',\n value: submitValue,\n pk: pk \n };\n\n //additional params\n if(typeof this.options.params === 'function') {\n params = this.options.params.call(this.options.scope, params); \n } else {\n //try parse json in single quotes (from data-params attribute)\n this.options.params = $.fn.editableutils.tryParseJson(this.options.params, true); \n $.extend(params, this.options.params);\n }\n\n if(typeof this.options.url === 'function') { //user's function\n return this.options.url.call(this.options.scope, params);\n } else { \n //send ajax to server and return deferred object\n return $.ajax($.extend({\n url : this.options.url,\n data : params,\n type : 'POST'\n }, this.options.ajaxOptions));\n }\n }\n }, \n\n validate: function (value) {\n if (value === undefined) {\n value = this.value;\n }\n if (typeof this.options.validate === 'function') {\n return this.options.validate.call(this.options.scope, value);\n }\n },\n\n option: function(key, value) {\n if(key in this.options) {\n this.options[key] = value;\n }\n \n if(key === 'value') {\n this.setValue(value);\n }\n \n //do not pass option to input as it is passed in editable-element\n },\n\n setValue: function(value, convertStr) {\n if(convertStr) {\n this.value = this.input.str2value(value);\n } else {\n this.value = value;\n }\n \n //if form is visible, update input\n if(this.$form && this.$form.is(':visible')) {\n this.input.value2input(this.value);\n } \n } \n };\n\n /*\n Initialize editableform. Applied to jQuery object.\n\n @method $().editableform(options)\n @params {Object} options\n @example\n var $form = $('<div>').editableform({\n type: 'text',\n name: 'username',\n url: '/post',\n value: 'vitaliy'\n });\n\n //to display form you should call 'render' method\n $form.editableform('render'); \n */\n $.fn.editableform = function (option) {\n var args = arguments;\n return this.each(function () {\n var $this = $(this), \n data = $this.data('editableform'), \n options = typeof option === 'object' && option; \n if (!data) {\n $this.data('editableform', (data = new EditableForm(this, options)));\n }\n\n if (typeof option === 'string') { //call method \n data[option].apply(data, Array.prototype.slice.call(args, 1));\n } \n });\n };\n\n //keep link to constructor to allow inheritance\n $.fn.editableform.Constructor = EditableForm; \n\n //defaults\n $.fn.editableform.defaults = {\n /* see also defaults for input */\n\n /**\n Type of input. Can be <code>text|textarea|select|date|checklist</code>\n\n @property type \n @type string\n @default 'text'\n **/\n type: 'text',\n /**\n Url for submit, e.g. <code>'/post'</code> \n If function - it will be called instead of ajax. Function should return deferred object to run fail/done callbacks.\n\n @property url \n @type string|function\n @default null\n @example\n url: function(params) {\n var d = new $.Deferred;\n if(params.value === 'abc') {\n return d.reject('error message'); //returning error via deferred object\n } else {\n //async saving data in js model\n someModel.asyncSaveMethod({\n ..., \n success: function(){\n d.resolve();\n }\n }); \n return d.promise();\n }\n } \n **/ \n url:null,\n /**\n Additional params for submit. If defined as <code>object</code> - it is **appended** to original ajax data (pk, name and value). \n If defined as <code>function</code> - returned object **overwrites** original ajax data.\n @example\n params: function(params) {\n //originally params contain pk, name and value\n params.a = 1;\n return params;\n }\n\n @property params \n @type object|function\n @default null\n **/ \n params:null,\n /**\n Name of field. Will be submitted on server. Can be taken from <code>id</code> attribute\n\n @property name \n @type string\n @default null\n **/ \n name: null,\n /**\n Primary key of editable object (e.g. record id in database). For composite keys use object, e.g. <code>{id: 1, lang: 'en'}</code>.\n Can be calculated dynamically via function.\n\n @property pk \n @type string|object|function\n @default null\n **/ \n pk: null,\n /**\n Initial value. If not defined - will be taken from element's content.\n For __select__ type should be defined (as it is ID of shown text).\n\n @property value \n @type string|object\n @default null\n **/ \n value: null,\n /**\n Value that will be displayed in input if original field value is empty (`null|undefined|''`).\n\n @property defaultValue \n @type string|object\n @default null\n @since 1.4.6\n **/ \n defaultValue: null,\n /**\n Strategy for sending data on server. Can be `auto|always|never`.\n When 'auto' data will be sent on server **only if pk and url defined**, otherwise new value will be stored locally.\n\n @property send \n @type string\n @default 'auto'\n **/ \n send: 'auto', \n /**\n Function for client-side validation. If returns string - means validation not passed and string showed as error.\n Since 1.5.1 you can modify submitted value by returning object from `validate`: \n `{newValue: '...'}` or `{newValue: '...', msg: '...'}`\n\n @property validate \n @type function\n @default null\n @example\n validate: function(value) {\n if(value.trim() == '') {\n return 'This field is required';\n }\n }\n **/ \n validate: null,\n /**\n Success callback. Called when value successfully sent on server and **response status = 200**. \n Usefull to work with json response. For example, if your backend response can be <code>{success: true}</code>\n or <code>{success: false, msg: \"server error\"}</code> you can check it inside this callback. \n If it returns **string** - means error occured and string is shown as error message. \n If it returns **object like** <code>{newValue: <something>}</code> - it overwrites value, submitted by user. \n Otherwise newValue simply rendered into element.\n \n @property success \n @type function\n @default null\n @example\n success: function(response, newValue) {\n if(!response.success) return response.msg;\n }\n **/ \n success: null,\n /**\n Error callback. Called when request failed (response status != 200). \n Usefull when you want to parse error response and display a custom message.\n Must return **string** - the message to be displayed in the error block.\n \n @property error \n @type function\n @default null\n @since 1.4.4\n @example\n error: function(response, newValue) {\n if(response.status === 500) {\n return 'Service unavailable. Please try later.';\n } else {\n return response.responseText;\n }\n }\n **/ \n error: null,\n /**\n Additional options for submit ajax request.\n List of values: http://api.jquery.com/jQuery.ajax\n \n @property ajaxOptions \n @type object\n @default null\n @since 1.1.1 \n @example \n ajaxOptions: {\n type: 'put',\n dataType: 'json'\n } \n **/ \n ajaxOptions: null,\n /**\n Where to show buttons: left(true)|bottom|false \n Form without buttons is auto-submitted.\n\n @property showbuttons \n @type boolean|string\n @default true\n @since 1.1.1\n **/ \n showbuttons: true,\n /**\n Scope for callback methods (success, validate). \n If <code>null</code> means editableform instance itself. \n\n @property scope \n @type DOMElement|object\n @default null\n @since 1.2.0\n @private\n **/ \n scope: null,\n /**\n Whether to save or cancel value when it was not changed but form was submitted\n\n @property savenochange \n @type boolean\n @default false\n @since 1.2.0\n **/\n savenochange: false\n }; \n\n /*\n Note: following params could redefined in engine: bootstrap or jqueryui:\n Classes 'control-group' and 'editable-error-block' must always present!\n */ \n $.fn.editableform.template = '<form class=\"form-inline editableform\">'+\n '<div class=\"control-group\">' + \n '<div><div class=\"editable-input\"></div><div class=\"editable-buttons\"></div></div>'+\n '<div class=\"editable-error-block\"></div>' + \n '</div>' + \n '</form>';\n\n //loading div\n $.fn.editableform.loading = '<div class=\"editableform-loading\"></div>';\n\n //buttons\n $.fn.editableform.buttons = '<button type=\"submit\" class=\"editable-submit\">ok</button>'+\n '<button type=\"button\" class=\"editable-cancel\">cancel</button>'; \n\n //error class attached to control-group\n $.fn.editableform.errorGroupClass = null; \n\n //error class attached to editable-error-block\n $.fn.editableform.errorBlockClass = 'editable-error';\n \n //engine\n $.fn.editableform.engine = 'jquery';\n \n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/editable-form/editable-form.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/element/editable-element.js":
|
|
/*!*****************************************!*\
|
|
!*** ./src/element/editable-element.js ***!
|
|
\*****************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nMakes editable any HTML element on the page. Applied as jQuery method.\n\n@class editable\n@uses editableContainer\n**/\n\nfunction attachEditable($) {\n \"use strict\";\n\n var Editable = function (element, options) {\n this.$element = $(element);\n //data-* has more priority over js options: because dynamically created elements may change data-* \n this.options = $.extend({}, $.fn.editable.defaults, options, $.fn.editableutils.getConfigData(this.$element)); \n if(this.options.selector) {\n this.initLive();\n } else {\n this.init();\n }\n \n //check for transition support\n if(this.options.highlight && !$.fn.editableutils.supportsTransitions()) {\n this.options.highlight = false;\n }\n };\n\n Editable.prototype = {\n constructor: Editable, \n init: function () {\n var isValueByText = false, \n doAutotext, finalize;\n\n //name\n this.options.name = this.options.name || this.$element.attr('id');\n \n //create input of specified type. Input needed already here to convert value for initial display (e.g. show text by id for select)\n //also we set scope option to have access to element inside input specific callbacks (e. g. source as function)\n this.options.scope = this.$element[0]; \n this.input = $.fn.editableutils.createInput(this.options);\n if(!this.input) {\n return; \n }\n \n // Set the editable's type from the input's type\n this.type = this.input.type; \n\n //set value from settings or by element's text\n if (this.options.value === undefined || this.options.value === null) {\n this.value = this.input.html2value(this.$element.html().trim());\n isValueByText = true;\n } else {\n /*\n value can be string when received from 'data-value' attribute\n for complext objects value can be set as json string in data-value attribute, \n e.g. data-value=\"{city: 'Moscow', street: 'Lenina'}\"\n */\n this.options.value = $.fn.editableutils.tryParseJson(this.options.value, true); \n if(typeof this.options.value === 'string') {\n this.value = this.input.str2value(this.options.value);\n } else {\n this.value = this.options.value;\n }\n }\n \n //add 'editable' class to every editable element\n this.$element.addClass('editable');\n \n //specifically for \"textarea\" add class .editable-pre-wrapped to keep linebreaks\n if(this.input.type === 'textarea') {\n this.$element.addClass('editable-pre-wrapped');\n }\n \n //attach handler activating editable. In disabled mode it just prevent default action (useful for links)\n if(this.options.toggle !== 'manual') {\n this.$element.addClass('editable-click');\n // Debug: ensure toggle is set\n if (!this.options.toggle) {\n console.warn('Toggle option is undefined, defaulting to click');\n this.options.toggle = 'click';\n }\n this.$element.on(this.options.toggle + '.editable', $.proxy(function(e){\n //prevent following link if editable enabled\n if(!this.options.disabled) {\n e.preventDefault();\n }\n \n //stop propagation not required because in document click handler it checks event target\n //e.stopPropagation();\n \n if(this.options.toggle === 'mouseenter') {\n //for hover only show container\n this.show();\n } else {\n //when toggle='click' we should not close all other containers as they will be closed automatically in document click listener\n var closeAll = (this.options.toggle !== 'click');\n this.toggle(closeAll);\n }\n }, this));\n } else {\n this.$element.attr('tabindex', -1); //do not stop focus on element when toggled manually\n }\n \n //if display is function it's far more convinient to have autotext = always to render correctly on init\n //see https://github.com/vitalets/x-editable-yii/issues/34\n if(typeof this.options.display === 'function') {\n this.options.autotext = 'always';\n }\n \n //check conditions for autotext:\n switch(this.options.autotext) {\n case 'always':\n doAutotext = true;\n break;\n case 'auto':\n //if element text is empty and value is defined and value not generated by text --> run autotext\n doAutotext = !(this.$element.text().trim()).length && this.value !== null && this.value !== undefined && !isValueByText;\n break;\n default:\n doAutotext = false;\n }\n\n //depending on autotext run render() or just finilize init\n $.when(doAutotext ? this.render() : true).then($.proxy(function() {\n if(this.options.disabled) {\n this.disable();\n } else {\n this.enable(); \n }\n /** \n Fired when element was initialized by `$().editable()` method. \n Please note that you should setup `init` handler **before** applying `editable`. \n \n @event init \n @param {Object} event event object\n @param {Object} editable editable instance (as here it cannot accessed via data('editable'))\n @since 1.2.0\n @example\n $('#username').on('init', function(e, editable) {\n alert('initialized ' + editable.options.name);\n });\n $('#username').editable();\n **/ \n this.$element.triggerHandler('init', this);\n }, this));\n },\n\n /*\n Initializes parent element for live editables \n */\n initLive: function() {\n //store selector \n var selector = this.options.selector;\n //modify options for child elements\n this.options.selector = false; \n this.options.autotext = 'never';\n //listen toggle events\n this.$element.on(this.options.toggle + '.editable', selector, $.proxy(function(e){\n var $target = $(e.target);\n if(!$target.data('editable')) {\n //if delegated element initially empty, we need to clear it's text (that was manually set to `empty` by user)\n //see https://github.com/vitalets/x-editable/issues/137 \n if($target.hasClass(this.options.emptyclass)) {\n $target.empty();\n }\n $target.editable(this.options).trigger(e);\n }\n }, this)); \n },\n \n /*\n Renders value into element's text.\n Can call custom display method from options.\n Can return deferred object.\n @method render()\n @param {mixed} response server response (if exist) to pass into display function\n */ \n render: function(response) {\n //do not display anything\n if(this.options.display === false) {\n return;\n }\n\n //if input has `value2htmlFinal` method, we pass callback in third param to be called when source is loaded\n if(this.input.value2htmlFinal) {\n return this.input.value2html(this.value, this.$element[0], this.options.display, response);\n //if display method defined --> use it\n } else if(typeof this.options.display === 'function') {\n return this.options.display.call(this.$element[0], this.value, response);\n //else use input's original value2html() method\n } else {\n return this.input.value2html(this.value, this.$element[0]);\n }\n },\n \n /**\n Enables editable\n @method enable()\n **/ \n enable: function() {\n this.options.disabled = false;\n this.$element.removeClass('editable-disabled');\n this.handleEmpty(this.isEmpty);\n if(this.options.toggle !== 'manual') {\n if(this.$element.attr('tabindex') === '-1') { \n this.$element.removeAttr('tabindex'); \n }\n }\n },\n \n /**\n Disables editable\n @method disable()\n **/ \n disable: function() {\n this.options.disabled = true; \n this.hide(); \n this.$element.addClass('editable-disabled');\n this.handleEmpty(this.isEmpty);\n //do not stop focus on this element\n this.$element.attr('tabindex', -1); \n },\n \n /**\n Toggles enabled / disabled state of editable element\n @method toggleDisabled()\n **/ \n toggleDisabled: function() {\n if(this.options.disabled) {\n this.enable();\n } else { \n this.disable(); \n }\n }, \n \n /**\n Sets new option\n \n @method option(key, value)\n @param {string|object} key option name or object with several options\n @param {mixed} value option new value\n @example\n $('.editable').editable('option', 'pk', 2);\n **/ \n option: function(key, value) {\n //set option(s) by object\n if(key && typeof key === 'object') {\n $.each(key, $.proxy(function(k, v){\n this.option(k.triim(), v);\n }, this)); \n return;\n }\n\n //set option by string \n this.options[key] = value; \n \n //disabled\n if(key === 'disabled') {\n return value ? this.disable() : this.enable();\n } \n \n //value\n if(key === 'value') {\n this.setValue(value);\n }\n \n //transfer new option to container! \n if(this.container) {\n this.container.option(key, value); \n }\n \n //pass option to input directly (as it points to the same in form)\n if(this.input.option) {\n this.input.option(key, value);\n }\n \n }, \n \n /*\n * set emptytext if element is empty\n */\n handleEmpty: function (isEmpty) {\n //do not handle empty if we do not display anything\n if(this.options.display === false) {\n return;\n }\n\n /* \n isEmpty may be set directly as param of method.\n It is required when we enable/disable field and can't rely on content \n as node content is text: \"Empty\" that is not empty %)\n */\n if(isEmpty !== undefined) { \n this.isEmpty = isEmpty;\n } else {\n //detect empty\n //for some inputs we need more smart check\n //e.g. wysihtml5 may have <br>, <p></p>, <img>\n if(typeof(this.input.isEmpty) === 'function') {\n this.isEmpty = this.input.isEmpty(this.$element); \n } else {\n this.isEmpty = this.$element.html().trim() === '';\n }\n } \n \n //emptytext shown only for enabled\n if(!this.options.disabled) {\n if (this.isEmpty) {\n this.$element.html(this.options.emptytext);\n if(this.options.emptyclass) {\n this.$element.addClass(this.options.emptyclass);\n }\n } else if(this.options.emptyclass) {\n this.$element.removeClass(this.options.emptyclass);\n }\n } else {\n //below required if element disable property was changed\n if(this.isEmpty) {\n this.$element.empty();\n if(this.options.emptyclass) {\n this.$element.removeClass(this.options.emptyclass);\n }\n }\n }\n }, \n \n /**\n Shows container with form\n @method show()\n @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.\n **/ \n show: function (closeAll) {\n if(this.options.disabled) {\n return;\n }\n \n //init editableContainer: popover, tooltip, inline, etc..\n if(!this.container) {\n var containerOptions = $.extend({}, this.options, {\n value: this.value,\n input: this.input //pass input to form (as it is already created)\n });\n this.$element.editableContainer(containerOptions);\n //listen `save` event \n this.$element.on(\"save.internal\", $.proxy(this.save, this));\n this.container = this.$element.data('editableContainer'); \n } else if(this.container.tip().is(':visible')) {\n return;\n } \n \n //show container\n this.container.show(closeAll);\n },\n \n /**\n Hides container with form\n @method hide()\n **/ \n hide: function () { \n if(this.container) { \n this.container.hide();\n }\n },\n \n /**\n Toggles container visibility (show / hide)\n @method toggle()\n @param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.\n **/ \n toggle: function(closeAll) {\n if(this.container && this.container.tip().is(':visible')) {\n this.hide();\n } else {\n this.show(closeAll);\n }\n },\n \n /*\n * called when form was submitted\n */ \n save: function(e, params) {\n //mark element with unsaved class if needed\n if(this.options.unsavedclass) {\n /*\n Add unsaved css to element if:\n - url is not user's function \n - value was not sent to server\n - params.response === undefined, that means data was not sent\n - value changed \n */\n var sent = false;\n sent = sent || typeof this.options.url === 'function';\n sent = sent || this.options.display === false; \n sent = sent || params.response !== undefined; \n sent = sent || (this.options.savenochange && this.input.value2str(this.value) !== this.input.value2str(params.newValue)); \n \n if(sent) {\n this.$element.removeClass(this.options.unsavedclass); \n } else {\n this.$element.addClass(this.options.unsavedclass); \n }\n }\n \n //highlight when saving\n if(this.options.highlight) {\n var $e = this.$element,\n bgColor = $e.css('background-color');\n \n $e.css('background-color', this.options.highlight);\n setTimeout(function(){\n if(bgColor === 'transparent') {\n bgColor = ''; \n }\n $e.css('background-color', bgColor);\n $e.addClass('editable-bg-transition');\n setTimeout(function(){\n $e.removeClass('editable-bg-transition'); \n }, 1700);\n }, 10);\n }\n \n //set new value\n this.setValue(params.newValue, false, params.response);\n \n /** \n Fired when new value was submitted. You can use <code>$(this).data('editable')</code> to access to editable instance\n \n @event save \n @param {Object} event event object\n @param {Object} params additional params\n @param {mixed} params.newValue submitted value\n @param {Object} params.response ajax response\n @example\n $('#username').on('save', function(e, params) {\n alert('Saved value: ' + params.newValue);\n });\n **/\n //event itself is triggered by editableContainer. Description here is only for documentation \n },\n\n validate: function () {\n if (typeof this.options.validate === 'function') {\n return this.options.validate.call(this, this.value);\n }\n },\n \n /**\n Sets new value of editable\n @method setValue(value, convertStr)\n @param {mixed} value new value \n @param {boolean} convertStr whether to convert value from string to internal format\n **/ \n setValue: function(value, convertStr, response) {\n if(convertStr) {\n this.value = this.input.str2value(value);\n } else {\n this.value = value;\n }\n if(this.container) {\n this.container.option('value', this.value);\n }\n $.when(this.render(response))\n .then($.proxy(function() {\n this.handleEmpty();\n }, this));\n },\n \n /**\n Activates input of visible container (e.g. set focus)\n @method activate()\n **/ \n activate: function() {\n if(this.container) {\n this.container.activate(); \n }\n },\n \n /**\n Removes editable feature from element\n @method destroy()\n **/ \n destroy: function() {\n this.disable();\n \n if(this.container) {\n this.container.destroy(); \n }\n \n this.input.destroy();\n\n if(this.options.toggle !== 'manual') {\n this.$element.removeClass('editable-click');\n this.$element.off(this.options.toggle + '.editable');\n } \n \n this.$element.off(\"save.internal\");\n \n this.$element.removeClass('editable editable-open editable-disabled');\n this.$element.removeData('editable');\n } \n };\n\n /* EDITABLE PLUGIN DEFINITION\n * ======================= */\n\n /**\n jQuery method to initialize editable element.\n \n @method $().editable(options)\n @params {Object} options\n @example\n $('#username').editable({\n type: 'text',\n url: '/post',\n pk: 1\n });\n **/\n $.fn.editable = function (option) {\n //special API methods returning non-jquery object\n var result = {}, args = arguments, datakey = 'editable';\n switch (option) {\n /**\n Runs client-side validation for all matched editables\n \n @method validate()\n @returns {Object} validation errors map\n @example\n $('#username, #fullname').editable('validate');\n // possible result:\n {\n username: \"username is required\",\n fullname: \"fullname should be minimum 3 letters length\"\n }\n **/\n case 'validate':\n this.each(function () {\n var $this = $(this), data = $this.data(datakey), error;\n if (data && (error = data.validate())) {\n result[data.options.name] = error;\n }\n });\n return result;\n\n /**\n Returns current values of editable elements. \n Note that it returns an **object** with name-value pairs, not a value itself. It allows to get data from several elements. \n If value of some editable is `null` or `undefined` it is excluded from result object.\n When param `isSingle` is set to **true** - it is supposed you have single element and will return value of editable instead of object. \n \n @method getValue()\n @param {bool} isSingle whether to return just value of single element\n @returns {Object} object of element names and values\n @example\n $('#username, #fullname').editable('getValue');\n //result:\n {\n username: \"superuser\",\n fullname: \"John\"\n }\n //isSingle = true\n $('#username').editable('getValue', true);\n //result \"superuser\" \n **/\n case 'getValue':\n if(arguments.length === 2 && arguments[1] === true) { //isSingle = true\n result = this.eq(0).data(datakey).value;\n } else {\n this.each(function () {\n var $this = $(this), data = $this.data(datakey);\n if (data && data.value !== undefined && data.value !== null) {\n result[data.options.name] = data.input.value2submit(data.value);\n }\n });\n }\n return result;\n\n /**\n This method collects values from several editable elements and submit them all to server. \n Internally it runs client-side validation for all fields and submits only in case of success. \n See <a href=\"#newrecord\">creating new records</a> for details. \n Since 1.5.1 `submit` can be applied to single element to send data programmatically. In that case\n `url`, `success` and `error` is taken from initial options and you can just call `$('#username').editable('submit')`. \n \n @method submit(options)\n @param {object} options \n @param {object} options.url url to submit data \n @param {object} options.data additional data to submit\n @param {object} options.ajaxOptions additional ajax options\n @param {function} options.error(obj) error handler \n @param {function} options.success(obj,config) success handler\n @returns {Object} jQuery object\n **/\n case 'submit': //collects value, validate and submit to server for creating new record\n var config = arguments[1] || {},\n $elems = this,\n errors = this.editable('validate');\n\n // validation ok\n if($.isEmptyObject(errors)) {\n var ajaxOptions = {};\n \n // for single element use url, success etc from options\n if($elems.length === 1) {\n var editable = $elems.data('editable');\n //standard params\n var params = {\n name: editable.options.name || '',\n value: editable.input.value2submit(editable.value),\n pk: (typeof editable.options.pk === 'function') ? \n editable.options.pk.call(editable.options.scope) : \n editable.options.pk \n };\n\n //additional params\n if(typeof editable.options.params === 'function') {\n params = editable.options.params.call(editable.options.scope, params); \n } else {\n //try parse json in single quotes (from data-params attribute)\n editable.options.params = $.fn.editableutils.tryParseJson(editable.options.params, true); \n $.extend(params, editable.options.params);\n }\n\n ajaxOptions = {\n url: editable.options.url,\n data: params,\n type: 'POST' \n };\n \n // use success / error from options \n config.success = config.success || editable.options.success;\n config.error = config.error || editable.options.error;\n \n // multiple elements\n } else {\n var values = this.editable('getValue'); \n \n ajaxOptions = {\n url: config.url,\n data: values, \n type: 'POST'\n }; \n } \n\n // ajax success callabck (response 200 OK)\n ajaxOptions.success = typeof config.success === 'function' ? function(response) {\n config.success.call($elems, response, config);\n } : $.noop;\n \n // ajax error callabck\n ajaxOptions.error = typeof config.error === 'function' ? function() {\n config.error.apply($elems, arguments);\n } : $.noop;\n \n // extend ajaxOptions \n if(config.ajaxOptions) { \n $.extend(ajaxOptions, config.ajaxOptions);\n }\n \n // extra data \n if(config.data) {\n $.extend(ajaxOptions.data, config.data);\n } \n \n // perform ajax request\n $.ajax(ajaxOptions);\n } else { //client-side validation error\n if(typeof config.error === 'function') {\n config.error.call($elems, errors);\n }\n }\n return this;\n }\n\n //return jquery object\n return this.each(function () {\n var $this = $(this), \n data = $this.data(datakey), \n options = typeof option === 'object' && option;\n\n //for delegated targets do not store `editable` object for element\n //it's allows several different selectors.\n //see: https://github.com/vitalets/x-editable/issues/312 \n if(options && options.selector) {\n data = new Editable(this, options);\n return; \n } \n \n if (!data) {\n $this.data(datakey, (data = new Editable(this, options)));\n }\n\n if (typeof option === 'string') { //call method \n data[option].apply(data, Array.prototype.slice.call(args, 1));\n } \n });\n }; \n \n\n $.fn.editable.defaults = {\n /**\n Type of input. Can be <code>text|textarea|select|date|checklist</code> and more\n\n @property type \n @type string\n @default 'text'\n **/\n type: 'text', \n /**\n Sets disabled state of editable\n\n @property disabled \n @type boolean\n @default false\n **/ \n disabled: false,\n /**\n How to toggle editable. Can be <code>click|dblclick|mouseenter|manual</code>. \n When set to <code>manual</code> you should manually call <code>show/hide</code> methods of editable. \n **Note**: if you call <code>show</code> or <code>toggle</code> inside **click** handler of some DOM element, \n you need to apply <code>e.stopPropagation()</code> because containers are being closed on any click on document.\n \n @example\n $('#edit-button').click(function(e) {\n e.stopPropagation();\n $('#username').editable('toggle');\n });\n\n @property toggle \n @type string\n @default 'click'\n **/ \n toggle: 'click',\n /**\n Text shown when element is empty.\n\n @property emptytext \n @type string\n @default 'Empty'\n **/ \n emptytext: 'Empty',\n /**\n Allows to automatically set element's text based on it's value. Can be <code>auto|always|never</code>. Useful for select and date.\n For example, if dropdown list is <code>{1: 'a', 2: 'b'}</code> and element's value set to <code>1</code>, it's html will be automatically set to <code>'a'</code>. \n <code>auto</code> - text will be automatically set only if element is empty. \n <code>always|never</code> - always(never) try to set element's text.\n\n @property autotext \n @type string\n @default 'auto'\n **/ \n autotext: 'auto', \n /**\n Initial value of input. If not set, taken from element's text. \n Note, that if element's text is empty - text is automatically generated from value and can be customized (see `autotext` option). \n For example, to display currency sign:\n @example\n <a id=\"price\" data-type=\"text\" data-value=\"100\"></a>\n <script>\n $('#price').editable({\n ...\n display: function(value) {\n $(this).text(value + '$');\n } \n }) \n </script>\n \n @property value \n @type mixed\n @default element's text\n **/\n value: null,\n /**\n Callback to perform custom displaying of value in element's text. \n If `null`, default input's display used. \n If `false`, no displaying methods will be called, element's text will never change. \n Runs under element's scope. \n _**Parameters:**_ \n \n * `value` current value to be displayed\n * `response` server response (if display called after ajax submit), since 1.4.0\n \n For _inputs with source_ (select, checklist) parameters are different: \n \n * `value` current value to be displayed\n * `sourceData` array of items for current input (e.g. dropdown items) \n * `response` server response (if display called after ajax submit), since 1.4.0\n \n To get currently selected items use `$.fn.editableutils.itemsByValue(value, sourceData)`.\n \n @property display \n @type function|boolean\n @default null\n @since 1.2.0\n @example\n display: function(value, sourceData) {\n //display checklist as comma-separated values\n var html = [],\n checked = $.fn.editableutils.itemsByValue(value, sourceData);\n \n if(checked.length) {\n $.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); });\n $(this).html(html.join(', '));\n } else {\n $(this).empty(); \n }\n }\n **/ \n display: null,\n /**\n Css class applied when editable text is empty.\n\n @property emptyclass \n @type string\n @since 1.4.1 \n @default editable-empty\n **/ \n emptyclass: 'editable-empty',\n /**\n Css class applied when value was stored but not sent to server (`pk` is empty or `send = 'never'`). \n You may set it to `null` if you work with editables locally and submit them together. \n\n @property unsavedclass \n @type string\n @since 1.4.1 \n @default editable-unsaved\n **/ \n unsavedclass: 'editable-unsaved',\n /**\n If selector is provided, editable will be delegated to the specified targets. \n Usefull for dynamically generated DOM elements. \n **Please note**, that delegated targets can't be initialized with `emptytext` and `autotext` options, \n as they actually become editable only after first click. \n You should manually set class `editable-click` to these elements. \n Also, if element originally empty you should add class `editable-empty`, set `data-value=\"\"` and write emptytext into element:\n\n @property selector \n @type string\n @since 1.4.1 \n @default null\n @example\n <div id=\"user\">\n <!-- empty -->\n <a href=\"#\" data-name=\"username\" data-type=\"text\" class=\"editable-click editable-empty\" data-value=\"\" title=\"Username\">Empty</a>\n <!-- non-empty -->\n <a href=\"#\" data-name=\"group\" data-type=\"select\" data-source=\"/groups\" data-value=\"1\" class=\"editable-click\" title=\"Group\">Operator</a>\n </div> \n \n <script>\n $('#user').editable({\n selector: 'a',\n url: '/post',\n pk: 1\n });\n </script>\n **/ \n selector: null,\n /**\n Color used to highlight element after update. Implemented via CSS3 transition, works in modern browsers.\n \n @property highlight \n @type string|boolean\n @since 1.4.5 \n @default #FFFF80 \n **/\n highlight: '#FFFF80'\n };\n \n // Return the jQuery object with attached editable functionality\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/element/editable-element.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/abstract.js":
|
|
/*!********************************!*\
|
|
!*** ./src/inputs/abstract.js ***!
|
|
\********************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nAbstractInput - base class for all editable inputs.\nIt defines interface to be implemented by any input type.\nTo create your own input you can inherit from this class.\n\n@class abstractinput\n**/\n\nfunction attachAbstractInput($) {\n \"use strict\";\n\n //types\n $.fn.editabletypes = {};\n\n var AbstractInput = function () { };\n\n AbstractInput.prototype = {\n /**\n Initializes input\n\n @method init() \n **/\n init: function(type, options, defaults) {\n this.type = type;\n this.options = $.extend({}, defaults, options);\n },\n\n /*\n this method called before render to init $tpl that is inserted in DOM\n */\n prerender: function() {\n this.$tpl = $(this.options.tpl); //whole tpl as jquery object \n this.$input = this.$tpl; //control itself, can be changed in render method\n this.$clear = null; //clear button\n this.error = null; //error message, if input cannot be rendered \n },\n \n /**\n Renders input from tpl. Can return jQuery deferred object.\n Can be overwritten in child objects\n\n @method render()\n **/\n render: function() {\n\n }, \n\n /**\n Sets element's html by value. \n\n @method value2html(value, element)\n @param {mixed} value\n @param {DOMElement} element\n **/\n value2html: function(value, element) {\n $(element)[this.options.escape ? 'text' : 'html'](value.trim());\n },\n\n /**\n Converts element's html to value\n\n @method html2value(html)\n @param {string} html\n @returns {mixed}\n **/\n html2value: function(html) {\n return $('<div>').html(html).text();\n },\n\n /**\n Converts value to string (for internal compare). For submitting to server used value2submit().\n\n @method value2str(value) \n @param {mixed} value\n @returns {string}\n **/\n value2str: function(value) {\n return value;\n }, \n\n /**\n Converts string received from server into value. Usually from `data-value` attribute.\n\n @method str2value(str)\n @param {string} str\n @returns {mixed}\n **/\n str2value: function(str) {\n return str;\n }, \n \n /**\n Converts value for submitting to server. Result can be string or object.\n\n @method value2submit(value) \n @param {mixed} value\n @returns {mixed}\n **/\n value2submit: function(value) {\n return value;\n },\n\n /**\n Sets value of input.\n\n @method value2input(value) \n @param {mixed} value\n **/\n value2input: function(value) {\n this.$input.val(value);\n },\n\n /**\n Returns value of input. Value can be object (e.g. datepicker)\n\n @method input2value() \n **/\n input2value: function() { \n return this.$input.val();\n }, \n\n /**\n Activates input. For text it sets focus.\n\n @method activate() \n **/\n activate: function() {\n if(this.$input.is(':visible')) {\n this.$input.focus();\n }\n },\n\n /**\n Creates input.\n\n @method clear() \n **/ \n clear: function() {\n this.$input.val(null);\n },\n\n /**\n method to escape html.\n **/\n escape: function(str) {\n return $('<div>').text(str).html();\n },\n \n /**\n attach handler to automatically submit form when value changed (useful when buttons not shown)\n **/\n autosubmit: function() {\n \n },\n \n /**\n Additional actions when destroying element \n **/\n destroy: function() {\n },\n\n // -------- helper functions --------\n setClass: function() { \n if(this.options.inputclass) {\n this.$input.addClass(this.options.inputclass); \n } \n },\n\n setAttr: function(attr) {\n if (this.options[attr] !== undefined && this.options[attr] !== null) {\n this.$input.attr(attr, this.options[attr]);\n } \n },\n \n option: function(key, value) {\n this.options[key] = value;\n }\n \n };\n \n AbstractInput.defaults = { \n /**\n HTML template of input. Normally you should not change it.\n\n @property tpl \n @type string\n @default ''\n **/ \n tpl: '',\n /**\n CSS class automatically applied to input\n \n @property inputclass \n @type string\n @default null\n **/ \n inputclass: null,\n \n /**\n If `true` - html will be escaped in content of element via $.text() method. \n If `false` - html will not be escaped, $.html() used. \n When you use own `display` function, this option obviosly has no effect.\n \n @property escape \n @type boolean\n @since 1.5.0\n @default true\n **/ \n escape: true,\n \n //scope for external methods (e.g. source defined as function)\n //for internal use only\n scope: null,\n \n //need to re-declare showbuttons here to get it's value from common config (passed only options existing in defaults)\n showbuttons: true \n };\n \n $.extend($.fn.editabletypes, {abstractinput: AbstractInput});\n \n // Return the jQuery object with attached abstract input\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/inputs/abstract.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/date/date.js":
|
|
/*!*********************************!*\
|
|
!*** ./src/inputs/date/date.js ***!
|
|
\*********************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nBootstrap-datepicker. \nDescription and examples: https://github.com/eternicode/bootstrap-datepicker. \nFor **i18n** you should include js file from here: https://github.com/eternicode/bootstrap-datepicker/tree/master/js/locales\nand set `language` option. \nSince 1.4.0 date has different appearance in **popup** and **inline** modes. \n\n@class date\n@extends abstractinput\n@final\n@example\n<a href=\"#\" id=\"dob\" data-type=\"date\" data-pk=\"1\" data-url=\"/post\" data-title=\"Select date\">15/05/1984</a>\n<script>\n$(function(){\n $('#dob').editable({\n format: 'yyyy-mm-dd', \n viewformat: 'dd/mm/yyyy', \n datepicker: {\n weekStart: 1\n }\n }\n });\n});\n</script>\n**/\nfunction attachDate($) {\n \"use strict\";\n \n \n var Date = function (options) {\n console.log('Date input constructor called');\n this.init('date', options, Date.defaults);\n this.initPicker(options, Date.defaults);\n \n // Ensure type is set correctly\n this.type = 'date';\n console.log('Date input initialized');\n };\n\n $.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput); \n \n $.extend(Date.prototype, {\n prerender: function() {\n // Call parent prerender\n Date.superclass.prerender.call(this);\n },\n \n initPicker: function(options, defaults) {\n //'format' is set directly from settings or data-* attributes\n\n //by default viewformat equals to format\n if(!this.options.viewformat) {\n this.options.viewformat = this.options.format;\n }\n \n //try parse datepicker config defined as json string in data-datepicker\n options.datepicker = $.fn.editableutils.tryParseJson(options.datepicker, true);\n \n //overriding datepicker config (as by default jQuery extend() is not recursive)\n //since 1.4 datepicker internally uses viewformat instead of format. Format is for submit only\n this.options.datepicker = $.extend({}, defaults.datepicker, options.datepicker, {\n format: this.options.viewformat\n });\n \n //language\n this.options.datepicker.language = this.options.datepicker.language || 'en'; \n\n //store DPglobal - ensure bootstrap-datepicker is available\n if (!$.fn.datepicker || !$.fn.datepicker.DPGlobal) {\n console.error('Bootstrap-datepicker not found or DPGlobal not available');\n console.error('Please include bootstrap-datepicker.js and bootstrap-datepicker.css in your page');\n // Set error state instead of throwing\n this.error = 'Bootstrap-datepicker is required but not found. Please include bootstrap-datepicker.js and bootstrap-datepicker.css';\n return;\n }\n this.dpg = $.fn.datepicker.DPGlobal; \n\n //store parsed formats\n this.parsedFormat = this.dpg.parseFormat(this.options.format);\n this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat); \n },\n \n render: function () {\n console.log('Date render method called');\n // Ensure we have an input element\n if (!this.$input || !this.$input.length) {\n console.log('Date render: No input element found');\n return;\n }\n \n console.log('Date render: Input element found');\n \n // Initialize datepicker immediately\n try {\n this.$input.datepicker(this.options.datepicker);\n console.log('Date render: Datepicker initialized');\n \n // Force set the initial value if we have one\n if (this.value) {\n this.$input.datepicker('setDate', this.value);\n }\n } catch (error) {\n console.log('Date render: Datepicker error:', error);\n }\n \n // Use a more aggressive approach - hide buttons with multiple methods\n var self = this;\n setTimeout(function() {\n // Try multiple selectors to find buttons\n var $buttons = self.$form ? self.$form.find('.editable-buttons') : $();\n if ($buttons.length === 0) {\n $buttons = self.$tpl.closest('.editableform').find('.editable-buttons');\n }\n if ($buttons.length === 0) {\n $buttons = self.$tpl.closest('.editable-container').find('.editable-buttons');\n }\n \n console.log('Date render: Found buttons:', $buttons.length);\n if ($buttons.length > 0) {\n $buttons.hide();\n $buttons.css('display', 'none');\n console.log('Date render: Hidden buttons');\n }\n }, 100);\n \n //\"clear\" link\n if(this.options.clear) {\n this.$clear = $('<a href=\"#\"></a>').html(this.options.clear).click($.proxy(function(e){\n e.preventDefault();\n e.stopPropagation();\n this.clear();\n }, this));\n \n this.$tpl.parent().append($('<div class=\"editable-clear\">').append(this.$clear)); \n } \n },\n \n value2html: function(value, element) {\n var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';\n Date.superclass.value2html.call(this, text, element); \n },\n\n html2value: function(html) {\n return this.parseDate(html, this.parsedViewFormat);\n }, \n\n value2str: function(value) {\n return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';\n }, \n\n str2value: function(str) {\n return this.parseDate(str, this.parsedFormat);\n }, \n\n value2submit: function(value) {\n return this.value2str(value);\n }, \n\n value2input: function(value) {\n // Ensure datepicker is initialized before trying to update\n if (!this.$input.data('datepicker')) {\n this.$input.datepicker(this.options.datepicker);\n }\n \n this.$input.datepicker('update', value);\n },\n\n input2value: function() { \n var datepicker = this.$input.data('datepicker');\n \n if (datepicker) {\n if (datepicker.date) {\n return datepicker.date;\n }\n \n // Try getting date from dates array\n if (datepicker.dates && datepicker.dates.length > 0) {\n return datepicker.dates[0];\n }\n \n // Try using getDate method\n if (typeof datepicker.getDate === 'function') {\n var dateFromMethod = datepicker.getDate();\n return dateFromMethod;\n }\n }\n \n // Fallback: try to parse the input value directly\n var inputVal = this.$input.val();\n if (inputVal) {\n var parsedDate = this.parseDate(inputVal, this.parsedViewFormat);\n return parsedDate;\n }\n \n return null;\n }, \n\n activate: function() {\n },\n\n clear: function() {\n this.$input.data('datepicker').date = null;\n this.$input.find('.active').removeClass('active');\n if(!this.options.showbuttons) {\n this.$input.closest('form').submit(); \n }\n },\n\n autosubmit: function() {\n // Override default autosubmit behavior for datepicker workflow\n // Show buttons only after date selection\n this.$input.on('changeDate', $.proxy(function(e) {\n console.log('Date changeDate event triggered');\n // Hide the datepicker\n this.$input.datepicker('hide');\n // Show save/cancel buttons after date selection\n setTimeout($.proxy(function() {\n if (this.options.showbuttons !== false) {\n var $buttons = this.$form ? this.$form.find('.editable-buttons') : $();\n if ($buttons.length === 0) {\n $buttons = this.$tpl.closest('.editableform').find('.editable-buttons');\n }\n if ($buttons.length === 0) {\n $buttons = this.$tpl.closest('.editable-container').find('.editable-buttons');\n }\n \n console.log('Date changeDate: Found buttons to show:', $buttons.length);\n $buttons.show();\n $buttons.css('display', 'inline-block');\n }\n }, this), 100);\n }, this));\n \n // Keep the original click behavior as backup\n this.$input.on('mouseup', '.day', function(e){\n if($(e.currentTarget).is('.old') || $(e.currentTarget).is('.new')) {\n return;\n }\n console.log('Date mouseup on day');\n var $form = $(this).closest('form');\n setTimeout(function() {\n $form.find('.editable-buttons').show();\n }, 200);\n });\n },\n \n /*\n For incorrect date bootstrap-datepicker returns current date that is not suitable\n for datefield.\n This function returns null for incorrect date. \n */\n parseDate: function(str, format) {\n var date = null, formattedBack;\n if(str) {\n date = this.dpg.parseDate(str, format, this.options.datepicker.language);\n if(typeof str === 'string') {\n formattedBack = this.dpg.formatDate(date, format, this.options.datepicker.language);\n if(str !== formattedBack) {\n date = null;\n }\n }\n }\n return date;\n }\n\n });\n\n Date.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n @property tpl \n @default <div></div>\n **/ \n tpl:'<div class=\"editable-date well\"></div>',\n /**\n @property inputclass \n @default null\n **/\n inputclass: null,\n /**\n Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>\n Possible tokens are: <code>d, dd, m, mm, yy, yyyy</code> \n\n @property format \n @type string\n @default yyyy-mm-dd\n **/\n format:'yyyy-mm-dd',\n /**\n Format used for displaying date. Also applied when converting date from element's text on init. \n If not specified equals to <code>format</code>\n\n @property viewformat \n @type string\n @default null\n **/\n viewformat: null,\n /**\n Configuration of datepicker.\n Full list of options: http://bootstrap-datepicker.readthedocs.org/en/latest/options.html\n\n @property datepicker \n @type object\n @default {\n weekStart: 0,\n startView: 0,\n minViewMode: 0,\n autoclose: false\n }\n **/\n datepicker:{\n weekStart: 0,\n startView: 0,\n minViewMode: 0,\n autoclose: false\n },\n /**\n Text shown as clear date button. \n If <code>false</code> clear button will not be rendered.\n\n @property clear \n @type boolean|string\n @default 'x clear'\n **/\n clear: '× clear'\n });\n\n $.fn.editabletypes.date = Date;\n\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/inputs/date/date.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/date/datefield.js":
|
|
/*!**************************************!*\
|
|
!*** ./src/inputs/date/datefield.js ***!
|
|
\**************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nBootstrap datefield input - modification for inline mode.\nShows normal <input type=\"text\"> and binds popup datepicker. \nAutomatically shown in inline mode.\n\n@class datefield\n@extends date\n\n@since 1.4.0\n**/\nfunction attachDateField($) {\n \"use strict\";\n \n var DateField = function (options) {\n this.init('datefield', options, DateField.defaults);\n this.initPicker(options, DateField.defaults);\n \n // Ensure type is set correctly\n this.type = 'datefield';\n };\n\n $.fn.editableutils.inherit(DateField, $.fn.editabletypes.date); \n \n $.extend(DateField.prototype, {\n render: function () {\n this.$input = this.$tpl.find('input');\n this.setClass();\n this.setAttr('placeholder');\n \n //use datepicker instead of bdatepicker \n this.$tpl.datepicker(this.options.datepicker);\n \n //need to disable original event handlers\n this.$input.off('focus keydown');\n \n // Hide buttons initially for datepicker workflow\n var self = this;\n setTimeout(function() {\n if (!self.$form) {\n // Find buttons in the broader DOM and hide them directly\n var $allButtons = $('.editable-buttons:visible');\n if ($allButtons.length > 0) {\n $allButtons.each(function(i, btn) {\n // Directly hide this button for datepicker\n var $btn = $(btn);\n $btn.hide();\n $btn.css('display', 'none !important');\n $btn.addClass('datepicker-hidden');\n \n // Store reference for later showing\n self.$dateButtons = $btn;\n });\n }\n }\n }, 500);\n \n //update value of datepicker\n this.$input.keyup($.proxy(function(){\n this.$tpl.removeData('date');\n this.$tpl.datepicker('update');\n }, this));\n \n // Manually call autosubmit to set up our event handlers\n this.autosubmit();\n \n }, \n \n value2input: function(value) {\n var formattedValue = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';\n this.$input.val(formattedValue);\n this.$tpl.datepicker('update');\n },\n \n input2value: function() { \n // First try the container datepicker (ideal case)\n var containerDatepicker = this.$tpl.data('datepicker');\n \n if (containerDatepicker && containerDatepicker.dates && containerDatepicker.dates.length > 0) {\n return containerDatepicker.dates[0];\n }\n \n // Fallback: try the input datepicker (in case manual init worked)\n var inputDatepicker = this.$input.data('datepicker');\n \n if (inputDatepicker && inputDatepicker.dates && inputDatepicker.dates.length > 0) {\n return inputDatepicker.dates[0];\n }\n \n // Try getDate methods\n if (containerDatepicker && typeof containerDatepicker.getDate === 'function') {\n var containerDate = containerDatepicker.getDate();\n if (containerDate) {\n return containerDate;\n }\n }\n \n if (inputDatepicker && typeof inputDatepicker.getDate === 'function') {\n var inputDate = inputDatepicker.getDate();\n if (inputDate) {\n return inputDate;\n }\n }\n \n // Final fallback to text parsing\n return this.html2value(this.$input.val());\n }, \n \n activate: function() {\n $.fn.editabletypes.text.prototype.activate.call(this);\n },\n \n autosubmit: function() {\n // Override default autosubmit behavior for datepicker workflow\n // We handle this manually with changeDate event\n \n // Setup the manual workflow: show buttons only after date selection\n this.$tpl.on('changeDate', $.proxy(function(e) {\n // Hide the datepicker using multiple methods to ensure it closes\n setTimeout($.proxy(function() {\n // Try datepicker hide methods\n try {\n this.$tpl.datepicker('hide');\n } catch(err) {\n // Fallback to input method\n }\n \n try {\n this.$input.datepicker('hide');\n } catch(err) {\n // Continue to force methods\n }\n \n // Force hide all datepicker elements\n $('.datepicker').hide();\n $('.datepicker-dropdown').hide();\n \n // Ensure any remaining visible datepickers are hidden\n var $visiblePicker = $('.datepicker:visible, .datepicker-dropdown:visible');\n if ($visiblePicker.length > 0) {\n $visiblePicker.css('display', 'none !important');\n $visiblePicker.css('visibility', 'hidden');\n }\n }, this), 10);\n \n // Show save/cancel buttons after date selection\n setTimeout($.proxy(function() {\n if (this.options.showbuttons !== false) {\n var $buttons = this.$dateButtons || $('.editable-buttons.datepicker-hidden');\n if ($buttons.length === 0) {\n $buttons = this.$form ? this.$form.find('.editable-buttons') : $();\n }\n if ($buttons.length === 0) {\n $buttons = this.$tpl.closest('.editableform').find('.editable-buttons');\n }\n if ($buttons.length === 0) {\n $buttons = this.$tpl.closest('.editable-container').find('.editable-buttons');\n }\n \n $buttons.show();\n $buttons.css('display', 'inline-flex');\n $buttons.addClass('show-buttons');\n $buttons.removeClass('datepicker-hidden');\n }\n }, this), 100);\n }, this));\n \n // Do NOT call parent autosubmit to prevent immediate form submission\n }\n });\n \n DateField.defaults = $.extend({}, $.fn.editabletypes.date.defaults, {\n /**\n @property tpl \n **/ \n tpl:'<div class=\"input-group input-group-sm date datepicker-above\" style=\"width: 200px; border: 1px solid #dee2e6; border-radius: 0.375rem; position: relative;\"><input type=\"text\" class=\"form-control form-control-sm\" style=\"border: none;\"/><span class=\"input-group-text\" style=\"border: none; background: transparent;\"><i class=\"bi bi-calendar\"></i></span></div>',\n /**\n @property inputclass \n @default 'form-control form-control-sm'\n **/ \n inputclass: 'form-control form-control-sm',\n \n /* datepicker config */\n datepicker: {\n weekStart: 0,\n startView: 0,\n minViewMode: 0,\n autoclose: true,\n orientation: 'top',\n container: 'body'\n }\n });\n \n $.fn.editabletypes.datefield = DateField;\n\n return $;\n}\n\n//# sourceURL=webpack://EditableForm/./src/inputs/date/datefield.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/list.js":
|
|
/*!****************************!*\
|
|
!*** ./src/inputs/list.js ***!
|
|
\****************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nList - abstract class for inputs that have source option loaded from js array or via ajax\n\n@class list\n@extends abstractinput\n**/\n\nfunction attachList($) {\n \"use strict\";\n \n var List = function (options) {\n \n };\n\n $.fn.editableutils.inherit(List, $.fn.editabletypes.abstractinput);\n\n $.extend(List.prototype, {\n render: function () {\n\n var deferred = $.Deferred();\n\n this.error = null;\n this.onSourceReady(function () {\n this.renderList();\n deferred.resolve();\n }, function () {\n this.error = this.options.sourceError;\n deferred.resolve();\n });\n\n return deferred.promise();\n },\n\n html2value: function (html) {\n return null; //can't set value by text\n },\n \n value2html: function (value, element, display, response) {\n var deferred = $.Deferred(),\n success = function () {\n if(typeof display === 'function') {\n //custom display method\n display.call(element, value, this.sourceData, response); \n } else {\n this.value2htmlFinal(value, element);\n }\n deferred.resolve();\n };\n \n //for null value just call success without loading source\n if(value === null) {\n success.call(this); \n } else {\n this.onSourceReady(success, function () { deferred.resolve(); });\n }\n\n return deferred.promise();\n }, \n\n // ------------- additional functions ------------\n\n onSourceReady: function (success, error) {\n //run source if it function\n var source;\n if (typeof(this.options.source) === 'function') {\n source = this.options.source.call(this.options.scope);\n this.sourceData = null;\n //note: if function returns the same source as URL - sourceData will be taken from cahce and no extra request performed\n } else {\n source = this.options.source;\n } \n \n //if allready loaded just call success\n if(this.options.sourceCache && Array.isArray(this.sourceData)) {\n success.call(this);\n return; \n }\n\n //try parse json in single quotes (for double quotes jquery does automatically)\n try {\n source = $.fn.editableutils.tryParseJson(source, false);\n } catch (e) {\n error.call(this);\n return;\n }\n\n //loading from url\n if (typeof source === 'string') {\n //try to get sourceData from cache\n if(this.options.sourceCache) {\n var cacheID = source,\n cache;\n\n if (!$(document).data(cacheID)) {\n $(document).data(cacheID, {});\n }\n cache = $(document).data(cacheID);\n\n //check for cached data\n if (cache.loading === false && cache.sourceData) { //take source from cache\n this.sourceData = cache.sourceData;\n this.doPrepend();\n success.call(this);\n return;\n } else if (cache.loading === true) { //cache is loading, put callback in stack to be called later\n cache.callbacks.push($.proxy(function () {\n this.sourceData = cache.sourceData;\n this.doPrepend();\n success.call(this);\n }, this));\n\n //also collecting error callbacks\n cache.err_callbacks.push($.proxy(error, this));\n return;\n } else { //no cache yet, activate it\n cache.loading = true;\n cache.callbacks = [];\n cache.err_callbacks = [];\n }\n }\n \n //ajaxOptions for source. Can be overwritten bt options.sourceOptions\n var ajaxOptions = $.extend({\n url: source,\n type: 'get',\n cache: false,\n dataType: 'json',\n success: $.proxy(function (data) {\n if(cache) {\n cache.loading = false;\n }\n this.sourceData = this.makeArray(data);\n if(Array.isArray(this.sourceData)) {\n if(cache) {\n //store result in cache\n cache.sourceData = this.sourceData;\n //run success callbacks for other fields waiting for this source\n $.each(cache.callbacks, function () { this.call(); }); \n }\n this.doPrepend();\n success.call(this);\n } else {\n error.call(this);\n if(cache) {\n //run error callbacks for other fields waiting for this source\n $.each(cache.err_callbacks, function () { this.call(); }); \n }\n }\n }, this),\n error: $.proxy(function () {\n error.call(this);\n if(cache) {\n cache.loading = false;\n //run error callbacks for other fields\n $.each(cache.err_callbacks, function () { this.call(); }); \n }\n }, this)\n }, this.options.sourceOptions);\n \n //loading sourceData from server\n $.ajax(ajaxOptions);\n \n } else { //options as json/array\n this.sourceData = this.makeArray(source);\n \n if(Array.isArray(this.sourceData)) {\n this.doPrepend();\n success.call(this); \n } else {\n error.call(this);\n }\n }\n },\n\n doPrepend: function () {\n if(this.options.prepend === null || this.options.prepend === undefined) {\n return; \n }\n \n if(!Array.isArray(this.prependData)) {\n //run prepend if it is function (once)\n if (typeof (this.options.prepend) === 'function') {\n this.options.prepend = this.options.prepend.call(this.options.scope);\n }\n \n //try parse json in single quotes\n this.options.prepend = $.fn.editableutils.tryParseJson(this.options.prepend, true);\n \n //convert prepend from string to object\n if (typeof this.options.prepend === 'string') {\n this.options.prepend = {'': this.options.prepend};\n }\n \n this.prependData = this.makeArray(this.options.prepend);\n }\n\n if(Array.isArray(this.prependData) && Array.isArray(this.sourceData)) {\n this.sourceData = this.prependData.concat(this.sourceData);\n }\n },\n\n /*\n renders input list\n */\n renderList: function() {\n // this method should be overwritten in child class\n },\n \n /*\n set element's html by value\n */\n value2htmlFinal: function(value, element) {\n // this method should be overwritten in child class\n }, \n\n /**\n * convert data to array suitable for sourceData, e.g. [{value: 1, text: 'abc'}, {...}]\n */\n makeArray: function(data) {\n var count, obj, result = [], item, iterateItem;\n if(!data || typeof data === 'string') {\n return null; \n }\n\n if(Array.isArray(data)) { //array\n /* \n function to iterate inside item of array if item is object.\n Caclulates count of keys in item and store in obj. \n */\n iterateItem = function (k, v) {\n obj = {value: k, text: v};\n if(count++ >= 2) {\n return false;// exit from `each` if item has more than one key.\n }\n };\n \n for(var i = 0; i < data.length; i++) {\n item = data[i]; \n if(typeof item === 'object') {\n count = 0; //count of keys inside item\n $.each(item, iterateItem);\n //case: [{val1: 'text1'}, {val2: 'text2} ...]\n if(count === 1) { \n result.push(obj); \n //case: [{value: 1, text: 'text1'}, {value: 2, text: 'text2'}, ...]\n } else if(count > 1) {\n //removed check of existance: item.hasOwnProperty('value') && item.hasOwnProperty('text')\n if(item.children) {\n item.children = this.makeArray(item.children); \n }\n result.push(item);\n }\n } else {\n //case: ['text1', 'text2' ...]\n result.push({value: item, text: item}); \n }\n }\n } else { //case: {val1: 'text1', val2: 'text2, ...}\n $.each(data, function (k, v) {\n result.push({value: k, text: v});\n }); \n }\n return result;\n },\n \n option: function(key, value) {\n this.options[key] = value;\n if(key === 'source') {\n this.sourceData = null;\n }\n if(key === 'prepend') {\n this.prependData = null;\n } \n } \n\n }); \n\n List.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n Source data for list. \n If **array** - it should be in format: `[{value: 1, text: \"text1\"}, {value: 2, text: \"text2\"}, ...]` \n For compability, object format is also supported: `{\"1\": \"text1\", \"2\": \"text2\" ...}` but it does not guarantee elements order.\n \n If **string** - considered ajax url to load items. In that case results will be cached for fields with the same source and name. See also `sourceCache` option.\n \n If **function**, it should return data in format above (since 1.4.0).\n \n Since 1.4.1 key `children` supported to render OPTGROUP (for **select** input only). \n `[{text: \"group1\", children: [{value: 1, text: \"text1\"}, {value: 2, text: \"text2\"}]}, ...]` \n\n\t\t\n @property source \n @type string | array | object | function\n @default null\n **/ \n source: null, \n /**\n Data automatically prepended to the beginning of dropdown list.\n \n @property prepend \n @type string | array | object | function\n @default false\n **/ \n prepend: false,\n /**\n Error message when list cannot be loaded (e.g. ajax error)\n \n @property sourceError \n @type string\n @default Error when loading list\n **/ \n sourceError: 'Error when loading list',\n /**\n if <code>true</code> and source is **string url** - results will be cached for fields with the same source. \n Usefull for editable column in grid to prevent extra requests.\n \n @property sourceCache \n @type boolean\n @default true\n @since 1.2.0\n **/ \n sourceCache: true,\n /**\n Additional ajax options to be used in $.ajax() when loading list from server.\n Useful to send extra parameters (`data` key) or change request method (`type` key).\n \n @property sourceOptions \n @type object|function\n @default null\n @since 1.5.0\n **/ \n sourceOptions: null\n });\n\n $.fn.editabletypes.list = List;\n \n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/inputs/list.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/select.js":
|
|
/*!******************************!*\
|
|
!*** ./src/inputs/select.js ***!
|
|
\******************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nSelect (dropdown)\n\n@class select\n@extends list\n@final\n@example\n<a href=\"#\" id=\"status\" data-type=\"select\" data-pk=\"1\" data-url=\"/post\" data-title=\"Select status\"></a>\n<script>\n$(function(){\n $('#status').editable({\n value: 2, \n source: [\n {value: 1, text: 'Active'},\n {value: 2, text: 'Blocked'},\n {value: 3, text: 'Deleted'}\n ]\n });\n});\n</script>\n**/\nfunction attachSelect($) {\n \"use strict\";\n \n var Select = function (options) {\n this.init('select', options, Select.defaults);\n };\n\n $.fn.editableutils.inherit(Select, $.fn.editabletypes.list);\n\n $.extend(Select.prototype, {\n renderList: function() {\n this.$input.empty();\n\n var fillItems = function($el, data) {\n var attr;\n if(Array.isArray(data)) {\n for(var i=0; i<data.length; i++) {\n attr = {};\n if(data[i].children) {\n attr.label = data[i].text;\n $el.append(fillItems($('<optgroup>', attr), data[i].children)); \n } else {\n attr.value = data[i].value;\n if(data[i].disabled) {\n attr.disabled = true;\n }\n $el.append($('<option>', attr).text(data[i].text)); \n }\n }\n }\n return $el;\n }; \n\n fillItems(this.$input, this.sourceData);\n \n this.setClass();\n \n //enter submit\n this.$input.on('keydown.editable', function (e) {\n if (e.which === 13) {\n $(this).closest('form').submit();\n }\n }); \n },\n \n value2htmlFinal: function(value, element) {\n var text = '', \n items = $.fn.editableutils.itemsByValue(value, this.sourceData);\n \n if(items.length) {\n text = items[0].text;\n }\n \n //$(element).text(text);\n $.fn.editabletypes.abstractinput.prototype.value2html.call(this, text, element);\n },\n \n autosubmit: function() {\n this.$input.off('keydown.editable').on('change.editable', function(){\n $(this).closest('form').submit();\n });\n }\n }); \n\n Select.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {\n /**\n @property tpl \n @default <select></select>\n **/ \n tpl:'<select></select>'\n });\n\n $.fn.editabletypes.select = Select; \n\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/inputs/select.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/select2/select2.js":
|
|
/*!***************************************!*\
|
|
!*** ./src/inputs/select2/select2.js ***!
|
|
\***************************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nSelect2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2. \nPlease see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options. \n \nYou should manually download and include select2 distributive: \n\n <link href=\"select2/select2.css\" rel=\"stylesheet\" type=\"text/css\"></link> \n <script src=\"select2/select2.js\"></script> \n \nTo make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css): \n\n <link href=\"select2-bootstrap.css\" rel=\"stylesheet\" type=\"text/css\"></link> \n \n**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source. \nYou need initially put both `data-value` and element's text youself: \n\n <a href=\"#\" data-type=\"select2\" data-value=\"1\">Text1</a>\n \n \n@class select2\n@extends abstractinput\n@since 1.4.1\n@final\n@example\n<a href=\"#\" id=\"country\" data-type=\"select2\" data-pk=\"1\" data-value=\"ru\" data-url=\"/post\" data-title=\"Select country\"></a>\n<script>\n$(function(){\n //local source\n $('#country').editable({\n source: [\n {id: 'gb', text: 'Great Britain'},\n {id: 'us', text: 'United States'},\n {id: 'ru', text: 'Russia'}\n ],\n select2: {\n multiple: true\n }\n });\n //remote source (simple)\n $('#country').editable({\n source: '/getCountries',\n select2: {\n placeholder: 'Select Country',\n minimumInputLength: 1\n }\n });\n //remote source (advanced)\n $('#country').editable({\n select2: {\n placeholder: 'Select Country',\n allowClear: true,\n minimumInputLength: 3,\n id: function (item) {\n return item.CountryId;\n },\n ajax: {\n url: '/getCountries',\n dataType: 'json',\n data: function (term, page) {\n return { query: term };\n },\n results: function (data, page) {\n return { results: data };\n }\n },\n formatResult: function (item) {\n return item.CountryName;\n },\n formatSelection: function (item) {\n return item.CountryName;\n },\n initSelection: function (element, callback) {\n return $.get('/getCountryById', { query: element.val() }, function (data) {\n callback(data);\n });\n } \n } \n });\n});\n</script>\n**/\nfunction attachSelect2($) {\n \"use strict\";\n \n var Constructor = function (options) {\n this.init('select2', options, Constructor.defaults);\n\n options.select2 = options.select2 || {};\n\n this.sourceData = null;\n \n //placeholder\n if(options.placeholder) {\n options.select2.placeholder = options.placeholder;\n }\n \n //if not `tags` mode, use source\n if(!options.select2.tags && options.source) {\n var source = options.source;\n //if source is function, call it (once!)\n if (typeof (options.source) === 'function') {\n source = options.source.call(options.scope);\n } \n\n if (typeof source === 'string') {\n options.select2.ajax = options.select2.ajax || {};\n //some default ajax params\n if(!options.select2.ajax.data) {\n options.select2.ajax.data = function(term) {return { query:term };};\n }\n if(!options.select2.ajax.results) {\n options.select2.ajax.results = function(data) { return {results:data };};\n }\n options.select2.ajax.url = source;\n } else {\n //check format and convert x-editable format to select2 format (if needed)\n this.sourceData = this.convertSource(source);\n options.select2.data = this.sourceData;\n }\n } \n\n //overriding objects in config (as by default jQuery extend() is not recursive)\n this.options.select2 = $.extend({}, Constructor.defaults.select2, options.select2);\n\n //detect whether it is multi-valued\n this.isMultiple = this.options.select2.tags || this.options.select2.multiple;\n this.isRemote = ('ajax' in this.options.select2);\n\n //store function returning ID of item\n //should be here as used inautotext for local source\n this.idFunc = this.options.select2.id;\n if (typeof(this.idFunc) !== \"function\") {\n var idKey = this.idFunc || 'id';\n this.idFunc = function (e) { return e[idKey]; };\n }\n\n //store function that renders text in select2\n this.formatSelection = this.options.select2.formatSelection;\n if (typeof(this.formatSelection) !== \"function\") {\n this.formatSelection = function (e) { return e.text; };\n }\n };\n\n $.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);\n\n $.extend(Constructor.prototype, {\n render: function() {\n this.setClass();\n\n //can not apply select2 here as it calls initSelection \n //over input that does not have correct value yet.\n //apply select2 only in value2input\n //this.$input.select2(this.options.select2);\n\n //when data is loaded via ajax, we need to know when it's done to populate listData\n if(this.isRemote) {\n //listen to loaded event to populate data\n this.$input.on('select2-loaded', $.proxy(function(e) {\n this.sourceData = e.items.results;\n }, this));\n }\n\n //trigger resize of editableform to re-position container in multi-valued mode\n if(this.isMultiple) {\n this.$input.on('change', function() {\n $(this).closest('form').parent().triggerHandler('resize');\n });\n }\n \n // Fix for Select2 v4.1.0 - manually update value when selection is made\n // This fixes the issue where select2:select event fires but the value doesn't update\n this.$input.on('select2:select', function(e) {\n if (e.params && e.params.data && e.params.data.id !== undefined) {\n $(this).val(e.params.data.id);\n $(this).trigger('change.select2');\n }\n });\n },\n\n value2html: function(value, element) {\n var text = '', data,\n that = this;\n\n if(this.options.select2.tags) { //in tags mode just assign value\n data = value; \n //data = $.fn.editableutils.itemsByValue(value, this.options.select2.tags, this.idFunc);\n } else if(this.sourceData) {\n data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc); \n } else {\n //can not get list of possible values \n //(e.g. autotext for select2 with ajax source)\n }\n\n //data may be array (when multiple values allowed)\n if(Array.isArray(data)) {\n //collect selected data and show with separator\n text = [];\n $.each(data, function(k, v){\n text.push(v && typeof v === 'object' ? that.formatSelection(v) : v);\n });\n } else if(data) {\n text = that.formatSelection(data);\n }\n\n text = Array.isArray(text) ? text.join(this.options.viewseparator) : text;\n\n //$(element).text(text);\n Constructor.superclass.value2html.call(this, text, element); \n },\n\n html2value: function(html) {\n return this.options.select2.tags ? this.str2value(html, this.options.viewseparator) : null;\n },\n\n value2input: function(value) {\n // if value array => join it anyway\n if(Array.isArray(value)) {\n value = value.join(this.getSeparator());\n }\n\n //for remote source just set value, text is updated by initSelection\n if(!this.$input.data('select2')) {\n this.$input.val(value);\n this.$input.select2(this.options.select2);\n } else {\n //Use select2's proper API to set the value instead of just the hidden input\n // Try Select2 v4 API - first set the value, then trigger change\n this.$input.val(value);\n this.$input.trigger('change.select2');\n //second argument needed to separate initial change from user's click (for autosubmit) \n this.$input.trigger('change', true); \n }\n\n // if defined remote source AND no multiple mode AND no user's initSelection provided --> \n // we should somehow get text for provided id.\n // The solution is to use element's text as text for that id (exclude empty)\n if(this.isRemote && !this.isMultiple && !this.options.select2.initSelection) {\n // customId and customText are methods to extract `id` and `text` from data object\n // we can use this workaround only if user did not define these methods\n // otherwise we cant construct data object\n var customId = this.options.select2.id,\n customText = this.options.select2.formatSelection;\n\n if(!customId && !customText) {\n var $el = $(this.options.scope);\n if (!$el.data('editable').isEmpty) {\n var data = {id: value, text: $el.text()};\n this.$input.select2('data', data); \n }\n }\n }\n },\n \n input2value: function() { \n return this.$input.select2('val');\n },\n\n str2value: function(str, separator) {\n if(typeof str !== 'string' || !this.isMultiple) {\n return str;\n }\n\n separator = separator || this.getSeparator();\n\n var val, i, l;\n\n if (str === null || str.length < 1) {\n return null;\n }\n val = str.split(separator);\n for (i = 0, l = val.length; i < l; i = i + 1) {\n val[i] = val[i].trim();\n }\n\n return val;\n },\n\n autosubmit: function() {\n this.$input.on('change', function(e, isInitial){\n if(!isInitial) {\n $(this).closest('form').submit();\n }\n });\n },\n\n getSeparator: function() {\n return this.options.select2.separator || $.fn.select2.defaults.separator;\n },\n\n /*\n Converts source from x-editable format: {value: 1, text: \"1\"} to\n select2 format: {id: 1, text: \"1\"}\n */\n convertSource: function(source) {\n if(Array.isArray(source) && source.length && source[0].value !== undefined) {\n for(var i = 0; i<source.length; i++) {\n if(source[i].value !== undefined) {\n source[i].id = source[i].value;\n delete source[i].value;\n }\n }\n }\n return source;\n },\n \n destroy: function() {\n\t if(this.$input) {\n\t if(this.$input.data('select2')) {\n\t this.$input.select2('destroy');\n\t }\n\t }\n }\n \n });\n\n Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n @property tpl \n @default <input type=\"hidden\">\n **/\n tpl:'<input type=\"hidden\">',\n /**\n Configuration of select2. [Full list of options](http://ivaynberg.github.com/select2).\n\n @property select2 \n @type object\n @default null\n **/\n select2: null,\n /**\n Placeholder attribute of select\n\n @property placeholder \n @type string\n @default null\n **/\n placeholder: null,\n /**\n Source data for select. It will be assigned to select2 `data` property and kept here just for convenience.\n Please note, that format is different from simple `select` input: use 'id' instead of 'value'.\n E.g. `[{id: 1, text: \"text1\"}, {id: 2, text: \"text2\"}, ...]`.\n\n @property source \n @type array|string|function\n @default null \n **/\n source: null,\n /**\n Separator used to display tags.\n\n @property viewseparator \n @type string\n @default ', ' \n **/\n viewseparator: ', '\n });\n\n $.fn.editabletypes.select2 = Constructor;\n\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/inputs/select2/select2.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/text.js":
|
|
/*!****************************!*\
|
|
!*** ./src/inputs/text.js ***!
|
|
\****************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nText input\n\n@class text\n@extends abstractinput\n@final\n@example\n<a href=\"#\" id=\"username\" data-type=\"text\" data-pk=\"1\">awesome</a>\n<script>\n$(function(){\n $('#username').editable({\n url: '/post',\n title: 'Enter username'\n });\n});\n</script>\n**/\nfunction attachText($) {\n \"use strict\";\n \n var Text = function (options) {\n this.init('text', options, Text.defaults);\n };\n\n $.fn.editableutils.inherit(Text, $.fn.editabletypes.abstractinput);\n\n $.extend(Text.prototype, {\n render: function() {\n this.renderClear();\n this.setClass();\n this.setAttr('placeholder');\n },\n \n activate: function() {\n if(this.$input.is(':visible')) {\n this.$input.focus();\n $.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);\n if(this.toggleClear) {\n this.toggleClear();\n }\n }\n },\n \n //render clear button\n renderClear: function() {\n if (this.options.clear) {\n this.$clear = $('<span class=\"editable-clear-x\"></span>');\n this.$input.after(this.$clear)\n .css('padding-right', 24)\n .keyup($.proxy(function(e) {\n //arrows, enter, tab, etc\n if(~$.inArray(e.keyCode, [40,38,9,13,27])) {\n return;\n } \n\n clearTimeout(this.t);\n var that = this;\n this.t = setTimeout(function() {\n that.toggleClear(e);\n }, 100);\n \n }, this))\n .parent().css('position', 'relative');\n \n this.$clear.click($.proxy(this.clear, this)); \n } \n },\n \n postrender: function() {\n /*\n //now `clear` is positioned via css\n if(this.$clear) {\n //can position clear button only here, when form is shown and height can be calculated\n// var h = this.$input.outerHeight(true) || 20,\n var h = this.$clear.parent().height(),\n delta = (h - this.$clear.height()) / 2;\n \n //this.$clear.css({bottom: delta, right: delta});\n }\n */ \n },\n \n //show / hide clear button\n toggleClear: function(e) {\n if(!this.$clear) {\n return;\n }\n \n var len = this.$input.val().length,\n visible = this.$clear.is(':visible');\n \n if(len && !visible) {\n this.$clear.show();\n } \n \n if(!len && visible) {\n this.$clear.hide();\n } \n },\n \n clear: function() {\n this.$clear.hide();\n this.$input.val('').focus();\n } \n });\n\n Text.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n @property tpl \n @default <input type=\"text\">\n **/ \n tpl: '<input type=\"text\">',\n /**\n Placeholder attribute of input. Shown when input is empty.\n\n @property placeholder \n @type string\n @default null\n **/ \n placeholder: null,\n \n /**\n Whether to show `clear` button \n \n @property clear \n @type boolean\n @default true \n **/\n clear: true\n });\n\n $.fn.editabletypes.text = Text;\n\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/inputs/text.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/inputs/textarea.js":
|
|
/*!********************************!*\
|
|
!*** ./src/inputs/textarea.js ***!
|
|
\********************************/
|
|
/***/ (() => {
|
|
|
|
eval("{/**\nTextarea input\n\n@class textarea\n@extends abstractinput\n@final\n@example\n<a href=\"#\" id=\"comments\" data-type=\"textarea\" data-pk=\"1\">awesome comment!</a>\n<script>\n$(function(){\n $('#comments').editable({\n url: '/post',\n title: 'Enter comments',\n rows: 10\n });\n});\n</script>\n**/\nfunction attachTextarea($) {\n \"use strict\";\n \n var Textarea = function (options) {\n this.init('textarea', options, Textarea.defaults);\n };\n\n $.fn.editableutils.inherit(Textarea, $.fn.editabletypes.abstractinput);\n\n $.extend(Textarea.prototype, {\n render: function () {\n this.setClass();\n this.setAttr('placeholder');\n this.setAttr('rows'); \n \n //ctrl + enter\n this.$input.keydown(function (e) {\n if (e.ctrlKey && e.which === 13) {\n $(this).closest('form').submit();\n }\n });\n },\n \n //using `white-space: pre-wrap` solves \\n <--> BR conversion very elegant!\n /* \n value2html: function(value, element) {\n var html = '', lines;\n if(value) {\n lines = value.split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n lines[i] = $('<div>').text(lines[i]).html();\n }\n html = lines.join('<br>');\n }\n $(element).html(html);\n },\n \n html2value: function(html) {\n if(!html) {\n return '';\n }\n\n var regex = new RegExp(String.fromCharCode(10), 'g');\n var lines = html.split(/<br\\s*\\/?>/i);\n for (var i = 0; i < lines.length; i++) {\n var text = $('<div>').html(lines[i]).text();\n\n // Remove newline characters (\\n) to avoid them being converted by value2html() method\n // thus adding extra <br> tags\n text = text.replace(regex, '');\n\n lines[i] = text;\n }\n return lines.join(\"\\n\");\n },\n */\n activate: function() {\n $.fn.editabletypes.text.prototype.activate.call(this);\n }\n });\n\n Textarea.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n @property tpl\n @default <textarea></textarea>\n **/\n tpl:'<textarea></textarea>',\n /**\n @property inputclass\n @default input-large\n **/\n inputclass: 'input-large',\n /**\n Placeholder attribute of input. Shown when input is empty.\n\n @property placeholder\n @type string\n @default null\n **/\n placeholder: null,\n /**\n Number of rows in textarea\n\n @property rows\n @type integer\n @default 7\n **/ \n rows: 7 \n });\n\n $.fn.editabletypes.textarea = Textarea;\n\n return $;\n}\n\n\n//# sourceURL=webpack://EditableForm/./src/inputs/textarea.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/umd-wrapper.js":
|
|
/*!****************************!*\
|
|
!*** ./src/umd-wrapper.js ***!
|
|
\****************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ xEditableFactory)\n/* harmony export */ });\n/* harmony import */ var _bootstrap5_editable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bootstrap5-editable.js */ \"./src/bootstrap5-editable.js\");\n// UMD Wrapper for x-editable that auto-initializes with jQuery\n\n\n// The UMD pattern expects a factory function that receives dependencies\n// This wrapper will be called by webpack's UMD template with jQuery as parameter\nfunction xEditableFactory($) {\n // Auto-initialize when called by UMD\n if ($ && $.fn) {\n return (0,_bootstrap5_editable_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])($);\n } else {\n // Return the init function for manual use\n return _bootstrap5_editable_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"];\n }\n}\n\n//# sourceURL=webpack://EditableForm/./src/umd-wrapper.js?\n}");
|
|
|
|
/***/ }),
|
|
|
|
/***/ "bootstrap":
|
|
/*!******************************************************************************************************!*\
|
|
!*** external {"commonjs":"bootstrap","commonjs2":"bootstrap","amd":"bootstrap","root":"bootstrap"} ***!
|
|
\******************************************************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = __WEBPACK_EXTERNAL_MODULE_bootstrap__;
|
|
|
|
/***/ }),
|
|
|
|
/***/ "jquery":
|
|
/*!******************************************************************************************!*\
|
|
!*** external {"commonjs":"jquery","commonjs2":"jquery","amd":"jquery","root":"jQuery"} ***!
|
|
\******************************************************************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
/************************************************************************/
|
|
/******/ // The module cache
|
|
/******/ var __webpack_module_cache__ = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/ // Check if module is in cache
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
/******/ if (cachedModule !== undefined) {
|
|
/******/ return cachedModule.exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
/******/ id: moduleId,
|
|
/******/ // no module.loaded needed
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/************************************************************************/
|
|
/******/ /* webpack/runtime/compat get default export */
|
|
/******/ (() => {
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
/******/ __webpack_require__.n = (module) => {
|
|
/******/ var getter = module && module.__esModule ?
|
|
/******/ () => (module['default']) :
|
|
/******/ () => (module);
|
|
/******/ __webpack_require__.d(getter, { a: getter });
|
|
/******/ return getter;
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/define property getters */
|
|
/******/ (() => {
|
|
/******/ // define getter functions for harmony exports
|
|
/******/ __webpack_require__.d = (exports, definition) => {
|
|
/******/ for(var key in definition) {
|
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
/******/ }
|
|
/******/ }
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
/******/ (() => {
|
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/make namespace object */
|
|
/******/ (() => {
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = (exports) => {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/nonce */
|
|
/******/ (() => {
|
|
/******/ __webpack_require__.nc = undefined;
|
|
/******/ })();
|
|
/******/
|
|
/************************************************************************/
|
|
/******/
|
|
/******/ // startup
|
|
/******/ // Load entry module and return exports
|
|
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
/******/ var __webpack_exports__ = __webpack_require__("./src/umd-wrapper.js");
|
|
/******/ __webpack_exports__ = __webpack_exports__["default"];
|
|
/******/
|
|
/******/ return __webpack_exports__;
|
|
/******/ })()
|
|
;
|
|
}); |