From 97cfd5be79d815dd54d04c386f129b8268cbb1e7 Mon Sep 17 00:00:00 2001 From: Mark Kevin Baldemor Date: Mon, 13 Jan 2020 11:59:21 +0800 Subject: [PATCH 01/70] Iteration for 2.3.1 snapshot --- README.md | 8 ++++---- pom.xml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b2d3c0b90..9e5a6f56b 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,21 @@ Gwt Material Design Extra Components for https://github.com/GwtMaterialDesign/gwt-material
-## Current Version 2.3.0 +## Current Version 2.3.1 ```xml com.github.gwtmaterialdesign gwt-material-addins - 2.3.0 + 2.3.1 ``` -## Snapshot Version 2.3-SNAPSHOT +## Snapshot Version 2.3.2-SNAPSHOT ```xml com.github.gwtmaterialdesign gwt-material-addins - 2.3-SNAPSHOT + 2.3.2-SNAPSHOT ``` diff --git a/pom.xml b/pom.xml index be5b1a13c..3c2af5c71 100644 --- a/pom.xml +++ b/pom.xml @@ -5,25 +5,25 @@ gwt-material-parent com.github.gwtmaterialdesign - 2.3.0 + 2.3.1-SNAPSHOT gwt-material-addins gwt-lib Gwt Material Addins - 2.3.0 + 2.3.1-SNAPSHOT Extra Components of GWT Material Framework - 2.3.0 + 2.3.1-SNAPSHOT scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git http://github.com/GwtMaterialDesign/gwt-material-addins - v2.3.0 + v2.3.1-SNAPSHOT From 317dbc925f0998e742331f1bd5576470243cfe39 Mon Sep 17 00:00:00 2001 From: Mark Kevin Baldemor Date: Mon, 13 Jan 2020 12:00:07 +0800 Subject: [PATCH 02/70] Travis update --- .travis.yml | 4 ++-- .utility/deploy.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d48db7b23..73c473fa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,12 +8,12 @@ cache: - $HOME/.m2 before_install: # install the gwt-material-jquery library before we build the demo -- git clone -b release_2.3 https://github.com/GwtMaterialDesign/gwt-material-jquery.git +- git clone -b release_2.3.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git - cd gwt-material-jquery - mvn install -DskipTests=true -DdryRun=true - cd .. # install the gwt-material library before we build the demo -- git clone -b release_2.3 https://github.com/GwtMaterialDesign/gwt-material.git +- git clone -b release_2.3.1 https://github.com/GwtMaterialDesign/gwt-material.git - cd gwt-material - mvn install -DskipTests=true -DdryRun=true - cd .. diff --git a/.utility/deploy.sh b/.utility/deploy.sh index 7787dfe7d..37a4d96f5 100644 --- a/.utility/deploy.sh +++ b/.utility/deploy.sh @@ -1,6 +1,6 @@ #!/bin/bash set -ev -if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.3" ]; then +if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.3.1" ]; then echo "ossrh\${env.OSSRH_USER}\${env.OSSRH_PASS}" > ~/settings.xml mvn deploy -DskipTests --settings ~/settings.xml fi \ No newline at end of file From a021e5058b0259043298589d97dca2e0bbff0182 Mon Sep 17 00:00:00 2001 From: Mark Kevin Baldemor Date: Thu, 16 Jan 2020 13:09:34 +0800 Subject: [PATCH 03/70] DateRangePicker - bug fixes --- .../client/daterange/DateRangePicker.java | 10 ++--- .../resources/css/daterangepicker-dark.css | 45 ++++++++++++++++++- .../css/daterangepicker-dark.min.css | 2 +- .../css/daterangepicker-materialize.css | 7 ++- .../css/daterangepicker-materialize.min.css | 2 +- 5 files changed, 52 insertions(+), 14 deletions(-) diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java b/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java index c629afac6..1c7f7e690 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,8 +28,6 @@ import gwt.material.design.addins.client.combobox.MaterialComboBoxDebugClientBundle; import gwt.material.design.addins.client.combobox.js.JsComboBox; import gwt.material.design.addins.client.combobox.js.JsComboBoxOptions; -import gwt.material.design.addins.client.combobox.js.options.Data; -import gwt.material.design.addins.client.combobox.js.options.Params; import gwt.material.design.addins.client.moment.resources.MomentClientBundle; import gwt.material.design.addins.client.moment.resources.MomentClientDebugBundle; import gwt.material.design.client.MaterialDesignBase; @@ -49,8 +47,8 @@ import gwt.material.design.incubator.client.base.matcher.DateMonthMatcher; import gwt.material.design.incubator.client.dark.IncubatorDarkThemeReloader; import gwt.material.design.incubator.client.daterange.constants.DateRangeElementSelector; -import gwt.material.design.incubator.client.daterange.events.*; import gwt.material.design.incubator.client.daterange.events.SelectionEvent; +import gwt.material.design.incubator.client.daterange.events.*; import gwt.material.design.incubator.client.daterange.js.*; import gwt.material.design.jquery.client.api.Functions; import gwt.material.design.jquery.client.api.JQuery; @@ -62,7 +60,7 @@ public class DateRangePicker extends AbstractValueWidget implements HasDateRangeHandlers, HasFieldTypes, - HasDateRangeOptions, HasIcon, HasReadOnly, HasPlaceholder, HasNativeBrowserStyle { + HasDateRangeOptions, HasIcon, HasReadOnly, HasPlaceholder, HasNativeBrowserStyle { static { if (AddinsIncubator.isDebug()) { diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css index b1d67674e..0fa58d6b0 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css @@ -17,7 +17,7 @@ } .daterangepicker th.month { - color: rgba(255, 255, 255, .6); + color: #ffffff; } .daterangepicker .calendar-table .next span, @@ -37,7 +37,7 @@ color: #292929; } -.daterangepicker td.available:hover, +.daterangepicker td:not(.active).available:hover, .daterangepicker th.available:hover { background-color: #2e3033; } @@ -58,4 +58,45 @@ button.cancelBtn { .daterangepicker:not(.single) .drp-buttons { background-color: #2e3033; +} + +.daterangepicker .calendar-time { + background: #292929; + border: 1px solid #292929; +} + +.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered { + color: white; +} + +.date-range-picker .select2-container--default .select2-search--dropdown .select2-search__field, +.select2-container--default .select2-results__option[aria-selected=true], +.date-range-picker .select2-results__option { + background: #2f2f2f; +} + +.date-range-picker .select2-container--default .select2-results__option--highlighted[aria-selected] { + background-color: #292929; +} + +.daterangepicker .select2-container--disabled .select2-selection__rendered { + color: #9c9c9c !important; +} + +/** Ranges **/ +.daterangepicker .ranges li.active { + background-color: #bb86fc !important; + color: #000000; +} + +.daterangepicker .ranges li:not(.active):hover { + background-color: #292929; +} + +.daterangepicker .ranges li:hover { + background-color: #292929; +} + +.daterangepicker.show-ranges .drp-calendar.left { + border-left: 1px solid #292929 !important; } \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css index b5bc9b7e0..e3185a493 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css @@ -1 +1 @@ -.daterangepicker,.daterangepicker .calendar-table,.daterangepicker td.off,.daterangepicker td.off.end-date,.daterangepicker td.off.in-range,.daterangepicker td.off.start-date{background-color:#2e3033;border-color:#2e3033}.daterangepicker:after{border-bottom:6px solid #2e3033}.daterangepicker:before{border-bottom:7px solid #2e3033}.daterangepicker th.month{color:rgba(255,255,255,.6)}.daterangepicker .calendar-table .next span,.daterangepicker .calendar-table .prev span{border:solid #fff;border-width:0 2px 2px 0}.daterangepicker .drp-buttons{border-top:1px solid #3d3d3d}.daterangepicker td.active,.daterangepicker td.active:hover,.daterangepicker td.in-range.active:not(.off){background-color:#bb86fc;color:#292929}.daterangepicker td.available:hover,.daterangepicker th.available:hover{background-color:#2e3033}.daterangepicker td.available:hover:after{border:2px solid #bb86fc}.daterangepicker td.available.in-range:hover:not(.active),.daterangepicker td.in-range{background-color:rgba(187,134,252,.08);color:#bb86fc}button.cancelBtn{color:#bb86fc}.daterangepicker:not(.single) .drp-buttons{background-color:#2e3033} \ No newline at end of file +.daterangepicker,.daterangepicker .calendar-table,.daterangepicker td.off,.daterangepicker td.off.end-date,.daterangepicker td.off.in-range,.daterangepicker td.off.start-date{background-color:#2e3033;border-color:#2e3033}.daterangepicker:after{border-bottom:6px solid #2e3033}.daterangepicker:before{border-bottom:7px solid #2e3033}.daterangepicker th.month{color:#fff}.daterangepicker .calendar-table .next span,.daterangepicker .calendar-table .prev span{border:solid #fff;border-width:0 2px 2px 0}.daterangepicker .drp-buttons{border-top:1px solid #3d3d3d}.daterangepicker td.active,.daterangepicker td.active:hover,.daterangepicker td.in-range.active:not(.off){background-color:#bb86fc;color:#292929}.daterangepicker td:not(.active).available:hover,.daterangepicker th.available:hover{background-color:#2e3033}.daterangepicker td.available:hover:after{border:2px solid #bb86fc}.daterangepicker td.available.in-range:hover:not(.active),.daterangepicker td.in-range{background-color:rgba(187,134,252,.08);color:#bb86fc}button.cancelBtn{color:#bb86fc}.daterangepicker:not(.single) .drp-buttons{background-color:#2e3033}.daterangepicker .calendar-time{background:#292929;border:1px solid #292929}.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered{color:#fff}.date-range-picker .select2-container--default .select2-search--dropdown .select2-search__field,.date-range-picker .select2-results__option,.select2-container--default .select2-results__option[aria-selected=true]{background:#2f2f2f}.date-range-picker .select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#292929}.daterangepicker .select2-container--disabled .select2-selection__rendered{color:#9c9c9c!important}.daterangepicker .ranges li.active{background-color:#bb86fc!important;color:#000}.daterangepicker .ranges li:not(.active):hover{background-color:#292929}.daterangepicker .ranges li:hover{background-color:#292929}.daterangepicker.show-ranges .drp-calendar.left{border-left:1px solid #292929!important} \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.css index 903a3e95d..0b0b330b3 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.css @@ -33,10 +33,6 @@ left: 0px; } -.daterangepicker .drp-calendar.right .calendar-table table thead:first-child tr:first-child th:first-child { - display: none; -} - /** Calendar Day Item / Columns **/ .daterangepicker .calendar-table td.available { width: 36px !important; @@ -93,6 +89,9 @@ } /** Month and Year Selection **/ +.daterangepicker .select2 { + width: 92px !important; +} .date-range-picker .select2-container--default .select2-search--dropdown .select2-search__field { width: 100% !important; background: white; diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.min.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.min.css index 0ef6a1aa4..1b427d60a 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.min.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-materialize.min.css @@ -1 +1 @@ -.daterangepicker{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.daterangepicker .calendar-table td,.daterangepicker .calendar-table th{padding:unset}.daterangepicker th.month{color:#444;font-size:1.2em}.daterangepicker .calendar-table table{position:relative}.daterangepicker .calendar-table th.next,.daterangepicker .calendar-table th.prev{position:absolute}.daterangepicker .calendar-table th.next{position:absolute;right:0}.daterangepicker .calendar-table th.prev{position:absolute;left:0}.daterangepicker .drp-calendar.right .calendar-table table thead:first-child tr:first-child th:first-child{display:none}.daterangepicker .calendar-table td.available{width:36px!important;height:36px!important}.daterangepicker .calendar-table td{border:unset}.daterangepicker td.active,.daterangepicker td.active:hover,.daterangepicker td.in-range.active:not(.off){background-color:#42a5f5;border-color:transparent;color:#fff;border-radius:100%}.daterangepicker td.start-date.end-date{border-radius:100%}.daterangepicker td.available.in-range:hover:not(.active),.daterangepicker td.in-range{background-color:#e3f2fd;color:#42a5f5}.daterangepicker td.available:hover{position:relative}.daterangepicker td.available:hover:after{content:" ";background:0 0;width:100%;position:absolute;height:100%;left:0;top:0;border-radius:100%;border:2px solid #42a5f5}.daterangepicker .drp-calendar{max-width:unset}.daterangepicker .drp-calendar.left,.daterangepicker .drp-calendar.right{padding:20px}.date-range-picker .select2-container--default .select2-search--dropdown .select2-search__field{width:100%!important;background:#fff;border-radius:0;border-top:none;border-left:none;border-right:none;margin-bottom:0;padding-left:12px!important;font-size:1em}.date-range-picker .select2-results__option{padding-top:8px;padding-bottom:8px;min-height:20px}.date-range-picker .select2-container--classic .select2-results>.select2-results__options,.select2-container--default .select2-results>.select2-results__options{max-height:240px!important}.date-range-picker .select2-container{z-index:10000}.daterangepicker .select2-container--default .select2-selection--single{border-bottom:none}.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:46px;padding-left:0;font-size:14px}.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered:after{content:"";position:absolute;right:8px;bottom:23px;width:0;height:0;border-style:solid;border-width:0 0 8px 8px;border-color:transparent transparent #9c9c9c!important}.date-range-picker .select2-container--open .select2-dropdown{margin-top:-12px!important}.daterangepicker .calendar-time select{display:inline-block}.daterangepicker .drp-buttons .btn{padding-left:12px;padding-right:12px;line-height:20px}.daterangepicker .drp-selected{float:left;padding:12px;font-size:1em}button.cancelBtn{background:0 0;color:#42a5f5;box-shadow:none;border:1px solid}button.cancelBtn:hover{color:#fff;border:none}.daterangepicker.show-calendar .ranges{margin-top:0}.daterangepicker .ranges li.active{background-color:#42a5f5}.daterangepicker .ranges li{padding-top:11px;padding-bottom:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.daterangepicker .calendar-time .select2{width:60px!important}.daterangepicker .calendar-time{background:#fbfbfb;border:1px solid #e9e9e9}.daterangepicker select.browser-default{height:unset;background-color:unset;display:inline-block;color:rgba(0,0,0,.8)}.daterangepicker .calendar-table select.browser-default{width:40%}@media screen and (max-width:600px){.daterangepicker:not(.single){position:fixed;top:0!important;left:0!important;width:100%;margin-top:0;overflow:auto;bottom:0;padding-top:12px;padding-bottom:56px}.daterangepicker:before:not(.single){display:none}.daterangepicker:not(.single) .drp-calendar.left,.daterangepicker:not(.single) .drp-calendar.right{margin:auto;float:none!important;padding:0 5%;border-bottom:1px solid #e9e9e9}.daterangepicker:not(.single) .drp-calendar.right{border-bottom:none;margin-top:4px}.daterangepicker:not(.single) .drp-buttons{position:fixed;bottom:0;width:100%;background:#fafafa;padding-right:5%}.daterangepicker:not(.single) .drp-calendar table thead tr:nth-child(1),.daterangepicker:not(.single) .drp-calendar table thead tr:nth-child(2){height:32px}.daterangepicker:not(.single) th.month{position:absolute;width:100%;text-align:center}.daterangepicker:not(.single) .drp-calendar.left{padding-bottom:20px}.daterangepicker:not(.single) .drp-calendar.right{margin-top:12px}.daterangepicker:not(.single) .calendar-table th.next,.daterangepicker:not(.single) .calendar-table th.prev{top:0;position:fixed;margin:12px}.daterangepicker:not(.single) td.active,.daterangepicker:not(.single) td.active:hover,.daterangepicker:not(.single) td.in-range.active:not(.off){border-radius:4px!important}.daterangepicker:not(.single) .select2-container--default .select2-selection--single .select2-selection__arrow,.daterangepicker:not(.single) .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:24px}.daterangepicker:not(.single) .select2-container--default .select2-selection--single .select2-selection__rendered:after{bottom:unset;top:8px}.daterangepicker .calendar-time .select2{margin-top:4px}.daterangepicker .calendar-time{height:32px;color:transparent}}@media screen and (max-width:900px){.daterangepicker:not(.single) .drp-buttons,.daterangepicker:not(.single) .drp-calendar.left,.daterangepicker:not(.single) .drp-calendar.right{display:block}.daterangepicker:not(.single) .drp-selected{display:none}.daterangepicker .ranges{position:fixed;z-index:999;bottom:0;margin:8px 8px 8px 5%;max-width:160px}.daterangepicker .ranges ul:before{content:"";position:absolute;right:0;bottom:12px;width:0;height:0;border-style:solid;border-width:0 0 12px 12px;border-color:transparent transparent #9c9c9c}.daterangepicker .ranges ul:hover:before{display:none}.daterangepicker .ranges:hover{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);background:#fff;max-width:calc(100% - 52px)}.daterangepicker .ranges li:hover{background-color:#fff}.daterangepicker .ranges li.active{background-color:transparent;color:rgba(0,0,0,.6);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.daterangepicker .ranges:hover ul li{display:block!important}.daterangepicker .ranges:hover ul li.active{background:#42a5f5!important;color:#fff}.daterangepicker .ranges ul li{padding-left:20px;padding-right:20px;display:none}.daterangepicker .ranges ul li.active{display:block;text-transform:uppercase;font-weight:700}}@media screen and (min-width:600px) and (max-width:900px){.daterangepicker .drp-calendar.left,.daterangepicker .drp-calendar.right{padding:12px}.daterangepicker:not(.single) .ranges{position:absolute;left:0;margin-left:0}} \ No newline at end of file +.daterangepicker{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.daterangepicker .calendar-table td,.daterangepicker .calendar-table th{padding:unset}.daterangepicker th.month{color:#444;font-size:1.2em}.daterangepicker .calendar-table table{position:relative}.daterangepicker .calendar-table th.next,.daterangepicker .calendar-table th.prev{position:absolute}.daterangepicker .calendar-table th.next{position:absolute;right:0}.daterangepicker .calendar-table th.prev{position:absolute;left:0}.daterangepicker .calendar-table td.available{width:36px!important;height:36px!important}.daterangepicker .calendar-table td{border:unset}.daterangepicker td.active,.daterangepicker td.active:hover,.daterangepicker td.in-range.active:not(.off){background-color:#42a5f5;border-color:transparent;color:#fff;border-radius:100%}.daterangepicker td.start-date.end-date{border-radius:100%}.daterangepicker td.available.in-range:hover:not(.active),.daterangepicker td.in-range{background-color:#e3f2fd;color:#42a5f5}.daterangepicker td.available:hover{position:relative}.daterangepicker td.available:hover:after{content:" ";background:0 0;width:100%;position:absolute;height:100%;left:0;top:0;border-radius:100%;border:2px solid #42a5f5}.daterangepicker .drp-calendar{max-width:unset}.daterangepicker .drp-calendar.left,.daterangepicker .drp-calendar.right{padding:20px}.daterangepicker .select2{width:92px!important}.date-range-picker .select2-container--default .select2-search--dropdown .select2-search__field{width:100%!important;background:#fff;border-radius:0;border-top:none;border-left:none;border-right:none;margin-bottom:0;padding-left:12px!important;font-size:1em}.date-range-picker .select2-results__option{padding-top:8px;padding-bottom:8px;min-height:20px}.date-range-picker .select2-container--classic .select2-results>.select2-results__options,.select2-container--default .select2-results>.select2-results__options{max-height:240px!important}.date-range-picker .select2-container{z-index:10000}.daterangepicker .select2-container--default .select2-selection--single{border-bottom:none}.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:46px;padding-left:0;font-size:14px}.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered:after{content:"";position:absolute;right:8px;bottom:23px;width:0;height:0;border-style:solid;border-width:0 0 8px 8px;border-color:transparent transparent #9c9c9c!important}.date-range-picker .select2-container--open .select2-dropdown{margin-top:-12px!important}.daterangepicker .calendar-time select{display:inline-block}.daterangepicker .drp-buttons .btn{padding-left:12px;padding-right:12px;line-height:20px}.daterangepicker .drp-selected{float:left;padding:12px;font-size:1em}button.cancelBtn{background:0 0;color:#42a5f5;box-shadow:none;border:1px solid}button.cancelBtn:hover{color:#fff;border:none}.daterangepicker.show-calendar .ranges{margin-top:0}.daterangepicker .ranges li.active{background-color:#42a5f5}.daterangepicker .ranges li{padding-top:11px;padding-bottom:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.daterangepicker .calendar-time .select2{width:60px!important}.daterangepicker .calendar-time{background:#fbfbfb;border:1px solid #e9e9e9}.daterangepicker select.browser-default{height:unset;background-color:unset;display:inline-block;color:rgba(0,0,0,.8)}.daterangepicker .calendar-table select.browser-default{width:40%}@media screen and (max-width:600px){.daterangepicker:not(.single){position:fixed;top:0!important;left:0!important;width:100%;margin-top:0;overflow:auto;bottom:0;padding-top:12px;padding-bottom:56px}.daterangepicker:before:not(.single){display:none}.daterangepicker:not(.single) .drp-calendar.left,.daterangepicker:not(.single) .drp-calendar.right{margin:auto;float:none!important;padding:0 5%;border-bottom:1px solid #e9e9e9}.daterangepicker:not(.single) .drp-calendar.right{border-bottom:none;margin-top:4px}.daterangepicker:not(.single) .drp-buttons{position:fixed;bottom:0;width:100%;background:#fafafa;padding-right:5%}.daterangepicker:not(.single) .drp-calendar table thead tr:nth-child(1),.daterangepicker:not(.single) .drp-calendar table thead tr:nth-child(2){height:32px}.daterangepicker:not(.single) th.month{position:absolute;width:100%;text-align:center}.daterangepicker:not(.single) .drp-calendar.left{padding-bottom:20px}.daterangepicker:not(.single) .drp-calendar.right{margin-top:12px}.daterangepicker:not(.single) .calendar-table th.next,.daterangepicker:not(.single) .calendar-table th.prev{top:0;position:fixed;margin:12px}.daterangepicker:not(.single) td.active,.daterangepicker:not(.single) td.active:hover,.daterangepicker:not(.single) td.in-range.active:not(.off){border-radius:4px!important}.daterangepicker:not(.single) .select2-container--default .select2-selection--single .select2-selection__arrow,.daterangepicker:not(.single) .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:24px}.daterangepicker:not(.single) .select2-container--default .select2-selection--single .select2-selection__rendered:after{bottom:unset;top:8px}.daterangepicker .calendar-time .select2{margin-top:4px}.daterangepicker .calendar-time{height:32px;color:transparent}}@media screen and (max-width:900px){.daterangepicker:not(.single) .drp-buttons,.daterangepicker:not(.single) .drp-calendar.left,.daterangepicker:not(.single) .drp-calendar.right{display:block}.daterangepicker:not(.single) .drp-selected{display:none}.daterangepicker .ranges{position:fixed;z-index:999;bottom:0;margin:8px 8px 8px 5%;max-width:160px}.daterangepicker .ranges ul:before{content:"";position:absolute;right:0;bottom:12px;width:0;height:0;border-style:solid;border-width:0 0 12px 12px;border-color:transparent transparent #9c9c9c}.daterangepicker .ranges ul:hover:before{display:none}.daterangepicker .ranges:hover{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);background:#fff;max-width:calc(100% - 52px)}.daterangepicker .ranges li:hover{background-color:#fff}.daterangepicker .ranges li.active{background-color:transparent;color:rgba(0,0,0,.6);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.daterangepicker .ranges:hover ul li{display:block!important}.daterangepicker .ranges:hover ul li.active{background:#42a5f5!important;color:#fff}.daterangepicker .ranges ul li{padding-left:20px;padding-right:20px;display:none}.daterangepicker .ranges ul li.active{display:block;text-transform:uppercase;font-weight:700}}@media screen and (min-width:600px) and (max-width:900px){.daterangepicker .drp-calendar.left,.daterangepicker .drp-calendar.right{padding:12px}.daterangepicker:not(.single) .ranges{position:absolute;left:0;margin-left:0}} \ No newline at end of file From 05c8a3e3d2402b7e03aabd9b67e570f01a0a7718 Mon Sep 17 00:00:00 2001 From: Mark Kevin Baldemor Date: Tue, 3 Mar 2020 15:12:41 +0800 Subject: [PATCH 04/70] Select2Js upgrade from 4.0.3 to 4.0.13 --- .../client/combobox/MaterialComboBox.java | 56 +- .../combobox/events/ComboBoxEvents.java | 2 + .../combobox/events/HasComboBoxHandlers.java | 9 +- .../client/combobox/js/JsComboBoxOptions.java | 6 + .../client/combobox/resources/js/select2.js | 943 ++++++++++++------ .../combobox/resources/js/select2.min.js | 5 +- 6 files changed, 733 insertions(+), 288 deletions(-) diff --git a/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java b/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java index 86f3446fe..17ff0c51e 100644 --- a/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java +++ b/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -52,6 +52,8 @@ import gwt.material.design.client.base.mixin.StatusTextMixin; import gwt.material.design.client.constants.CssName; import gwt.material.design.client.constants.FieldType; +import gwt.material.design.client.events.ClearEvent; +import gwt.material.design.client.events.ClearingEvent; import gwt.material.design.client.events.ClosingEvent; import gwt.material.design.client.events.OpeningEvent; import gwt.material.design.client.ui.MaterialLabel; @@ -199,6 +201,16 @@ public void load() { return true; }); + jsComboBox.on(ComboBoxEvents.CLEAR, (e, param1) -> { + ClearEvent.fire(this); + return true; + }); + + jsComboBox.on(ComboBoxEvents.CLEARING, (e, param1) -> { + ClearingEvent.fire(this); + return true; + }); + displayArrowForAllowClearOption(false); if (getTextColor() != null) { @@ -224,6 +236,8 @@ public void unload() { jsComboBox.off(ComboBoxEvents.UNSELECT); jsComboBox.off(ComboBoxEvents.OPEN); jsComboBox.off(ComboBoxEvents.CLOSE); + jsComboBox.off(ComboBoxEvents.CLEAR); + jsComboBox.off(ComboBoxEvents.CLEARING); body().off("focus"); jsComboBox.select2("destroy"); } @@ -812,6 +826,34 @@ public LanguageOptions getLanguage() { return options.language; } + /** + * Supports customization of the container width. + * + * @see Example + */ + public void setContainerWidth(String width) { + options.width = width; + } + + public String getContainerWidth() { + return options.width; + } + + /** + * If true, resolves issue for multiselects using closeOnSelect: false that caused the list of results to scroll to + * the first selection after each select/unselect (see https://github.com/select2/select2/pull/5150). This behaviour + * was intentional to deal with infinite scroll UI issues (if you need this behavior, set false) but it created an + * issue with multiselect dropdown boxes of fixed length. This pull request adds a configurable option to toggle + * between these two desirable behaviours. + */ + public void setScrollAfterSelect(boolean scrollAfterSelect) { + options.scrollAfterSelect = scrollAfterSelect; + } + + public boolean isScrollAfterSelect() { + return options.scrollAfterSelect; + } + public void scrollTop(int offset) { Scheduler.get().scheduleDeferred(() -> getDropdownResultElement().scrollTop(offset)); } @@ -907,6 +949,16 @@ public HandlerRegistration addClosingHandler(ClosingEvent.ClosingHandler handler return addHandler(handler, ClosingEvent.getType()); } + @Override + public HandlerRegistration addClearHandler(ClearEvent.ClearHandler handler) { + return addHandler(handler, ClearEvent.TYPE); + } + + @Override + public HandlerRegistration addClearingHandler(ClearingEvent.ClearingHandler handler) { + return addHandler(handler, ClearingEvent.TYPE); + } + @Override public HandlerRegistration addCloseHandler(CloseHandler closeHandler) { return addHandler(closeHandler, CloseEvent.getType()); diff --git a/src/main/java/gwt/material/design/addins/client/combobox/events/ComboBoxEvents.java b/src/main/java/gwt/material/design/addins/client/combobox/events/ComboBoxEvents.java index 4620e66d6..71e787219 100644 --- a/src/main/java/gwt/material/design/addins/client/combobox/events/ComboBoxEvents.java +++ b/src/main/java/gwt/material/design/addins/client/combobox/events/ComboBoxEvents.java @@ -33,4 +33,6 @@ public interface ComboBoxEvents { String OPENING = "select2:opening"; String CLOSE = "select2:close"; String CLOSING = "select2:closing"; + String CLEAR = "select2:clear"; + String CLEARING = "select2:clearing"; } diff --git a/src/main/java/gwt/material/design/addins/client/combobox/events/HasComboBoxHandlers.java b/src/main/java/gwt/material/design/addins/client/combobox/events/HasComboBoxHandlers.java index 40324f91b..ed569257d 100644 --- a/src/main/java/gwt/material/design/addins/client/combobox/events/HasComboBoxHandlers.java +++ b/src/main/java/gwt/material/design/addins/client/combobox/events/HasComboBoxHandlers.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,12 +23,15 @@ import com.google.gwt.event.logical.shared.HasOpenHandlers; import com.google.gwt.event.shared.HandlerRegistration; import gwt.material.design.addins.client.combobox.base.HasUnselectItemHandler; +import gwt.material.design.client.events.ClearEvent; +import gwt.material.design.client.events.ClearingEvent; import gwt.material.design.client.events.ClosingEvent; import gwt.material.design.client.events.OpeningEvent; public interface HasComboBoxHandlers extends HasOpenHandlers, HasCloseHandlers, HasUnselectItemHandler { HandlerRegistration addOpeningHandler(OpeningEvent.OpeningHandler handler); - HandlerRegistration addClosingHandler(ClosingEvent.ClosingHandler handler); + HandlerRegistration addClearHandler(ClearEvent.ClearHandler handler); + HandlerRegistration addClearingHandler(ClearingEvent.ClearingHandler handler); } diff --git a/src/main/java/gwt/material/design/addins/client/combobox/js/JsComboBoxOptions.java b/src/main/java/gwt/material/design/addins/client/combobox/js/JsComboBoxOptions.java index 9557ddd86..d8ccb6495 100644 --- a/src/main/java/gwt/material/design/addins/client/combobox/js/JsComboBoxOptions.java +++ b/src/main/java/gwt/material/design/addins/client/combobox/js/JsComboBoxOptions.java @@ -66,9 +66,15 @@ public static final JsComboBoxOptions create() { @JsProperty public boolean closeOnSelect; + @JsProperty + public boolean scrollAfterSelect; + @JsProperty public boolean tags; + @JsProperty + public String width; + @JsProperty public Functions.FuncRet2 matcher; diff --git a/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.js b/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.js index 13b84fadf..fcfb5ab49 100644 --- a/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.js +++ b/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.js @@ -1,27 +1,41 @@ /*! - * Select2 4.0.3 + * Select2 4.0.13 * https://select2.github.io * * Released under the MIT license * https://github.com/select2/select2/blob/master/LICENSE.md */ -(function (factory) { +;(function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); - } else if (typeof exports === 'object') { + } else if (typeof module === 'object' && module.exports) { // Node/CommonJS - factory(require('jquery')); + module.exports = function (root, jQuery) { + if (jQuery === undefined) { + // require('jQuery') returns a factory that requires window to + // build a jQuery instance, we normalize how we use modules + // that require this pattern but the window provided is a noop + // if it's defined (how jquery works) + if (typeof window !== 'undefined') { + jQuery = require('jquery'); + } + else { + jQuery = require('jquery')(root); + } + } + factory(jQuery); + return jQuery; + }; } else { // Browser globals factory(jQuery); } -}(function (jQuery) { +} (function (jQuery) { // This is needed so we can catch the AMD loader configuration and use it // The inner file should be wrapped (by `banner.start.js`) in a function that // returns the AMD loader references. - var S2 = -(function () { + var S2 =(function () { // Restore the Select2 AMD loader so it can be used // Needed mostly in the language files, where the loader is not inserted if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { @@ -30,13 +44,11 @@ var S2;(function () { if (!S2 || !S2.requirejs) { if (!S2) { S2 = {}; } else { require = S2; } /** - * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/almond for details + * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. + * Released under MIT license, http://github.com/requirejs/almond/LICENSE */ //Going sloppy to avoid 'use strict' string cost, but strict practices should //be followed. -/*jslint sloppy: true */ /*global setTimeout: false */ var requirejs, require, define; @@ -64,60 +76,58 @@ var requirejs, require, define; */ function normalize(name, baseName) { var nameParts, nameSegment, mapValue, foundMap, lastIndex, - foundI, foundStarMap, starI, i, j, part, + foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, baseParts = baseName && baseName.split("/"), map = config.map, starMap = (map && map['*']) || {}; //Adjust any relative paths. - if (name && name.charAt(0) === ".") { - //If have a base name, try to normalize against it, - //otherwise, assume it is a top-level require that will - //be relative to baseUrl in the end. - if (baseName) { - name = name.split('/'); - lastIndex = name.length - 1; - - // Node .js allowance: - if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { - name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); - } + if (name) { + name = name.split('/'); + lastIndex = name.length - 1; + + // If wanting node ID compatibility, strip .js from end + // of IDs. Have to do this here, and not in nameToUrl + // because node allows either .js or non .js to map + // to same file. + if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { + name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); + } - //Lop off the last part of baseParts, so that . matches the - //"directory" and not name of the baseName's module. For instance, - //baseName of "one/two/three", maps to "one/two/three.js", but we - //want the directory, "one/two" for this normalization. - name = baseParts.slice(0, baseParts.length - 1).concat(name); - - //start trimDots - for (i = 0; i < name.length; i += 1) { - part = name[i]; - if (part === ".") { - name.splice(i, 1); - i -= 1; - } else if (part === "..") { - if (i === 1 && (name[2] === '..' || name[0] === '..')) { - //End of the line. Keep at least one non-dot - //path segment at the front so it can be mapped - //correctly to disk. Otherwise, there is likely - //no path mapping for a path starting with '..'. - //This can still fail, but catches the most reasonable - //uses of .. - break; - } else if (i > 0) { - name.splice(i - 1, 2); - i -= 2; - } + // Starts with a '.' so need the baseName + if (name[0].charAt(0) === '.' && baseParts) { + //Convert baseName to array, and lop off the last part, + //so that . matches that 'directory' and not name of the baseName's + //module. For instance, baseName of 'one/two/three', maps to + //'one/two/three.js', but we want the directory, 'one/two' for + //this normalization. + normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); + name = normalizedBaseParts.concat(name); + } + + //start trimDots + for (i = 0; i < name.length; i++) { + part = name[i]; + if (part === '.') { + name.splice(i, 1); + i -= 1; + } else if (part === '..') { + // If at the start, or previous value is still .., + // keep them so that when converted to a path it may + // still work when converted to a path, even though + // as an ID it is less than ideal. In larger point + // releases, may be better to just kick out an error. + if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { + continue; + } else if (i > 0) { + name.splice(i - 1, 2); + i -= 2; } } - //end trimDots - - name = name.join("/"); - } else if (name.indexOf('./') === 0) { - // No baseName, so this is ID is resolved relative - // to baseUrl, pull off the leading dot. - name = name.substring(2); } + //end trimDots + + name = name.join('/'); } //Apply map config if available. @@ -230,32 +240,39 @@ var requirejs, require, define; return [prefix, name]; } + //Creates a parts array for a relName where first part is plugin ID, + //second part is resource ID. Assumes relName has already been normalized. + function makeRelParts(relName) { + return relName ? splitPrefix(relName) : []; + } + /** * Makes a name map, normalizing the name, and using a plugin * for normalization if necessary. Grabs a ref to plugin * too, as an optimization. */ - makeMap = function (name, relName) { + makeMap = function (name, relParts) { var plugin, parts = splitPrefix(name), - prefix = parts[0]; + prefix = parts[0], + relResourceName = relParts[1]; name = parts[1]; if (prefix) { - prefix = normalize(prefix, relName); + prefix = normalize(prefix, relResourceName); plugin = callDep(prefix); } //Normalize according if (prefix) { if (plugin && plugin.normalize) { - name = plugin.normalize(name, makeNormalize(relName)); + name = plugin.normalize(name, makeNormalize(relResourceName)); } else { - name = normalize(name, relName); + name = normalize(name, relResourceName); } } else { - name = normalize(name, relName); + name = normalize(name, relResourceName); parts = splitPrefix(name); prefix = parts[0]; name = parts[1]; @@ -302,13 +319,14 @@ var requirejs, require, define; }; main = function (name, deps, callback, relName) { - var cjsModule, depName, ret, map, i, + var cjsModule, depName, ret, map, i, relParts, args = [], callbackType = typeof callback, usingExports; //Use name if no relName relName = relName || name; + relParts = makeRelParts(relName); //Call the callback to define the module, if necessary. if (callbackType === 'undefined' || callbackType === 'function') { @@ -317,7 +335,7 @@ var requirejs, require, define; //Default to [require, exports, module] if no deps deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; for (i = 0; i < deps.length; i += 1) { - map = makeMap(deps[i], relName); + map = makeMap(deps[i], relParts); depName = map.f; //Fast path CommonJS standard dependencies. @@ -373,7 +391,7 @@ var requirejs, require, define; //deps arg is the module name, and second arg (if passed) //is just the relName. //Normalize module name, if it contains . or .. - return callDep(makeMap(deps, callback).f); + return callDep(makeMap(deps, makeRelParts(callback)).f); } else if (!deps.splice) { //deps is a config object, not an array. config = deps; @@ -556,10 +574,10 @@ S2.define('select2/utils',[ DecoratedClass.prototype = new ctr(); for (var m = 0; m < superMethods.length; m++) { - var superMethod = superMethods[m]; + var superMethod = superMethods[m]; - DecoratedClass.prototype[superMethod] = - SuperClass.prototype[superMethod]; + DecoratedClass.prototype[superMethod] = + SuperClass.prototype[superMethod]; } var calledMethod = function (methodName) { @@ -754,6 +772,70 @@ S2.define('select2/utils',[ $element.append($nodes); }; + // Cache objects in Utils.__cache instead of $.data (see #4346) + Utils.__cache = {}; + + var id = 0; + Utils.GetUniqueElementId = function (element) { + // Get a unique element Id. If element has no id, + // creates a new unique number, stores it in the id + // attribute and returns the new id. + // If an id already exists, it simply returns it. + + var select2Id = element.getAttribute('data-select2-id'); + if (select2Id == null) { + // If element has id, use it. + if (element.id) { + select2Id = element.id; + element.setAttribute('data-select2-id', select2Id); + } else { + element.setAttribute('data-select2-id', ++id); + select2Id = id.toString(); + } + } + return select2Id; + }; + + Utils.StoreData = function (element, name, value) { + // Stores an item in the cache for a specified element. + // name is the cache key. + var id = Utils.GetUniqueElementId(element); + if (!Utils.__cache[id]) { + Utils.__cache[id] = {}; + } + + Utils.__cache[id][name] = value; + }; + + Utils.GetData = function (element, name) { + // Retrieves a value from the cache by its key (name) + // name is optional. If no name specified, return + // all cache items for the specified element. + // and for a specified element. + var id = Utils.GetUniqueElementId(element); + if (name) { + if (Utils.__cache[id]) { + if (Utils.__cache[id][name] != null) { + return Utils.__cache[id][name]; + } + return $(element).data(name); // Fallback to HTML5 data attribs. + } + return $(element).data(name); // Fallback to HTML5 data attribs. + } else { + return Utils.__cache[id]; + } + }; + + Utils.RemoveData = function (element) { + // Removes all cached items for a specified element. + var id = Utils.GetUniqueElementId(element); + if (Utils.__cache[id] != null) { + delete Utils.__cache[id]; + } + + element.removeAttribute('data-select2-id'); + }; + return Utils; }); @@ -773,7 +855,7 @@ S2.define('select2/results',[ Results.prototype.render = function () { var $results = $( - '
    ' + '
      ' ); if (this.options.get('multiple')) { @@ -796,7 +878,7 @@ S2.define('select2/results',[ this.hideLoading(); var $message = $( - '
    • ' ); @@ -889,7 +971,7 @@ S2.define('select2/results',[ $options.each(function () { var $option = $(this); - var item = $.data(this, 'data'); + var item = Utils.GetData(this, 'data'); // id needs to be converted to a string when comparing var id = '' + item.id; @@ -930,11 +1012,16 @@ S2.define('select2/results',[ option.className = 'select2-results__option'; var attrs = { - 'role': 'treeitem', + 'role': 'option', 'aria-selected': 'false' }; - if (data.disabled) { + var matches = window.Element.prototype.matches || + window.Element.prototype.msMatchesSelector || + window.Element.prototype.webkitMatchesSelector; + + if ((data.element != null && matches.call(data.element, ':disabled')) || + (data.element == null && data.disabled)) { delete attrs['aria-selected']; attrs['aria-disabled'] = 'true'; } @@ -994,7 +1081,7 @@ S2.define('select2/results',[ this.template(data, option); } - $.data(option, 'data', data); + Utils.StoreData(option, 'data', data); return option; }; @@ -1035,7 +1122,10 @@ S2.define('select2/results',[ } self.setClasses(); - self.highlightFirstItem(); + + if (self.options.get('scrollAfterSelect')) { + self.highlightFirstItem(); + } }); container.on('unselect', function () { @@ -1044,7 +1134,10 @@ S2.define('select2/results',[ } self.setClasses(); - self.highlightFirstItem(); + + if (self.options.get('scrollAfterSelect')) { + self.highlightFirstItem(); + } }); container.on('open', function () { @@ -1080,7 +1173,7 @@ S2.define('select2/results',[ return; } - var data = $highlighted.data('data'); + var data = Utils.GetData($highlighted[0], 'data'); if ($highlighted.attr('aria-selected') == 'true') { self.trigger('close', {}); @@ -1098,8 +1191,9 @@ S2.define('select2/results',[ var currentIndex = $options.index($highlighted); - // If we are already at te top, don't move further - if (currentIndex === 0) { + // If we are already at the top, don't move further + // If no options, currentIndex will be -1 + if (currentIndex <= 0) { return; } @@ -1192,7 +1286,7 @@ S2.define('select2/results',[ function (evt) { var $this = $(this); - var data = $this.data('data'); + var data = Utils.GetData(this, 'data'); if ($this.attr('aria-selected') === 'true') { if (self.options.get('multiple')) { @@ -1215,7 +1309,7 @@ S2.define('select2/results',[ this.$results.on('mouseenter', '.select2-results__option[aria-selected]', function (evt) { - var data = $(this).data('data'); + var data = Utils.GetData(this, 'data'); self.getHighlightedResults() .removeClass('select2-results__option--highlighted'); @@ -1330,14 +1424,15 @@ S2.define('select2/selection/base',[ this._tabindex = 0; - if (this.$element.data('old-tabindex') != null) { - this._tabindex = this.$element.data('old-tabindex'); + if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { + this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); } else if (this.$element.attr('tabindex') != null) { this._tabindex = this.$element.attr('tabindex'); } $selection.attr('title', this.$element.attr('title')); $selection.attr('tabindex', this._tabindex); + $selection.attr('aria-disabled', 'false'); this.$selection = $selection; @@ -1347,7 +1442,6 @@ S2.define('select2/selection/base',[ BaseSelection.prototype.bind = function (container, $container) { var self = this; - var id = container.id + '-container'; var resultsId = container.id + '-results'; this.container = container; @@ -1390,17 +1484,19 @@ S2.define('select2/selection/base',[ self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-owns'); - self.$selection.focus(); + self.$selection.trigger('focus'); self._detachCloseHandler(container); }); container.on('enable', function () { self.$selection.attr('tabindex', self._tabindex); + self.$selection.attr('aria-disabled', 'false'); }); container.on('disable', function () { self.$selection.attr('tabindex', '-1'); + self.$selection.attr('aria-disabled', 'true'); }); }; @@ -1423,7 +1519,6 @@ S2.define('select2/selection/base',[ }; BaseSelection.prototype._attachCloseHandler = function (container) { - var self = this; $(document.body).on('mousedown.select2.' + container.id, function (e) { var $target = $(e.target); @@ -1433,13 +1528,11 @@ S2.define('select2/selection/base',[ var $all = $('.select2.select2-container--open'); $all.each(function () { - var $this = $(this); - if (this == $select[0]) { return; } - var $element = $this.data('element'); + var $element = Utils.GetData(this, 'element'); $element.select2('close'); }); @@ -1463,6 +1556,27 @@ S2.define('select2/selection/base',[ throw new Error('The `update` method must be defined in child classes.'); }; + /** + * Helper method to abstract the "enabled" (not "disabled") state of this + * object. + * + * @return {true} if the instance is not disabled. + * @return {false} if the instance is disabled. + */ + BaseSelection.prototype.isEnabled = function () { + return !this.isDisabled(); + }; + + /** + * Helper method to abstract the "disabled" state of this object. + * + * @return {true} if the disabled option is true. + * @return {false} if the disabled option is false. + */ + BaseSelection.prototype.isDisabled = function () { + return this.options.get('disabled'); + }; + return BaseSelection; }); @@ -1500,7 +1614,10 @@ S2.define('select2/selection/single',[ var id = container.id + '-container'; - this.$selection.find('.select2-selection__rendered').attr('id', id); + this.$selection.find('.select2-selection__rendered') + .attr('id', id) + .attr('role', 'textbox') + .attr('aria-readonly', 'true'); this.$selection.attr('aria-labelledby', id); this.$selection.on('mousedown', function (evt) { @@ -1524,17 +1641,15 @@ S2.define('select2/selection/single',[ container.on('focus', function (evt) { if (!container.isOpen()) { - self.$selection.focus(); + self.$selection.trigger('focus'); } }); - - container.on('selection:update', function (params) { - self.update(params.data); - }); }; SingleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); + var $rendered = this.$selection.find('.select2-selection__rendered'); + $rendered.empty(); + $rendered.removeAttr('title'); // clear tooltip on empty }; SingleSelection.prototype.display = function (data, container) { @@ -1560,7 +1675,14 @@ S2.define('select2/selection/single',[ var formatted = this.display(selection, $rendered); $rendered.empty().append(formatted); - $rendered.prop('title', selection.title || selection.text); + + var title = selection.title || selection.text; + + if (title) { + $rendered.attr('title', title); + } else { + $rendered.removeAttr('title'); + } }; return SingleSelection; @@ -1605,14 +1727,14 @@ S2.define('select2/selection/multiple',[ '.select2-selection__choice__remove', function (evt) { // Ignore the event if it is disabled - if (self.options.get('disabled')) { + if (self.isDisabled()) { return; } var $remove = $(this); var $selection = $remove.parent(); - var data = $selection.data('data'); + var data = Utils.GetData($selection[0], 'data'); self.trigger('unselect', { originalEvent: evt, @@ -1623,7 +1745,9 @@ S2.define('select2/selection/multiple',[ }; MultipleSelection.prototype.clear = function () { - this.$selection.find('.select2-selection__rendered').empty(); + var $rendered = this.$selection.find('.select2-selection__rendered'); + $rendered.empty(); + $rendered.removeAttr('title'); }; MultipleSelection.prototype.display = function (data, container) { @@ -1661,9 +1785,14 @@ S2.define('select2/selection/multiple',[ var formatted = this.display(selection, $selection); $selection.append(formatted); - $selection.prop('title', selection.title || selection.text); - $selection.data('data', selection); + var title = selection.title || selection.text; + + if (title) { + $selection.attr('title', title); + } + + Utils.StoreData($selection[0], 'data', selection); $selections.push($selection); } @@ -1728,8 +1857,9 @@ S2.define('select2/selection/placeholder',[ S2.define('select2/selection/allowClear',[ 'jquery', - '../keys' -], function ($, KEYS) { + '../keys', + '../utils' +], function ($, KEYS, Utils) { function AllowClear () { } AllowClear.prototype.bind = function (decorated, container, $container) { @@ -1758,7 +1888,7 @@ S2.define('select2/selection/allowClear',[ AllowClear.prototype._handleClear = function (_, evt) { // Ignore the event if it is disabled - if (this.options.get('disabled')) { + if (this.isDisabled()) { return; } @@ -1771,10 +1901,22 @@ S2.define('select2/selection/allowClear',[ evt.stopPropagation(); - var data = $clear.data('data'); + var data = Utils.GetData($clear[0], 'data'); + + var previousVal = this.$element.val(); + this.$element.val(this.placeholder.id); + + var unselectData = { + data: data + }; + this.trigger('clear', unselectData); + if (unselectData.prevented) { + this.$element.val(previousVal); + return; + } for (var d = 0; d < data.length; d++) { - var unselectData = { + unselectData = { data: data[d] }; @@ -1784,11 +1926,12 @@ S2.define('select2/selection/allowClear',[ // If the event was prevented, don't clear it out. if (unselectData.prevented) { + this.$element.val(previousVal); return; } } - this.$element.val(this.placeholder.id).trigger('change'); + this.$element.trigger('input').trigger('change'); this.trigger('toggle', {}); }; @@ -1811,12 +1954,14 @@ S2.define('select2/selection/allowClear',[ return; } + var removeAll = this.options.get('translations').get('removeAllItems'); + var $remove = $( - '' + + '' + '×' + '' ); - $remove.data('data', data); + Utils.StoreData($remove[0], 'data', data); this.$selection.find('.select2-selection__rendered').prepend($remove); }; @@ -1837,8 +1982,8 @@ S2.define('select2/selection/search',[ var $search = $( '' ); @@ -1855,14 +2000,18 @@ S2.define('select2/selection/search',[ Search.prototype.bind = function (decorated, container, $container) { var self = this; + var resultsId = container.id + '-results'; + decorated.call(this, container, $container); container.on('open', function () { + self.$search.attr('aria-controls', resultsId); self.$search.trigger('focus'); }); container.on('close', function () { self.$search.val(''); + self.$search.removeAttr('aria-controls'); self.$search.removeAttr('aria-activedescendant'); self.$search.trigger('focus'); }); @@ -1882,7 +2031,11 @@ S2.define('select2/selection/search',[ }); container.on('results:focus', function (params) { - self.$search.attr('aria-activedescendant', params.id); + if (params.data._resultId) { + self.$search.attr('aria-activedescendant', params.data._resultId); + } else { + self.$search.removeAttr('aria-activedescendant'); + } }); this.$selection.on('focusin', '.select2-search--inline', function (evt) { @@ -1907,7 +2060,7 @@ S2.define('select2/selection/search',[ .prev('.select2-selection__choice'); if ($previousChoice.length > 0) { - var item = $previousChoice.data('data'); + var item = Utils.GetData($previousChoice[0], 'data'); self.searchRemoveChoice(item); @@ -1916,6 +2069,12 @@ S2.define('select2/selection/search',[ } }); + this.$selection.on('click', '.select2-search--inline', function (evt) { + if (self.$search.val()) { + evt.stopPropagation(); + } + }); + // Try to detect the IE version should the `documentMode` property that // is stored on the document. This is only implemented in IE and is // slightly cleaner than doing a user agent check. @@ -2001,7 +2160,7 @@ S2.define('select2/selection/search',[ this.resizeSearch(); if (searchHadFocus) { - this.$search.focus(); + this.$search.trigger('focus'); } }; @@ -2034,7 +2193,7 @@ S2.define('select2/selection/search',[ var width = ''; if (this.$search.attr('placeholder') !== '') { - width = this.$selection.find('.select2-selection__rendered').innerWidth(); + width = this.$selection.find('.select2-selection__rendered').width(); } else { var minimumWidth = this.$search.val().length + 1; @@ -2058,10 +2217,13 @@ S2.define('select2/selection/eventRelay',[ 'open', 'opening', 'close', 'closing', 'select', 'selecting', - 'unselect', 'unselecting' + 'unselect', 'unselecting', + 'clear', 'clearing' ]; - var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; + var preventableEvents = [ + 'opening', 'closing', 'selecting', 'unselecting', 'clearing' + ]; decorated.call(this, container, $container); @@ -2394,6 +2556,7 @@ S2.define('select2/diacritics',[ '\u019F': 'O', '\uA74A': 'O', '\uA74C': 'O', + '\u0152': 'OE', '\u01A2': 'OI', '\uA74E': 'OO', '\u0222': 'OU', @@ -2803,6 +2966,7 @@ S2.define('select2/diacritics',[ '\uA74B': 'o', '\uA74D': 'o', '\u0275': 'o', + '\u0153': 'oe', '\u01A3': 'oi', '\u0223': 'ou', '\uA74F': 'oo', @@ -2971,8 +3135,9 @@ S2.define('select2/diacritics',[ '\u03CD': '\u03C5', '\u03CB': '\u03C5', '\u03B0': '\u03C5', - '\u03C9': '\u03C9', - '\u03C2': '\u03C3' + '\u03CE': '\u03C9', + '\u03C2': '\u03C3', + '\u2019': '\'' }; return diacritics; @@ -3057,7 +3222,7 @@ S2.define('select2/data/select',[ if ($(data.element).is('option')) { data.element.selected = true; - this.$element.trigger('change'); + this.$element.trigger('input').trigger('change'); return; } @@ -3078,13 +3243,13 @@ S2.define('select2/data/select',[ } self.$element.val(val); - self.$element.trigger('change'); + self.$element.trigger('input').trigger('change'); }); } else { var val = data.id; this.$element.val(val); - this.$element.trigger('change'); + this.$element.trigger('input').trigger('change'); } }; @@ -3100,7 +3265,7 @@ S2.define('select2/data/select',[ if ($(data.element).is('option')) { data.element.selected = false; - this.$element.trigger('change'); + this.$element.trigger('input').trigger('change'); return; } @@ -3118,7 +3283,7 @@ S2.define('select2/data/select',[ self.$element.val(val); - self.$element.trigger('change'); + self.$element.trigger('input').trigger('change'); }); }; @@ -3140,7 +3305,7 @@ S2.define('select2/data/select',[ // Remove anything added to child elements this.$element.find('*').each(function () { // Remove any custom data set by Select2 - $.removeData(this, 'data'); + Utils.RemoveData(this); }); }; @@ -3191,7 +3356,7 @@ S2.define('select2/data/select',[ } } - if (data.id) { + if (data.id !== undefined) { option.value = data.id; } @@ -3213,7 +3378,7 @@ S2.define('select2/data/select',[ normalizedData.element = option; // Override the option's data with the combined data - $.data(option, 'data', normalizedData); + Utils.StoreData(option, 'data', normalizedData); return $option; }; @@ -3221,7 +3386,7 @@ S2.define('select2/data/select',[ SelectAdapter.prototype.item = function ($option) { var data = {}; - data = $.data($option[0], 'data'); + data = Utils.GetData($option[0], 'data'); if (data != null) { return data; @@ -3259,13 +3424,13 @@ S2.define('select2/data/select',[ data = this._normalizeItem(data); data.element = $option[0]; - $.data($option[0], 'data', data); + Utils.StoreData($option[0], 'data', data); return data; }; SelectAdapter.prototype._normalizeItem = function (item) { - if (!$.isPlainObject(item)) { + if (item !== Object(item)) { item = { id: item, text: item @@ -3311,15 +3476,19 @@ S2.define('select2/data/array',[ 'jquery' ], function (SelectAdapter, Utils, $) { function ArrayAdapter ($element, options) { - var data = options.get('data') || []; + this._dataToConvert = options.get('data') || []; ArrayAdapter.__super__.constructor.call(this, $element, options); - - this.addOptions(this.convertToOptions(data)); } Utils.Extend(ArrayAdapter, SelectAdapter); + ArrayAdapter.prototype.bind = function (container, $container) { + ArrayAdapter.__super__.bind.call(this, container, $container); + + this.addOptions(this.convertToOptions(this._dataToConvert)); + }; + ArrayAdapter.prototype.select = function (data) { var $option = this.$element.find('option').filter(function (i, elm) { return elm.value == data.id.toString(); @@ -3469,7 +3638,8 @@ S2.define('select2/data/ajax',[ }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property - if ($request.status && $request.status === '0') { + if ('status' in $request && + ($request.status === 0 || $request.status === '0')) { return; } @@ -3550,7 +3720,10 @@ S2.define('select2/data/tags',[ }, true) ); - var checkText = option.text === params.term; + var optionText = (option.text || '').toUpperCase(); + var paramsTerm = (params.term || '').toUpperCase(); + + var checkText = optionText === paramsTerm; if (checkText || checkChildren) { if (child) { @@ -3605,8 +3778,6 @@ S2.define('select2/data/tags',[ }; Tags.prototype._removeOldTags = function (_) { - var tag = this._lastTag; - var $options = this.$element.find('option[data-select2-tag]'); $options.each(function () { @@ -3681,7 +3852,7 @@ S2.define('select2/data/tokenizer',[ // Replace the search term if we have the search box if (this.$search.length) { this.$search.val(tokenData.term); - this.$search.focus(); + this.$search.trigger('focus'); } params.term = tokenData.term; @@ -3810,10 +3981,30 @@ S2.define('select2/data/maximumSelectionLength',[ decorated.call(this, $e, options); } + MaximumSelectionLength.prototype.bind = + function (decorated, container, $container) { + var self = this; + + decorated.call(this, container, $container); + + container.on('select', function () { + self._checkIfMaximumSelected(); + }); + }; + MaximumSelectionLength.prototype.query = function (decorated, params, callback) { var self = this; + this._checkIfMaximumSelected(function () { + decorated.call(self, params, callback); + }); + }; + + MaximumSelectionLength.prototype._checkIfMaximumSelected = + function (_, successCallback) { + var self = this; + this.current(function (currentData) { var count = currentData != null ? currentData.length : 0; if (self.maximumSelectionLength > 0 && @@ -3826,7 +4017,10 @@ S2.define('select2/data/maximumSelectionLength',[ }); return; } - decorated.call(self, params, callback); + + if (successCallback) { + successCallback(); + } }); }; @@ -3865,7 +4059,7 @@ S2.define('select2/dropdown',[ }; Dropdown.prototype.position = function ($dropdown, $container) { - // Should be implmented in subclasses + // Should be implemented in subclasses }; Dropdown.prototype.destroy = function () { @@ -3888,8 +4082,8 @@ S2.define('select2/dropdown/search',[ var $search = $( '' + '' + + ' autocomplete="off" autocorrect="off" autocapitalize="none"' + + ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + '' ); @@ -3904,6 +4098,8 @@ S2.define('select2/dropdown/search',[ Search.prototype.bind = function (decorated, container, $container) { var self = this; + var resultsId = container.id + '-results'; + decorated.call(this, container, $container); this.$search.on('keydown', function (evt) { @@ -3926,23 +4122,27 @@ S2.define('select2/dropdown/search',[ container.on('open', function () { self.$search.attr('tabindex', 0); + self.$search.attr('aria-controls', resultsId); - self.$search.focus(); + self.$search.trigger('focus'); window.setTimeout(function () { - self.$search.focus(); + self.$search.trigger('focus'); }, 0); }); container.on('close', function () { self.$search.attr('tabindex', -1); + self.$search.removeAttr('aria-controls'); + self.$search.removeAttr('aria-activedescendant'); self.$search.val(''); + self.$search.trigger('blur'); }); container.on('focus', function () { - if (container.isOpen()) { - self.$search.focus(); + if (!container.isOpen()) { + self.$search.trigger('focus'); } }); @@ -3957,6 +4157,14 @@ S2.define('select2/dropdown/search',[ } } }); + + container.on('results:focus', function (params) { + if (params.data._resultId) { + self.$search.attr('aria-activedescendant', params.data._resultId); + } else { + self.$search.removeAttr('aria-activedescendant'); + } + }); }; Search.prototype.handleSearch = function (evt) { @@ -4041,6 +4249,7 @@ S2.define('select2/dropdown/infiniteScroll',[ if (this.showLoadingMore(data)) { this.$results.append(this.$loadingMore); + this.loadMoreIfNeeded(); } }; @@ -4059,25 +4268,27 @@ S2.define('select2/dropdown/infiniteScroll',[ self.loading = true; }); - this.$results.on('scroll', function () { - var isLoadMoreVisible = $.contains( - document.documentElement, - self.$loadingMore[0] - ); + this.$results.on('scroll', this.loadMoreIfNeeded.bind(this)); + }; - if (self.loading || !isLoadMoreVisible) { - return; - } + InfiniteScroll.prototype.loadMoreIfNeeded = function () { + var isLoadMoreVisible = $.contains( + document.documentElement, + this.$loadingMore[0] + ); - var currentOffset = self.$results.offset().top + - self.$results.outerHeight(false); - var loadingMoreOffset = self.$loadingMore.offset().top + - self.$loadingMore.outerHeight(false); + if (this.loading || !isLoadMoreVisible) { + return; + } - if (currentOffset + 50 >= loadingMoreOffset) { - self.loadMore(); - } - }); + var currentOffset = this.$results.offset().top + + this.$results.outerHeight(false); + var loadingMoreOffset = this.$loadingMore.offset().top + + this.$loadingMore.outerHeight(false); + + if (currentOffset + 50 >= loadingMoreOffset) { + this.loadMore(); + } }; InfiniteScroll.prototype.loadMore = function () { @@ -4098,7 +4309,7 @@ S2.define('select2/dropdown/infiniteScroll',[ var $option = $( '
    • ' + 'role="option" aria-disabled="true">' ); var message = this.options.get('translations').get('loadingMore'); @@ -4116,7 +4327,7 @@ S2.define('select2/dropdown/attachBody',[ '../utils' ], function ($, Utils) { function AttachBody (decorated, $element, options) { - this.$dropdownParent = options.get('dropdownParent') || $(document.body); + this.$dropdownParent = $(options.get('dropdownParent') || document.body); decorated.call(this, $element, options); } @@ -4124,27 +4335,14 @@ S2.define('select2/dropdown/attachBody',[ AttachBody.prototype.bind = function (decorated, container, $container) { var self = this; - var setupResultsEvents = false; - decorated.call(this, container, $container); container.on('open', function () { self._showDropdown(); self._attachPositioningHandler(container); - if (!setupResultsEvents) { - setupResultsEvents = true; - - container.on('results:all', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - - container.on('results:append', function () { - self._positionDropdown(); - self._resizeDropdown(); - }); - } + // Must bind after the results handlers to ensure correct sizing + self._bindContainerResultHandlers(container); }); container.on('close', function () { @@ -4193,6 +4391,44 @@ S2.define('select2/dropdown/attachBody',[ this.$dropdownContainer.detach(); }; + AttachBody.prototype._bindContainerResultHandlers = + function (decorated, container) { + + // These should only be bound once + if (this._containerResultsHandlersBound) { + return; + } + + var self = this; + + container.on('results:all', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('results:append', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('results:message', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('select', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + container.on('unselect', function () { + self._positionDropdown(); + self._resizeDropdown(); + }); + + this._containerResultsHandlersBound = true; + }; + AttachBody.prototype._attachPositioningHandler = function (decorated, container) { var self = this; @@ -4203,14 +4439,14 @@ S2.define('select2/dropdown/attachBody',[ var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.each(function () { - $(this).data('select2-scroll-position', { + Utils.StoreData(this, 'select2-scroll-position', { x: $(this).scrollLeft(), y: $(this).scrollTop() }); }); $watchers.on(scrollEvent, function (ev) { - var position = $(this).data('select2-scroll-position'); + var position = Utils.GetData(this, 'select2-scroll-position'); $(this).scrollTop(position.y); }); @@ -4269,16 +4505,26 @@ S2.define('select2/dropdown/attachBody',[ top: container.bottom }; - // Determine what the parent element is to use for calciulating the offset + // Determine what the parent element is to use for calculating the offset var $offsetParent = this.$dropdownParent; - // For statically positoned elements, we need to get the element + // For statically positioned elements, we need to get the element // that is determining the offset if ($offsetParent.css('position') === 'static') { $offsetParent = $offsetParent.offsetParent(); } - var parentOffset = $offsetParent.offset(); + var parentOffset = { + top: 0, + left: 0 + }; + + if ( + $.contains(document.body, $offsetParent[0]) || + $offsetParent[0].isConnected + ) { + parentOffset = $offsetParent.offset(); + } css.top -= parentOffset.top; css.left -= parentOffset.left; @@ -4375,8 +4621,8 @@ S2.define('select2/dropdown/minimumResultsForSearch',[ }); S2.define('select2/dropdown/selectOnClose',[ - -], function () { + '../utils' +], function (Utils) { function SelectOnClose () { } SelectOnClose.prototype.bind = function (decorated, container, $container) { @@ -4407,7 +4653,7 @@ S2.define('select2/dropdown/selectOnClose',[ return; } - var data = $highlightedResults.data('data'); + var data = Utils.GetData($highlightedResults[0], 'data'); // Don't re-select already selected resulte if ( @@ -4448,7 +4694,7 @@ S2.define('select2/dropdown/closeOnSelect',[ var originalEvent = evt.originalEvent; // Don't close if the control key is being held - if (originalEvent && originalEvent.ctrlKey) { + if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) { return; } @@ -4502,6 +4748,9 @@ S2.define('select2/i18n/en',[],function () { }, searching: function () { return 'Searching…'; + }, + removeAllItems: function () { + return 'Remove all items'; } }; }); @@ -4740,66 +4989,29 @@ S2.define('select2/defaults',[ ); } - if (typeof options.language === 'string') { - // Check if the language is specified with a region - if (options.language.indexOf('-') > 0) { - // Extract the region information if it is included - var languageParts = options.language.split('-'); - var baseLanguage = languageParts[0]; - - options.language = [options.language, baseLanguage]; - } else { - options.language = [options.language]; - } - } - - if ($.isArray(options.language)) { - var languages = new Translation(); - options.language.push('en'); + // If the defaults were not previously applied from an element, it is + // possible for the language option to have not been resolved + options.language = this._resolveLanguage(options.language); - var languageNames = options.language; + // Always fall back to English since it will always be complete + options.language.push('en'); - for (var l = 0; l < languageNames.length; l++) { - var name = languageNames[l]; - var language = {}; + var uniqueLanguages = []; - try { - // Try to load it with the original name - language = Translation.loadPath(name); - } catch (e) { - try { - // If we couldn't load it, check if it wasn't the full path - name = this.defaults.amdLanguageBase + name; - language = Translation.loadPath(name); - } catch (ex) { - // The translation could not be loaded at all. Sometimes this is - // because of a configuration problem, other times this can be - // because of how Select2 helps load all possible translation files. - if (options.debug && window.console && console.warn) { - console.warn( - 'Select2: The language file for "' + name + '" could not be ' + - 'automatically loaded. A fallback will be used instead.' - ); - } + for (var l = 0; l < options.language.length; l++) { + var language = options.language[l]; - continue; - } - } - - languages.extend(language); + if (uniqueLanguages.indexOf(language) === -1) { + uniqueLanguages.push(language); } + } - options.translations = languages; - } else { - var baseTranslation = Translation.loadPath( - this.defaults.amdLanguageBase + 'en' - ); - var customTranslation = new Translation(options.language); - - customTranslation.extend(baseTranslation); + options.language = uniqueLanguages; - options.translations = customTranslation; - } + options.translations = this._processTranslations( + options.language, + options.debug + ); return options; }; @@ -4866,13 +5078,14 @@ S2.define('select2/defaults',[ debug: false, dropdownAutoWidth: false, escapeMarkup: Utils.escapeMarkup, - language: EnglishTranslation, + language: {}, matcher: matcher, minimumInputLength: 0, maximumInputLength: 0, maximumSelectionLength: 0, minimumResultsForSearch: 0, selectOnClose: false, + scrollAfterSelect: false, sorter: function (data) { return data; }, @@ -4887,6 +5100,103 @@ S2.define('select2/defaults',[ }; }; + Defaults.prototype.applyFromElement = function (options, $element) { + var optionLanguage = options.language; + var defaultLanguage = this.defaults.language; + var elementLanguage = $element.prop('lang'); + var parentLanguage = $element.closest('[lang]').prop('lang'); + + var languages = Array.prototype.concat.call( + this._resolveLanguage(elementLanguage), + this._resolveLanguage(optionLanguage), + this._resolveLanguage(defaultLanguage), + this._resolveLanguage(parentLanguage) + ); + + options.language = languages; + + return options; + }; + + Defaults.prototype._resolveLanguage = function (language) { + if (!language) { + return []; + } + + if ($.isEmptyObject(language)) { + return []; + } + + if ($.isPlainObject(language)) { + return [language]; + } + + var languages; + + if (!$.isArray(language)) { + languages = [language]; + } else { + languages = language; + } + + var resolvedLanguages = []; + + for (var l = 0; l < languages.length; l++) { + resolvedLanguages.push(languages[l]); + + if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) { + // Extract the region information if it is included + var languageParts = languages[l].split('-'); + var baseLanguage = languageParts[0]; + + resolvedLanguages.push(baseLanguage); + } + } + + return resolvedLanguages; + }; + + Defaults.prototype._processTranslations = function (languages, debug) { + var translations = new Translation(); + + for (var l = 0; l < languages.length; l++) { + var languageData = new Translation(); + + var language = languages[l]; + + if (typeof language === 'string') { + try { + // Try to load it with the original name + languageData = Translation.loadPath(language); + } catch (e) { + try { + // If we couldn't load it, check if it wasn't the full path + language = this.defaults.amdLanguageBase + language; + languageData = Translation.loadPath(language); + } catch (ex) { + // The translation could not be loaded at all. Sometimes this is + // because of a configuration problem, other times this can be + // because of how Select2 helps load all possible translation files + if (debug && window.console && console.warn) { + console.warn( + 'Select2: The language file for "' + language + '" could ' + + 'not be automatically loaded. A fallback will be used instead.' + ); + } + } + } + } else if ($.isPlainObject(language)) { + languageData = new Translation(language); + } else { + languageData = language; + } + + translations.extend(languageData); + } + + return translations; + }; + Defaults.prototype.set = function (key, value) { var camelKey = $.camelCase(key); @@ -4895,7 +5205,7 @@ S2.define('select2/defaults',[ var convertedData = Utils._convertData(data); - $.extend(this.defaults, convertedData); + $.extend(true, this.defaults, convertedData); }; var defaults = new Defaults(); @@ -4916,6 +5226,10 @@ S2.define('select2/options',[ this.fromElement($element); } + if ($element != null) { + this.options = Defaults.applyFromElement(this.options, $element); + } + this.options = Defaults.apply(this.options); if ($element && $element.is('input')) { @@ -4939,14 +5253,6 @@ S2.define('select2/options',[ this.options.disabled = $e.prop('disabled'); } - if (this.options.language == null) { - if ($e.prop('lang')) { - this.options.language = $e.prop('lang').toLowerCase(); - } else if ($e.closest('[lang]').prop('lang')) { - this.options.language = $e.closest('[lang]').prop('lang'); - } - } - if (this.options.dir == null) { if ($e.prop('dir')) { this.options.dir = $e.prop('dir'); @@ -4960,7 +5266,7 @@ S2.define('select2/options',[ $e.prop('disabled', this.options.disabled); $e.prop('multiple', this.options.multiple); - if ($e.data('select2Tags')) { + if (Utils.GetData($e[0], 'select2Tags')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-select2-tags` attribute has been changed to ' + @@ -4969,11 +5275,11 @@ S2.define('select2/options',[ ); } - $e.data('data', $e.data('select2Tags')); - $e.data('tags', true); + Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); + Utils.StoreData($e[0], 'tags', true); } - if ($e.data('ajaxUrl')) { + if (Utils.GetData($e[0], 'ajaxUrl')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-ajax-url` attribute has been changed to ' + @@ -4982,21 +5288,45 @@ S2.define('select2/options',[ ); } - $e.attr('ajax--url', $e.data('ajaxUrl')); - $e.data('ajax--url', $e.data('ajaxUrl')); + $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); + Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); } var dataset = {}; + function upperCaseLetter(_, letter) { + return letter.toUpperCase(); + } + + // Pre-load all of the attributes which are prefixed with `data-` + for (var attr = 0; attr < $e[0].attributes.length; attr++) { + var attributeName = $e[0].attributes[attr].name; + var prefix = 'data-'; + + if (attributeName.substr(0, prefix.length) == prefix) { + // Get the contents of the attribute after `data-` + var dataName = attributeName.substring(prefix.length); + + // Get the data contents from the consistent source + // This is more than likely the jQuery data helper + var dataValue = Utils.GetData($e[0], dataName); + + // camelCase the attribute name to match the spec + var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter); + + // Store the data attribute contents into the dataset since + dataset[camelDataName] = dataValue; + } + } + // Prefer the element's `dataset` attribute if it exists // jQuery 1.x does not correctly handle data attributes with multiple dashes if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { - dataset = $.extend(true, {}, $e[0].dataset, $e.data()); - } else { - dataset = $e.data(); + dataset = $.extend(true, {}, $e[0].dataset, dataset); } - var data = $.extend(true, {}, dataset); + // Prefer our internal data cache if it exists + var data = $.extend(true, {}, Utils.GetData($e[0]), dataset); data = Utils._convertData(data); @@ -5033,8 +5363,8 @@ S2.define('select2/core',[ './keys' ], function ($, Options, Utils, KEYS) { var Select2 = function ($element, options) { - if ($element.data('select2') != null) { - $element.data('select2').destroy(); + if (Utils.GetData($element[0], 'select2') != null) { + Utils.GetData($element[0], 'select2').destroy(); } this.$element = $element; @@ -5050,7 +5380,7 @@ S2.define('select2/core',[ // Set up the tabindex var tabindex = $element.attr('tabindex') || 0; - $element.data('old-tabindex', tabindex); + Utils.StoreData($element[0], 'old-tabindex', tabindex); $element.attr('tabindex', '-1'); // Set up containers and adapters @@ -5111,6 +5441,9 @@ S2.define('select2/core',[ // Synchronize any monitored attributes this._syncAttributes(); + Utils.StoreData($element[0], 'select2', this); + + // Ensure backwards compatibility with $element.data('select2'). $element.data('select2', this); }; @@ -5187,6 +5520,12 @@ S2.define('select2/core',[ return null; } + if (method == 'computedstyle') { + var computedStyle = window.getComputedStyle($element[0]); + + return computedStyle.width; + } + return method; }; @@ -5227,8 +5566,8 @@ S2.define('select2/core',[ if (observer != null) { this._observer = new observer(function (mutations) { - $.each(mutations, self._syncA); - $.each(mutations, self._syncS); + self._syncA(); + self._syncS(null, mutations); }); this._observer.observe(this.$element[0], { attributes: true, @@ -5350,7 +5689,7 @@ S2.define('select2/core',[ if (self.isOpen()) { if (key === KEYS.ESC || key === KEYS.TAB || (key === KEYS.UP && evt.altKey)) { - self.close(); + self.close(evt); evt.preventDefault(); } else if (key === KEYS.ENTER) { @@ -5384,7 +5723,7 @@ S2.define('select2/core',[ Select2.prototype._syncAttributes = function () { this.options.set('disabled', this.$element.prop('disabled')); - if (this.options.get('disabled')) { + if (this.isDisabled()) { if (this.isOpen()) { this.close(); } @@ -5395,7 +5734,7 @@ S2.define('select2/core',[ } }; - Select2.prototype._syncSubtree = function (evt, mutations) { + Select2.prototype._isChangeMutation = function (evt, mutations) { var changed = false; var self = this; @@ -5423,7 +5762,22 @@ S2.define('select2/core',[ } } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { changed = true; + } else if ($.isArray(mutations)) { + $.each(mutations, function(evt, mutation) { + if (self._isChangeMutation(evt, mutation)) { + // We've found a change mutation. + // Let's escape from the loop and continue + changed = true; + return false; + } + }); } + return changed; + }; + + Select2.prototype._syncSubtree = function (evt, mutations) { + var changed = this._isChangeMutation(evt, mutations); + var self = this; // Only re-pull the data if we think there is a change if (changed) { @@ -5445,7 +5799,8 @@ S2.define('select2/core',[ 'open': 'opening', 'close': 'closing', 'select': 'selecting', - 'unselect': 'unselecting' + 'unselect': 'unselecting', + 'clear': 'clearing' }; if (args === undefined) { @@ -5473,7 +5828,7 @@ S2.define('select2/core',[ }; Select2.prototype.toggleDropdown = function () { - if (this.options.get('disabled')) { + if (this.isDisabled()) { return; } @@ -5489,15 +5844,40 @@ S2.define('select2/core',[ return; } + if (this.isDisabled()) { + return; + } + this.trigger('query', {}); }; - Select2.prototype.close = function () { + Select2.prototype.close = function (evt) { if (!this.isOpen()) { return; } - this.trigger('close', {}); + this.trigger('close', { originalEvent : evt }); + }; + + /** + * Helper method to abstract the "enabled" (not "disabled") state of this + * object. + * + * @return {true} if the instance is not disabled. + * @return {false} if the instance is disabled. + */ + Select2.prototype.isEnabled = function () { + return !this.isDisabled(); + }; + + /** + * Helper method to abstract the "disabled" state of this object. + * + * @return {true} if the disabled option is true. + * @return {false} if the disabled option is false. + */ + Select2.prototype.isDisabled = function () { + return this.options.get('disabled'); }; Select2.prototype.isOpen = function () { @@ -5574,7 +5954,7 @@ S2.define('select2/core',[ }); } - this.$element.val(newVal).trigger('change'); + this.$element.val(newVal).trigger('input').trigger('change'); }; Select2.prototype.destroy = function () { @@ -5600,10 +5980,12 @@ S2.define('select2/core',[ this._syncS = null; this.$element.off('.select2'); - this.$element.attr('tabindex', this.$element.data('old-tabindex')); + this.$element.attr('tabindex', + Utils.GetData(this.$element[0], 'old-tabindex')); this.$element.removeClass('select2-hidden-accessible'); this.$element.attr('aria-hidden', 'false'); + Utils.RemoveData(this.$element[0]); this.$element.removeData('select2'); this.dataAdapter.destroy(); @@ -5631,7 +6013,7 @@ S2.define('select2/core',[ this.$container.addClass('select2-container--' + this.options.get('theme')); - $container.data('element', this.$element); + Utils.StoreData($container[0], 'element', this.$element); return $container; }; @@ -5651,8 +6033,9 @@ S2.define('jquery.select2',[ 'jquery-mousewheel', './select2/core', - './select2/defaults' -], function ($, _, Select2, Defaults) { + './select2/defaults', + './select2/utils' +], function ($, _, Select2, Defaults, Utils) { if ($.fn.select2 == null) { // All methods that should return the element var thisMethods = ['open', 'close', 'destroy']; @@ -5673,7 +6056,7 @@ S2.define('jquery.select2',[ var args = Array.prototype.slice.call(arguments, 1); this.each(function () { - var instance = $(this).data('select2'); + var instance = Utils.GetData(this, 'select2'); if (instance == null && window.console && console.error) { console.error( diff --git a/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.min.js b/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.min.js index 43f0a651e..e42142643 100644 --- a/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.min.js +++ b/src/main/resources/gwt/material/design/addins/client/combobox/resources/js/select2.min.js @@ -1,3 +1,2 @@ -/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
        ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
      • '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
          '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('
        • ×
        • ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('×');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change"); -if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
        • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null; -},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c}); \ No newline at end of file +/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ +!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(u){var e=function(){if(u&&u.fn&&u.fn.select2&&u.fn.select2.amd)var e=u.fn.select2.amd;var t,n,r,h,o,s,f,g,m,v,y,_,i,a,b;function w(e,t){return i.call(e,t)}function l(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},i.StoreData=function(e,t,n){var r=i.GetUniqueElementId(e);i.__cache[r]||(i.__cache[r]={}),i.__cache[r][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i}),e.define("select2/results",["jquery","./utils"],function(h,f){function r(e,t,n){this.$element=e,this.data=n,this.options=t,r.__super__.constructor.call(this)}return f.Extend(r,f.Observable),r.prototype.render=function(){var e=h('
            ');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},r.prototype.clear=function(){this.$results.empty()},r.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h(''),r=this.options.get("translations").get(e.message);n.append(t(r(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},r.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},r.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},r.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var i=t.eq(r);i.trigger("mouseenter");var o=l.$results.offset().top,s=i.offset().top,a=l.$results.scrollTop()+(s-o);0===r?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var i=l.$results.offset().top+l.$results.outerHeight(!1),o=r.offset().top+r.outerHeight(!1),s=l.$results.scrollTop()+o-i;0===n?l.$results.scrollTop(0):ithis.$results.outerHeight()||o<0)&&this.$results.scrollTop(i)}},r.prototype.template=function(e,t){var n=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=n(e,t);null==i?t.style.display="none":"string"==typeof i?t.innerHTML=r(i):h(t).append(i)},r}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,r,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return r.Extend(o,r.Observable),o.prototype.render=function(){var e=n('');return this._tabindex=0,null!=r.GetData(this.$element[0],"old-tabindex")?this._tabindex=r.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",r),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&r.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,r){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(''),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var r=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("")},i.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var i=t.title||t.text;i?n.attr("title",i):n.removeAttr("title")}else this.clear()},i}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('
              '),e},n.prototype.bind=function(e,t){var r=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!r.isDisabled()){var t=i(this).parent(),n=l.GetData(t[0],"data");r.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return i('
            • ×
            • ')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n×
              ');a.StoreData(r[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(r)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(r,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=r('');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('
            • '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(""),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ai.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1 Date: Tue, 3 Mar 2020 15:35:25 +0800 Subject: [PATCH 05/70] CountUpJs upgraded from 1.9.0 to 2.0.4 --- .../countup/MaterialCountUpClientBundle.java | 2 +- .../MaterialCountUpDebugClientBundle.java | 2 +- .../client/countup/resources/js/countUp.js | 248 ++++++++++++++++++ .../countup/resources/js/countUp.min.js | 1 + .../client/countup/resources/js/countup.js | 196 -------------- .../countup/resources/js/countup.min.js | 1 - 6 files changed, 251 insertions(+), 199 deletions(-) create mode 100644 src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.js create mode 100644 src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.min.js delete mode 100644 src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.js delete mode 100644 src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.min.js diff --git a/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpClientBundle.java b/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpClientBundle.java index b20c5f91b..ea99bd26e 100644 --- a/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpClientBundle.java +++ b/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpClientBundle.java @@ -32,6 +32,6 @@ interface MaterialCountUpClientBundle extends ClientBundle { MaterialCountUpClientBundle INSTANCE = GWT.create(MaterialCountUpClientBundle.class); - @Source("resources/js/countup.min.js") + @Source("resources/js/countUp.min.js") TextResource countUpJs(); } diff --git a/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpDebugClientBundle.java b/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpDebugClientBundle.java index 99d2b71cb..037405c36 100644 --- a/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpDebugClientBundle.java +++ b/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUpDebugClientBundle.java @@ -32,6 +32,6 @@ interface MaterialCountUpDebugClientBundle extends ClientBundle { MaterialCountUpDebugClientBundle INSTANCE = GWT.create(MaterialCountUpDebugClientBundle.class); - @Source("resources/js/countup.js") + @Source("resources/js/countUp.js") TextResource countUpJsDebug(); } diff --git a/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.js b/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.js new file mode 100644 index 000000000..0bc799139 --- /dev/null +++ b/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.js @@ -0,0 +1,248 @@ +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +// playground: stackblitz.com/edit/countup-typescript +var CountUp = /** @class */ (function () { + function CountUp(target, endVal, options) { + var _this = this; + this.target = target; + this.endVal = endVal; + this.options = options; + this.version = '2.0.4'; + this.defaults = { + startVal: 0, + decimalPlaces: 0, + duration: 2, + useEasing: true, + useGrouping: true, + smartEasingThreshold: 999, + smartEasingAmount: 333, + separator: ',', + decimal: '.', + prefix: '', + suffix: '' + }; + this.finalEndVal = null; // for smart easing + this.useEasing = true; + this.countDown = false; + this.error = ''; + this.startVal = 0; + this.paused = true; + this.count = function (timestamp) { + if (!_this.startTime) { + _this.startTime = timestamp; + } + var progress = timestamp - _this.startTime; + _this.remaining = _this.duration - progress; + // to ease or not to ease + if (_this.useEasing) { + if (_this.countDown) { + _this.frameVal = _this.startVal - _this.easingFn(progress, 0, _this.startVal - _this.endVal, _this.duration); + } + else { + _this.frameVal = _this.easingFn(progress, _this.startVal, _this.endVal - _this.startVal, _this.duration); + } + } + else { + if (_this.countDown) { + _this.frameVal = _this.startVal - ((_this.startVal - _this.endVal) * (progress / _this.duration)); + } + else { + _this.frameVal = _this.startVal + (_this.endVal - _this.startVal) * (progress / _this.duration); + } + } + // don't go past endVal since progress can exceed duration in the last frame + if (_this.countDown) { + _this.frameVal = (_this.frameVal < _this.endVal) ? _this.endVal : _this.frameVal; + } + else { + _this.frameVal = (_this.frameVal > _this.endVal) ? _this.endVal : _this.frameVal; + } + // decimal + _this.frameVal = Math.round(_this.frameVal * _this.decimalMult) / _this.decimalMult; + // format and print value + _this.printValue(_this.frameVal); + // whether to continue + if (progress < _this.duration) { + _this.rAF = requestAnimationFrame(_this.count); + } + else if (_this.finalEndVal !== null) { + // smart easing + _this.update(_this.finalEndVal); + } + else { + if (_this.callback) { + _this.callback(); + } + } + }; + // default format and easing functions + this.formatNumber = function (num) { + var neg = (num < 0) ? '-' : ''; + var result, x, x1, x2, x3; + result = Math.abs(num).toFixed(_this.options.decimalPlaces); + result += ''; + x = result.split('.'); + x1 = x[0]; + x2 = x.length > 1 ? _this.options.decimal + x[1] : ''; + if (_this.options.useGrouping) { + x3 = ''; + for (var i = 0, len = x1.length; i < len; ++i) { + if (i !== 0 && (i % 3) === 0) { + x3 = _this.options.separator + x3; + } + x3 = x1[len - i - 1] + x3; + } + x1 = x3; + } + // optional numeral substitution + if (_this.options.numerals && _this.options.numerals.length) { + x1 = x1.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; }); + x2 = x2.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; }); + } + return neg + _this.options.prefix + x1 + x2 + _this.options.suffix; + }; + this.easeOutExpo = function (t, b, c, d) { + return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; + }; + this.options = __assign({}, this.defaults, options); + this.formattingFn = (this.options.formattingFn) ? + this.options.formattingFn : this.formatNumber; + this.easingFn = (this.options.easingFn) ? + this.options.easingFn : this.easeOutExpo; + this.startVal = this.validateValue(this.options.startVal); + this.frameVal = this.startVal; + this.endVal = this.validateValue(endVal); + this.options.decimalPlaces = Math.max(0 || this.options.decimalPlaces); + this.decimalMult = Math.pow(10, this.options.decimalPlaces); + this.resetDuration(); + this.options.separator = String(this.options.separator); + this.useEasing = this.options.useEasing; + if (this.options.separator === '') { + this.options.useGrouping = false; + } + this.el = (typeof target === 'string') ? document.getElementById(target) : target; + if (this.el) { + this.printValue(this.startVal); + } + else { + this.error = '[CountUp] target is null or undefined'; + } + } + // determines where easing starts and whether to count down or up + CountUp.prototype.determineDirectionAndSmartEasing = function () { + var end = (this.finalEndVal) ? this.finalEndVal : this.endVal; + this.countDown = (this.startVal > end); + var animateAmount = end - this.startVal; + if (Math.abs(animateAmount) > this.options.smartEasingThreshold) { + this.finalEndVal = end; + var up = (this.countDown) ? 1 : -1; + this.endVal = end + (up * this.options.smartEasingAmount); + this.duration = this.duration / 2; + } + else { + this.endVal = end; + this.finalEndVal = null; + } + if (this.finalEndVal) { + this.useEasing = false; + } + else { + this.useEasing = this.options.useEasing; + } + }; + // start animation + CountUp.prototype.start = function (callback) { + if (this.error) { + return; + } + this.callback = callback; + if (this.duration > 0) { + this.determineDirectionAndSmartEasing(); + this.paused = false; + this.rAF = requestAnimationFrame(this.count); + } + else { + this.printValue(this.endVal); + } + }; + // pause/resume animation + CountUp.prototype.pauseResume = function () { + if (!this.paused) { + cancelAnimationFrame(this.rAF); + } + else { + this.startTime = null; + this.duration = this.remaining; + this.startVal = this.frameVal; + this.determineDirectionAndSmartEasing(); + this.rAF = requestAnimationFrame(this.count); + } + this.paused = !this.paused; + }; + // reset to startVal so animation can be run again + CountUp.prototype.reset = function () { + cancelAnimationFrame(this.rAF); + this.paused = true; + this.resetDuration(); + this.startVal = this.validateValue(this.options.startVal); + this.frameVal = this.startVal; + this.printValue(this.startVal); + }; + // pass a new endVal and start animation + CountUp.prototype.update = function (newEndVal) { + cancelAnimationFrame(this.rAF); + this.startTime = null; + this.endVal = this.validateValue(newEndVal); + if (this.endVal === this.frameVal) { + return; + } + this.startVal = this.frameVal; + if (!this.finalEndVal) { + this.resetDuration(); + } + this.determineDirectionAndSmartEasing(); + this.rAF = requestAnimationFrame(this.count); + }; + CountUp.prototype.printValue = function (val) { + var result = this.formattingFn(val); + if (this.el.tagName === 'INPUT') { + var input = this.el; + input.value = result; + } + else if (this.el.tagName === 'text' || this.el.tagName === 'tspan') { + this.el.textContent = result; + } + else { + this.el.innerHTML = result; + } + }; + CountUp.prototype.ensureNumber = function (n) { + return (typeof n === 'number' && !isNaN(n)); + }; + CountUp.prototype.validateValue = function (value) { + var newValue = Number(value); + if (!this.ensureNumber(newValue)) { + this.error = "[CountUp] invalid start or end value: " + value; + return null; + } + else { + return newValue; + } + }; + CountUp.prototype.resetDuration = function () { + this.startTime = null; + this.duration = Number(this.options.duration) * 1000; + this.remaining = this.duration; + }; + return CountUp; +}()); +export { CountUp }; diff --git a/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.min.js b/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.min.js new file mode 100644 index 000000000..ae53b40cd --- /dev/null +++ b/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countUp.min.js @@ -0,0 +1 @@ +var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var i,a=1,s=arguments.length;as.endVal?s.endVal:s.frameVal,s.frameVal=Math.round(s.frameVal*s.decimalMult)/s.decimalMult,s.printValue(s.frameVal),i1?s.options.decimal+a[1]:"",s.options.useGrouping){r="";for(var l=0,h=n.length;lt;var i=t-this.startVal;if(Math.abs(i)>this.options.smartEasingThreshold){this.finalEndVal=t;var a=this.countDown?1:-1;this.endVal=t+a*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=t,this.finalEndVal=null;this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},t.prototype.start=function(t){this.error||(this.callback=t,this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},t.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},t.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},t.prototype.update=function(t){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(t),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,this.finalEndVal||this.resetDuration(),this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},t.prototype.printValue=function(t){var i=this.formattingFn(t);"INPUT"===this.el.tagName?this.el.value=i:"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=i:this.el.innerHTML=i},t.prototype.ensureNumber=function(t){return"number"==typeof t&&!isNaN(t)},t.prototype.validateValue=function(t){var i=Number(t);return this.ensureNumber(i)?i:(this.error="[CountUp] invalid start or end value: "+t,null)},t.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},t}();export{CountUp}; \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.js b/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.js deleted file mode 100644 index 1a8ac5c56..000000000 --- a/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.js +++ /dev/null @@ -1,196 +0,0 @@ -/* - - countUp.js - by @inorganik - - */ - -// target = id of html element or var of previously selected html element where counting occurs -// startVal = the value you want to begin at -// endVal = the value you want to arrive at -// decimals = number of decimal places, default 0 -// duration = duration of animation in seconds, default 2 -// options = optional object of options (see below) - -var CountUp = function(target, startVal, endVal, decimals, duration, options) { - - // make sure requestAnimationFrame and cancelAnimationFrame are defined - // polyfill for browsers without native support - // by Opera engineer Erik Möller - var lastTime = 0; - var vendors = ['webkit', 'moz', 'ms', 'o']; - for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; - window.cancelAnimationFrame = - window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; - } - if (!window.requestAnimationFrame) { - window.requestAnimationFrame = function(callback, element) { - var currTime = new Date().getTime(); - var timeToCall = Math.max(0, 16 - (currTime - lastTime)); - var id = window.setTimeout(function() { callback(currTime + timeToCall); }, - timeToCall); - lastTime = currTime + timeToCall; - return id; - }; - } - if (!window.cancelAnimationFrame) { - window.cancelAnimationFrame = function(id) { - clearTimeout(id); - }; - } - - var self = this; - - // default options - self.options = { - useEasing : true, // toggle easing - useGrouping : true, // 1,000,000 vs 1000000 - separator : ',', // character to use as a separator - decimal : '.', // character to use as a decimal - easingFn: null, // optional custom easing closure function, default is Robert Penner's easeOutExpo - formattingFn: null // optional custom formatting function, default is self.formatNumber below - }; - // extend default options with passed options object - for (var key in options) { - if (options.hasOwnProperty(key)) { - self.options[key] = options[key]; - } - } - if (self.options.separator === '') { self.options.useGrouping = false; } - if (!self.options.prefix) self.options.prefix = ''; - if (!self.options.suffix) self.options.suffix = ''; - - self.d = (typeof target === 'string') ? document.getElementById(target) : target; - self.startVal = Number(startVal); - self.endVal = Number(endVal); - self.countDown = (self.startVal > self.endVal); - self.frameVal = self.startVal; - self.decimals = Math.max(0, decimals || 0); - self.dec = Math.pow(10, self.decimals); - self.duration = Number(duration) * 1000 || 2000; - - self.formatNumber = function(nStr) { - nStr = nStr.toFixed(self.decimals); - nStr += ''; - var x, x1, x2, rgx; - x = nStr.split('.'); - x1 = x[0]; - x2 = x.length > 1 ? self.options.decimal + x[1] : ''; - rgx = /(\d+)(\d{3})/; - if (self.options.useGrouping) { - while (rgx.test(x1)) { - x1 = x1.replace(rgx, '$1' + self.options.separator + '$2'); - } - } - return self.options.prefix + x1 + x2 + self.options.suffix; - }; - // Robert Penner's easeOutExpo - self.easeOutExpo = function(t, b, c, d) { - return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b; - }; - - self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo; - self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber; - - self.version = function () { return '1.7.1'; }; - - // Print value to target - self.printValue = function(value) { - var result = self.formattingFn(value); - - if (self.d.tagName === 'INPUT') { - this.d.value = result; - } - else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') { - this.d.textContent = result; - } - else { - this.d.innerHTML = result; - } - }; - - self.count = function(timestamp) { - - if (!self.startTime) { self.startTime = timestamp; } - - self.timestamp = timestamp; - var progress = timestamp - self.startTime; - self.remaining = self.duration - progress; - - // to ease or not to ease - if (self.options.useEasing) { - if (self.countDown) { - self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration); - } else { - self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration); - } - } else { - if (self.countDown) { - self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration)); - } else { - self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration); - } - } - - // don't go past endVal since progress can exceed duration in the last frame - if (self.countDown) { - self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal; - } else { - self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal; - } - - // decimal - self.frameVal = Math.round(self.frameVal*self.dec)/self.dec; - - // format and print value - self.printValue(self.frameVal); - - // whether to continue - if (progress < self.duration) { - self.rAF = requestAnimationFrame(self.count); - } else { - if (self.callback) { self.callback(); } - } - }; - // start your animation - self.start = function(callback) { - self.callback = callback; - self.rAF = requestAnimationFrame(self.count); - return false; - }; - // toggles pause/resume animation - self.pauseResume = function() { - if (!self.paused) { - self.paused = true; - cancelAnimationFrame(self.rAF); - } else { - self.paused = false; - delete self.startTime; - self.duration = self.remaining; - self.startVal = self.frameVal; - requestAnimationFrame(self.count); - } - }; - // reset to startVal so animation can be run again - self.reset = function() { - self.paused = false; - delete self.startTime; - self.startVal = startVal; - cancelAnimationFrame(self.rAF); - self.printValue(self.startVal); - }; - // pass a new endVal and start animation - self.update = function (newEndVal) { - cancelAnimationFrame(self.rAF); - self.paused = false; - delete self.startTime; - self.startVal = self.frameVal; - self.endVal = Number(newEndVal); - self.countDown = (self.startVal > self.endVal); - self.rAF = requestAnimationFrame(self.count); - }; - - // format startVal on initialization - self.printValue(self.startVal); -}; \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.min.js b/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.min.js deleted file mode 100644 index 77fa8a100..000000000 --- a/src/main/resources/gwt/material/design/addins/client/countup/resources/js/countup.min.js +++ /dev/null @@ -1 +0,0 @@ -var CountUp=function(a,t,n,e,i,r){for(var o=0,s=["webkit","moz","ms","o"],m=0;mu.endVal,u.frameVal=u.startVal,u.decimals=Math.max(0,e||0),u.dec=Math.pow(10,u.decimals),u.duration=1e3*Number(i)||2e3,u.formatNumber=function(a){a=a.toFixed(u.decimals),a+="";var t,n,e,i;if(t=a.split("."),n=t[0],e=t.length>1?u.options.decimal+t[1]:"",i=/(\d+)(\d{3})/,u.options.useGrouping)for(;i.test(n);)n=n.replace(i,"$1"+u.options.separator+"$2");return u.options.prefix+n+e+u.options.suffix},u.easeOutExpo=function(a,t,n,e){return n*(-Math.pow(2,-10*a/e)+1)*1024/1023+t},u.easingFn=u.options.easingFn?u.options.easingFn:u.easeOutExpo,u.formattingFn=u.options.formattingFn?u.options.formattingFn:u.formatNumber,u.version=function(){return"1.7.1"},u.printValue=function(a){var t=u.formattingFn(a);"INPUT"===u.d.tagName?this.d.value=t:"text"===u.d.tagName||"tspan"===u.d.tagName?this.d.textContent=t:this.d.innerHTML=t},u.count=function(a){u.startTime||(u.startTime=a),u.timestamp=a;var t=a-u.startTime;u.remaining=u.duration-t,u.options.useEasing?u.countDown?u.frameVal=u.startVal-u.easingFn(t,0,u.startVal-u.endVal,u.duration):u.frameVal=u.easingFn(t,u.startVal,u.endVal-u.startVal,u.duration):u.countDown?u.frameVal=u.startVal-(u.startVal-u.endVal)*(t/u.duration):u.frameVal=u.startVal+(u.endVal-u.startVal)*(t/u.duration),u.countDown?u.frameVal=u.frameValu.endVal?u.endVal:u.frameVal,u.frameVal=Math.round(u.frameVal*u.dec)/u.dec,u.printValue(u.frameVal),tu.endVal,u.rAF=requestAnimationFrame(u.count)},u.printValue(u.startVal)}; \ No newline at end of file From 17565a576ebd4b945ed6f7801244862ac255aa30 Mon Sep 17 00:00:00 2001 From: Mark Kevin Baldemor Date: Tue, 3 Mar 2020 15:38:53 +0800 Subject: [PATCH 06/70] Input Mask upgraded version from 1.14.15 to 1.14.16 --- .../inputmask/resources/js/inputmask.js | 217 +++++++++--------- .../inputmask/resources/js/inputmask.min.js | 36 +-- 2 files changed, 126 insertions(+), 127 deletions(-) diff --git a/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.js b/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.js index 3a1a7e7b9..7e0216cbc 100644 --- a/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.js +++ b/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.js @@ -1,6 +1,6 @@ /** * jquery.mask.js - * @version: v1.14.15 + * @version: v1.14.16 * @author: Igor Escobar * * Created by Igor Escobar on 2012-03-10. Please report any bug at github.com/igorescobar/jQuery-Mask-Plugin @@ -41,7 +41,7 @@ if (typeof define === 'function' && define.amd) { define(['jquery'], factory); - } else if (typeof exports === 'object') { + } else if (typeof exports === 'object' && typeof Meteor === 'undefined') { module.exports = factory(require('jquery')); } else { factory(jQuery || Zepto); @@ -96,44 +96,44 @@ }, events: function() { el - .on('keydown.mask', function (e) { - el.data('mask-keycode', e.keyCode || e.which); - el.data('mask-previus-value', el.val()); - el.data('mask-previus-caret-pos', p.getCaret()); - p.maskDigitPosMapOld = p.maskDigitPosMap; - }) - .on($.jMaskGlobals.useInput ? 'input.mask' : 'keyup.mask', p.behaviour) - .on('paste.mask drop.mask', function () { - setTimeout(function () { - el.keydown().keyup(); - }, 100); - }) - .on('change.mask', function () { - el.data('changed', true); - }) - .on('blur.mask', function () { - if (oldValue !== p.val() && !el.data('changed')) { - el.trigger('change'); - } - el.data('changed', false); - }) - // it's very important that this callback remains in this position - // otherwhise oldValue it's going to work buggy - .on('blur.mask', function () { - oldValue = p.val(); - }) - // select all text on focus - .on('focus.mask', function (e) { - if (options.selectOnFocus === true) { - $(e.target).select(); - } - }) - // clear the value if it not complete the mask - .on('focusout.mask', function () { - if (options.clearIfNotMatch && !regexMask.test(p.val())) { - p.val(''); - } - }); + .on('keydown.mask', function(e) { + el.data('mask-keycode', e.keyCode || e.which); + el.data('mask-previus-value', el.val()); + el.data('mask-previus-caret-pos', p.getCaret()); + p.maskDigitPosMapOld = p.maskDigitPosMap; + }) + .on($.jMaskGlobals.useInput ? 'input.mask' : 'keyup.mask', p.behaviour) + .on('paste.mask drop.mask', function() { + setTimeout(function() { + el.keydown().keyup(); + }, 100); + }) + .on('change.mask', function(){ + el.data('changed', true); + }) + .on('blur.mask', function(){ + if (oldValue !== p.val() && !el.data('changed')) { + el.trigger('change'); + } + el.data('changed', false); + }) + // it's very important that this callback remains in this position + // otherwhise oldValue it's going to work buggy + .on('blur.mask', function() { + oldValue = p.val(); + }) + // select all text on focus + .on('focus.mask', function (e) { + if (options.selectOnFocus === true) { + $(e.target).select(); + } + }) + // clear the value if it not complete the mask + .on('focusout.mask', function() { + if (options.clearIfNotMatch && !regexMask.test(p.val())) { + p.val(''); + } + }); }, getRegexMask: function() { var maskChunks = [], translation, pattern, optional, recursive, oRecursive, r; @@ -163,7 +163,7 @@ if (oRecursive) { r = r.replace(new RegExp('(' + oRecursive.digit + '(.*' + oRecursive.digit + ')?)'), '($1)?') - .replace(new RegExp(oRecursive.digit, 'g'), oRecursive.pattern); + .replace(new RegExp(oRecursive.digit, 'g'), oRecursive.pattern); } return new RegExp(r); @@ -187,9 +187,8 @@ return r; }, - calculateCaretPosition: function () { - var oldVal = el.data('mask-previus-value') || '', - newVal = p.getMasked(), + calculateCaretPosition: function(oldVal) { + var newVal = p.getMasked(), caretPosNew = p.getCaret(); if (oldVal !== newVal) { var caretPosOld = el.data('mask-previus-caret-pos') || 0, @@ -229,15 +228,15 @@ // if the cursor is at the end keep it there if (caretPosNew > oldValL) { - caretPosNew = newValL * 10; + caretPosNew = newValL * 10; } else if (caretPosOld >= caretPosNew && caretPosOld !== oldValL) { - if (!p.maskDigitPosMapOld[caretPosNew]) { - var caretPos = caretPosNew; - caretPosNew -= maskDigitsBeforeCaretAllOld - maskDigitsBeforeCaretAll; - caretPosNew -= maskDigitsBeforeCaret; - if (p.maskDigitPosMap[caretPosNew]) { - caretPosNew = caretPos; - } + if (!p.maskDigitPosMapOld[caretPosNew]) { + var caretPos = caretPosNew; + caretPosNew -= maskDigitsBeforeCaretAllOld - maskDigitsBeforeCaretAll; + caretPosNew -= maskDigitsBeforeCaret; + if (p.maskDigitPosMap[caretPosNew]) { + caretPosNew = caretPos; + } } } else if (caretPosNew > caretPosOld) { @@ -255,12 +254,13 @@ if ($.inArray(keyCode, jMask.byPassKeys) === -1) { var newVal = p.getMasked(), - caretPos = p.getCaret(); + caretPos = p.getCaret(), + oldVal = el.data('mask-previus-value') || ''; // this is a compensation to devices/browsers that don't compensate // caret positioning the right way - setTimeout(function () { - p.setCaret(p.calculateCaretPosition()); + setTimeout(function() { + p.setCaret(p.calculateCaretPosition(oldVal)); }, $.jMaskGlobals.keyStrokeCompensation); p.val(newVal); @@ -305,7 +305,7 @@ if (translation) { if (valDigit.match(translation.pattern)) { buf[addMethod](valDigit); - if (translation.recursive) { + if (translation.recursive) { if (resetPos === -1) { resetPos = m; } else if (m === lastMaskChar && m !== resetPos) { @@ -331,7 +331,7 @@ m += offset; v -= offset; } else { - p.invalid.push({p: v, v: valDigit, e: translation.pattern}); + p.invalid.push({p: v, v: valDigit, e: translation.pattern}); } v += offset; } else { @@ -361,12 +361,12 @@ p.mapMaskdigitPositions(newVal, maskDigitPosArr, valLen); return newVal; }, - mapMaskdigitPositions: function (newVal, maskDigitPosArr, valLen) { - var maskDiff = options.reverse ? newVal.length - valLen : 0; - p.maskDigitPosMap = {}; - for (var i = 0; i < maskDigitPosArr.length; i++) { - p.maskDigitPosMap[maskDigitPosArr[i] + maskDiff] = 1; - } + mapMaskdigitPositions: function(newVal, maskDigitPosArr, valLen) { + var maskDiff = options.reverse ? newVal.length - valLen : 0; + p.maskDigitPosMap = {}; + for (var i = 0; i < maskDigitPosArr.length; i++) { + p.maskDigitPosMap[maskDigitPosArr[i] + maskDiff] = 1; + } }, callbacks: function (e) { var val = p.val(), @@ -409,15 +409,15 @@ // get value without mask jMask.getCleanVal = function() { - return p.getMasked(true); + return p.getMasked(true); }; // get masked value without the value being in the input or element jMask.getMaskedVal = function(val) { - return p.getMasked(false, val); + return p.getMasked(false, val); }; - jMask.init = function (onlyMask) { + jMask.init = function(onlyMask) { onlyMask = onlyMask || false; options = options || {}; @@ -441,7 +441,7 @@ // and then press the "back" button, the autocomplete will erase // the data. Works fine on IE9+, FF, Opera, Safari. if (el.data('mask')) { - el.attr('autocomplete', 'off'); + el.attr('autocomplete', 'off'); } // detect if is necessary let the user type freely. @@ -472,54 +472,53 @@ $.maskWatchers = {}; var HTMLAttributes = function () { - var input = $(this), - options = {}, - prefix = 'data-mask-', - mask = input.attr('data-mask'); - - if (input.attr(prefix + 'reverse')) { - options.reverse = true; - } + var input = $(this), + options = {}, + prefix = 'data-mask-', + mask = input.attr('data-mask'); - if (input.attr(prefix + 'clearifnotmatch')) { - options.clearIfNotMatch = true; - } - - if (input.attr(prefix + 'selectonfocus') === 'true') { - options.selectOnFocus = true; - } + if (input.attr(prefix + 'reverse')) { + options.reverse = true; + } - if (notSameMaskObject(input, mask, options)) { - return input.data('mask', new Mask(this, mask, options)); - } - }, - notSameMaskObject = function (field, mask, options) { - options = options || {}; - var maskObject = $(field).data('mask'), - stringify = JSON.stringify, - value = $(field).val() || $(field).text(); - try { - if (typeof mask === 'function') { - mask = mask(value); - } - return typeof maskObject !== 'object' || stringify(maskObject.options) !== stringify(options) || maskObject.mask !== mask; - } catch (e) { - } - }, - eventSupported = function (eventName) { - var el = document.createElement('div'), isSupported; + if (input.attr(prefix + 'clearifnotmatch')) { + options.clearIfNotMatch = true; + } - eventName = 'on' + eventName; - isSupported = (eventName in el); + if (input.attr(prefix + 'selectonfocus') === 'true') { + options.selectOnFocus = true; + } - if (!isSupported) { - el.setAttribute(eventName, 'return;'); - isSupported = typeof el[eventName] === 'function'; + if (notSameMaskObject(input, mask, options)) { + return input.data('mask', new Mask(this, mask, options)); + } + }, + notSameMaskObject = function(field, mask, options) { + options = options || {}; + var maskObject = $(field).data('mask'), + stringify = JSON.stringify, + value = $(field).val() || $(field).text(); + try { + if (typeof mask === 'function') { + mask = mask(value); } - el = null; + return typeof maskObject !== 'object' || stringify(maskObject.options) !== stringify(options) || maskObject.mask !== mask; + } catch (e) {} + }, + eventSupported = function(eventName) { + var el = document.createElement('div'), isSupported; + + eventName = 'on' + eventName; + isSupported = (eventName in el); + + if ( !isSupported ) { + el.setAttribute(eventName, 'return;'); + isSupported = typeof el[eventName] === 'function'; + } + el = null; - return isSupported; - }; + return isSupported; + }; $.fn.mask = function(mask, options) { options = options || {}; diff --git a/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.min.js b/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.min.js index ce86d08bc..1f22376e7 100644 --- a/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.min.js +++ b/src/main/resources/gwt/material/design/addins/client/inputmask/resources/js/inputmask.min.js @@ -1,19 +1,19 @@ -// jQuery Mask Plugin v1.14.15 +// jQuery Mask Plugin v1.14.16 // github.com/igorescobar/jQuery-Mask-Plugin -var $jscomp={scope:{},findInternal:function(a,l,d){a instanceof String&&(a=String(a));for(var p=a.length,h=0;hd?g=10*e:f>=g&&f!==d?c.maskDigitPosMapOld[g]||(f=g,g=g-(l-h)-a,c.maskDigitPosMap[g]&&(g=f)):g>f&& -(g=g+(h-l)+m)}return g},behaviour:function(f){f=f||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,m.byPassKeys)){var e=c.getMasked(),g=c.getCaret();setTimeout(function(){c.setCaret(c.calculateCaretPosition())},a.jMaskGlobals.keyStrokeCompensation);c.val(e);c.setCaret(g);return c.callbacks(f)}},getMasked:function(a,b){var g=[],d=void 0===b?c.val():b+"",n=0,h=e.length,q=0,l=d.length,k=1,r="push",p=-1,t=0,y=[],v,z;f.reverse?(r="unshift",k=-1,v=0,n=h-1,q=l-1,z=function(){return-1< -n&&-1g?h=10*d:e>=h&&e!==g?c.maskDigitPosMapOld[h]||(e=h,h=h-(k-l)-a,c.maskDigitPosMap[h]&&(h=e)):h>e&&(h=h+(l-k)+f)}return h},behaviour:function(d){d= +d||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,l.byPassKeys)){e=c.getMasked();var h=c.getCaret(),g=b.data("mask-previus-value")||"";setTimeout(function(){c.setCaret(c.calculateCaretPosition(g))},a.jMaskGlobals.keyStrokeCompensation);c.val(e);c.setCaret(h);return c.callbacks(d)}},getMasked:function(a,b){var h=[],f=void 0===b?c.val():b+"",g=0,k=d.length,n=0,p=f.length,m=1,r="push",u=-1,w=0;b=[];if(e.reverse){r="unshift";m=-1;var x=0;g=k-1;n=p-1;var A=function(){return-1< +g&&-1 Date: Wed, 11 Mar 2020 14:47:45 +0800 Subject: [PATCH 07/70] Migrated MaterialCombobox (SlickJs) version from 1.6.0 to 1.8.0 --- .../avatar/resources/js/jdenticon-1.3.2.js | 801 ------------------ .../resources/js/jdenticon-1.3.2.min.js | 13 - .../client/carousel/resources/js/slick.js | 244 ++++-- .../client/carousel/resources/js/slick.min.js | 19 +- 4 files changed, 179 insertions(+), 898 deletions(-) delete mode 100644 src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.js delete mode 100644 src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.min.js diff --git a/src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.js b/src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.js deleted file mode 100644 index 8d6357815..000000000 --- a/src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.js +++ /dev/null @@ -1,801 +0,0 @@ -/** - * Jdenticon 1.3.2 - * http://jdenticon.com - * - * Built: 2015-10-10T11:55:57.451Z - * - * Copyright (c) 2014-2015 Daniel Mester Pirttijärvi - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source distribution. - * - */ - -/*jslint bitwise: true */ - -(function (global, name, factory) { - var jQuery = global["jQuery"], - jdenticon = factory(global, jQuery); - - // Node.js - if (typeof module !== "undefined" && "exports" in module) { - module["exports"] = jdenticon; - } - // RequireJS - else if (typeof define === "function" && define["amd"]) { - define([], function () { return jdenticon; }); - } - // No module loader - else { - global[name] = jdenticon; - } -})(this, "jdenticon", function (global, jQuery) { - "use strict"; - - - - - /** - * Represents a point. - * @private - * @constructor - */ - function Point(x, y) { - this.x = x; - this.y = y; - }; - - - /** - * Translates and rotates a point before being passed on to the canvas context. This was previously done by the canvas context itself, - * but this caused a rendering issue in Chrome on sizes > 256 where the rotation transformation of inverted paths was not done properly. - * @param {number} x The x-coordinate of the upper left corner of the transformed rectangle. - * @param {number} y The y-coordinate of the upper left corner of the transformed rectangle. - * @param {number} size The size of the transformed rectangle. - * @param {number} rotation Rotation specified as 0 = 0 rad, 1 = 0.5π rad, 2 = π rad, 3 = 1.5π rad - * @private - * @constructor - */ - function Transform(x, y, size, rotation) { - this._x = x; - this._y = y; - this._size = size; - this._rotation = rotation; - } - Transform.prototype = { - /** - * Transforms the specified point based on the translation and rotation specification for this Transform. - * @param {number} x x-coordinate - * @param {number} y y-coordinate - * @param {number=} w The width of the transformed rectangle. If greater than 0, this will ensure the returned point is of the upper left corner of the transformed rectangle. - * @param {number=} h The height of the transformed rectangle. If greater than 0, this will ensure the returned point is of the upper left corner of the transformed rectangle. - */ - transformPoint: function (x, y, w, h) { - var right = this._x + this._size, - bottom = this._y + this._size; - return this._rotation === 1 ? new Point(right - y - (h || 0), this._y + x) : - this._rotation === 2 ? new Point(right - x - (w || 0), bottom - y - (h || 0)) : - this._rotation === 3 ? new Point(this._x + y, bottom - x - (w || 0)) : - new Point(this._x + x, this._y + y); - } - }; - Transform.noTransform = new Transform(0, 0, 0, 0); - - - - /** - * Provides helper functions for rendering common basic shapes. - * @private - * @constructor - */ - function Graphics(renderer) { - this._renderer = renderer; - this._transform = Transform.noTransform; - } - Graphics.prototype = { - /** - * Adds a polygon to the underlying renderer. - * @param {Array} points The points of the polygon clockwise on the format [ x0, y0, x1, y1, ..., xn, yn ] - * @param {boolean=} invert Specifies if the polygon will be inverted. - */ - addPolygon: function (points, invert) { - var di = invert ? -2 : 2, - transform = this._transform, - transformedPoints = [], - i; - - for (i = invert ? points.length - 2 : 0; i < points.length && i >= 0; i += di) { - transformedPoints.push(transform.transformPoint(points[i], points[i + 1])); - } - - this._renderer.addPolygon(transformedPoints); - }, - - /** - * Adds a polygon to the underlying renderer. - * Source: http://stackoverflow.com/a/2173084 - * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the entire ellipse. - * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the entire ellipse. - * @param {number} size The size of the ellipse. - * @param {boolean=} invert Specifies if the ellipse will be inverted. - */ - addCircle: function (x, y, size, invert) { - var p = this._transform.transformPoint(x, y, size, size); - this._renderer.addCircle(p, size, invert); - }, - - /** - * Adds a rectangle to the underlying renderer. - * @param {number} x The x-coordinate of the upper left corner of the rectangle. - * @param {number} y The y-coordinate of the upper left corner of the rectangle. - * @param {number} w The width of the rectangle. - * @param {number} h The height of the rectangle. - * @param {boolean=} invert Specifies if the rectangle will be inverted. - */ - addRectangle: function (x, y, w, h, invert) { - this.addPolygon([ - x, y, - x + w, y, - x + w, y + h, - x, y + h - ], invert); - }, - - /** - * Adds a right triangle to the underlying renderer. - * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the triangle. - * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the triangle. - * @param {number} w The width of the triangle. - * @param {number} h The height of the triangle. - * @param {number} r The rotation of the triangle (clockwise). 0 = right corner of the triangle in the lower left corner of the bounding rectangle. - * @param {boolean=} invert Specifies if the triangle will be inverted. - */ - addTriangle: function (x, y, w, h, r, invert) { - var points = [ - x + w, y, - x + w, y + h, - x, y + h, - x, y - ]; - points.splice(((r || 0) % 4) * 2, 2); - this.addPolygon(points, invert); - }, - - /** - * Adds a rhombus to the underlying renderer. - * @param {number} x The x-coordinate of the upper left corner of the rectangle holding the rhombus. - * @param {number} y The y-coordinate of the upper left corner of the rectangle holding the rhombus. - * @param {number} w The width of the rhombus. - * @param {number} h The height of the rhombus. - * @param {boolean=} invert Specifies if the rhombus will be inverted. - */ - addRhombus: function (x, y, w, h, invert) { - this.addPolygon([ - x + w / 2, y, - x + w, y + h / 2, - x + w / 2, y + h, - x, y + h / 2 - ], invert); - } - }; - - - - - var shapes = { - center: [ - /** @param {Graphics} g */ - function (g, cell, index) { - var k = cell * 0.42; - g.addPolygon([ - 0, 0, - cell, 0, - cell, cell - k * 2, - cell - k, cell, - 0, cell - ]); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var w = 0 | (cell * 0.5), - h = 0 | (cell * 0.8); - g.addTriangle(cell - w, 0, w, h, 2); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var s = 0 | (cell / 3); - g.addRectangle(s, s, cell - s, cell - s); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var inner = 0 | (cell * 0.1), - outer = 0 | (cell * 0.25); - g.addRectangle(outer, outer, cell - inner - outer, cell - inner - outer); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var m = 0 | (cell * 0.15), - s = 0 | (cell * 0.5); - g.addCircle(cell - s - m, cell - s - m, s); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var inner = cell * 0.1, - outer = inner * 4; - - g.addRectangle(0, 0, cell, cell); - g.addPolygon([ - outer, outer, - cell - inner, outer, - outer + (cell - outer - inner) / 2, cell - inner - ], true); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - g.addPolygon([ - 0, 0, - cell, 0, - cell, cell * 0.7, - cell * 0.4, cell * 0.4, - cell * 0.7, cell, - 0, cell - ]); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - g.addTriangle(cell / 2, cell / 2, cell / 2, cell / 2, 3); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - g.addRectangle(0, 0, cell, cell / 2); - g.addRectangle(0, cell / 2, cell / 2, cell / 2); - g.addTriangle(cell / 2, cell / 2, cell / 2, cell / 2, 1); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var inner = 0 | (cell * 0.14), - outer = 0 | (cell * 0.35); - g.addRectangle(0, 0, cell, cell); - g.addRectangle(outer, outer, cell - outer - inner, cell - outer - inner, true); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var inner = cell * 0.12, - outer = inner * 3; - - g.addRectangle(0, 0, cell, cell); - g.addCircle(outer, outer, cell - inner - outer, true); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - g.addTriangle(cell / 2, cell / 2, cell / 2, cell / 2, 3); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var m = cell * 0.25; - g.addRectangle(0, 0, cell, cell); - g.addRhombus(m, m, cell - m, cell - m, true); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var m = cell * 0.4, s = cell * 1.2; - if (!index) { - g.addCircle(m, m, s); - } - } - ], - - outer: [ - /** @param {Graphics} g */ - function (g, cell, index) { - g.addTriangle(0, 0, cell, cell, 0); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - g.addTriangle(0, cell / 2, cell, cell / 2, 0); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - g.addRhombus(0, 0, cell, cell); - }, - /** @param {Graphics} g */ - function (g, cell, index) { - var m = cell / 6; - g.addCircle(m, m, cell - 2 * m); - } - ] - }; - - - - - function decToHex(v) { - v |= 0; // Ensure integer value - return v < 0 ? "00" : - v < 16 ? "0" + v.toString(16) : - v < 256 ? v.toString(16) : - "ff"; - } - - function hueToRgb(m1, m2, h) { - h = h < 0 ? h + 6 : h > 6 ? h - 6 : h; - return decToHex(255 * ( - h < 1 ? m1 + (m2 - m1) * h : - h < 3 ? m2 : - h < 4 ? m1 + (m2 - m1) * (4 - h) : - m1)); - } - - /** - * Functions for converting colors to hex-rgb representations. - * @private - */ - var color = { - /** - * @param {number} r Red channel [0, 255] - * @param {number} g Green channel [0, 255] - * @param {number} b Blue channel [0, 255] - */ - rgb: function (r, g, b) { - return "#" + decToHex(r) + decToHex(g) + decToHex(b); - }, - /** - * @param h Hue [0, 1] - * @param s Saturation [0, 1] - * @param l Lightness [0, 1] - */ - hsl: function (h, s, l) { - // Based on http://www.w3.org/TR/2011/REC-css3-color-20110607/#hsl-color - if (s == 0) { - var partialHex = decToHex(l * 255); - return "#" + partialHex + partialHex + partialHex; - } - else { - var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s, - m1 = l * 2 - m2; - return "#" + - hueToRgb(m1, m2, h * 6 + 2) + - hueToRgb(m1, m2, h * 6) + - hueToRgb(m1, m2, h * 6 - 2); - } - }, - // This function will correct the lightness for the "dark" hues - correctedHsl: function (h, s, l) { - // The corrector specifies the perceived middle lightnesses for each hue - var correctors = [ 0.55, 0.5, 0.5, 0.46, 0.6, 0.55, 0.55 ], - corrector = correctors[(h * 6 + 0.5) | 0]; - - // Adjust the input lightness relative to the corrector - l = l < 0.5 ? l * corrector * 2 : corrector + (l - 0.5) * (1 - corrector) * 2; - - return color.hsl(h, s, l); - } - }; - - - - - /** - * Gets a set of identicon color candidates for a specified hue and config. - */ - function colorTheme(hue, config) { - return [ - // Dark gray - color.hsl(0, 0, config.grayscaleLightness(0)), - // Mid color - color.correctedHsl(hue, config.saturation, config.colorLightness(0.5)), - // Light gray - color.hsl(0, 0, config.grayscaleLightness(1)), - // Light color - color.correctedHsl(hue, config.saturation, config.colorLightness(1)), - // Dark color - color.correctedHsl(hue, config.saturation, config.colorLightness(0)) - ]; - } - - - - - /** - * Draws an identicon to a specified renderer. - */ - function iconGenerator(renderer, hash, x, y, size, padding, config) { - var undefined; - - // Calculate padding - padding = (size * (padding === undefined ? 0.08 : padding)) | 0; - size -= padding * 2; - - // Sizes smaller than 30 px are not supported. If really needed, apply a scaling transformation - // to the context before passing it to this function. - if (size < 30) { - throw new Error("Jdenticon cannot render identicons smaller than 30 pixels."); - } - if (!/^[0-9a-f]{11,}$/i.test(hash)) { - throw new Error("Invalid hash passed to Jdenticon."); - } - - var graphics = new Graphics(renderer); - - // Calculate cell size and ensure it is an integer - var cell = 0 | (size / 4); - - // Since the cell size is integer based, the actual icon will be slightly smaller than specified => center icon - x += 0 | (padding + size / 2 - cell * 2); - y += 0 | (padding + size / 2 - cell * 2); - - function renderShape(colorIndex, shapes, index, rotationIndex, positions) { - var r = rotationIndex ? parseInt(hash.charAt(rotationIndex), 16) : 0, - shape = shapes[parseInt(hash.charAt(index), 16) % shapes.length], - i; - - renderer.beginShape(availableColors[selectedColorIndexes[colorIndex]]); - - for (i = 0; i < positions.length; i++) { - graphics._transform = new Transform(x + positions[i][0] * cell, y + positions[i][1] * cell, cell, r++ % 4); - shape(graphics, cell, i); - } - - renderer.endShape(); - } - - // AVAILABLE COLORS - var hue = parseInt(hash.substr(-7), 16) / 0xfffffff, - - // Available colors for this icon - availableColors = colorTheme(hue, config), - - // The index of the selected colors - selectedColorIndexes = [], - index; - - function isDuplicate(values) { - if (values.indexOf(index) >= 0) { - for (var i = 0; i < values.length; i++) { - if (selectedColorIndexes.indexOf(values[i]) >= 0) { - return true; - } - } - } - } - - for (var i = 0; i < 3; i++) { - index = parseInt(hash.charAt(8 + i), 16) % availableColors.length; - if (isDuplicate([0, 4]) || // Disallow dark gray and dark color combo - isDuplicate([2, 3])) { // Disallow light gray and light color combo - index = 1; - } - selectedColorIndexes.push(index); - } - - // ACTUAL RENDERING - // Sides - renderShape(0, shapes.outer, 2, 3, [[1, 0], [2, 0], [2, 3], [1, 3], [0, 1], [3, 1], [3, 2], [0, 2]]); - // Corners - renderShape(1, shapes.outer, 4, 5, [[0, 0], [3, 0], [3, 3], [0, 3]]); - // Center - renderShape(2, shapes.center, 1, null, [[1, 1], [2, 1], [2, 2], [1, 2]]); - }; - - - - /** - * Represents an SVG path element. - * @private - * @constructor - */ - function SvgPath() { - /** - * This property holds the data string (path.d) of the SVG path. - */ - this.dataString = ""; - } - SvgPath.prototype = { - /** - * Adds a polygon with the current fill color to the SVG path. - * @param points An array of Point objects. - */ - addPolygon: function (points) { - var dataString = "M" + points[0].x + " " + points[0].y; - for (var i = 1; i < points.length; i++) { - dataString += "L" + points[i].x + " " + points[i].y; - } - this.dataString += dataString + "Z"; - }, - /** - * Adds a circle with the current fill color to the SVG path. - * @param {Point} point The upper left corner of the circle bounding box. - * @param {number} diameter The diameter of the circle. - * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path). - */ - addCircle: function (point, diameter, counterClockwise) { - var sweepFlag = counterClockwise ? 0 : 1, - radius = diameter / 2; - this.dataString += - "M" + (point.x) + " " + (point.y + radius) + - "a" + radius + "," + radius + " 0 1," + sweepFlag + " " + diameter + ",0" + - "a" + radius + "," + radius + " 0 1," + sweepFlag + " " + (-diameter) + ",0"; - } - }; - - - - /** - * Renderer producing SVG output. - * @private - * @constructor - */ - function SvgRenderer(width, height) { - this._pathsByColor = { }; - this._size = { w: width, h: height }; - } - SvgRenderer.prototype = { - /** - * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape. - * @param {string} color Fill color on format #xxxxxx. - */ - beginShape: function (color) { - this._path = this._pathsByColor[color] || (this._pathsByColor[color] = new SvgPath()); - }, - /** - * Marks the end of the currently drawn shape. - */ - endShape: function () { }, - /** - * Adds a polygon with the current fill color to the SVG. - * @param points An array of Point objects. - */ - addPolygon: function (points) { - this._path.addPolygon(points); - }, - /** - * Adds a circle with the current fill color to the SVG. - * @param {Point} point The upper left corner of the circle bounding box. - * @param {number} diameter The diameter of the circle. - * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path). - */ - addCircle: function (point, diameter, counterClockwise) { - this._path.addCircle(point, diameter, counterClockwise); - }, - /** - * Gets the rendered image as an SVG string. - * @param {boolean=} fragment If true, the container svg element is not included in the result. - */ - toSvg: function (fragment) { - var svg = fragment ? '' : - ''; - - for (var color in this._pathsByColor) { - svg += ''; - } - - return fragment ? svg : - svg + ''; - } - }; - - - - /** - * Renderer redirecting drawing commands to a canvas context. - * @private - * @constructor - */ - function CanvasRenderer(ctx, width, height) { - this._ctx = ctx; - ctx.clearRect(0, 0, width, height); - } - CanvasRenderer.prototype = { - /** - * Marks the beginning of a new shape of the specified color. Should be ended with a call to endShape. - * @param {string} color Fill color on format #xxxxxx. - */ - beginShape: function (color) { - this._ctx.fillStyle = color; - this._ctx.beginPath(); - }, - /** - * Marks the end of the currently drawn shape. This causes the queued paths to be rendered on the canvas. - */ - endShape: function () { - this._ctx.fill(); - }, - /** - * Adds a polygon to the rendering queue. - * @param points An array of Point objects. - */ - addPolygon: function (points) { - var ctx = this._ctx, i; - ctx.moveTo(points[0].x, points[0].y); - for (i = 1; i < points.length; i++) { - ctx.lineTo(points[i].x, points[i].y); - } - ctx.closePath(); - }, - /** - * Adds a circle to the rendering queue. - * @param {Point} point The upper left corner of the circle bounding box. - * @param {number} diameter The diameter of the circle. - * @param {boolean} counterClockwise True if the circle is drawn counter-clockwise (will result in a hole if rendered on a clockwise path). - */ - addCircle: function (point, diameter, counterClockwise) { - var ctx = this._ctx, - radius = diameter / 2; - ctx.arc(point.x + radius, point.y + radius, radius, 0, Math.PI * 2, counterClockwise); - ctx.closePath(); - } - }; - - - - - - - var /** @const */ - HASH_ATTRIBUTE = "data-jdenticon-hash", - supportsQuerySelectorAll = "document" in global && "querySelectorAll" in document; - - /** - * Gets the normalized current Jdenticon color configuration. Missing fields have default values. - */ - function getCurrentConfig() { - var configObject = jdenticon["config"] || global["jdenticon_config"] || { }, - lightnessConfig = configObject["lightness"] || { }, - saturation = configObject["saturation"]; - - /** - * Creates a lightness range. - */ - function lightness(configName, defaultMin, defaultMax) { - var range = lightnessConfig[configName] instanceof Array ? lightnessConfig[configName] : [defaultMin, defaultMax]; - - /** - * Gets a lightness relative the specified value in the specified lightness range. - */ - return function (value) { - value = range[0] + value * (range[1] - range[0]); - return value < 0 ? 0 : value > 1 ? 1 : value; - }; - } - - return { - saturation: typeof saturation == "number" ? saturation : 0.5, - colorLightness: lightness("color", 0.4, 0.8), - grayscaleLightness: lightness("grayscale", 0.3, 0.9) - } - } - - /** - * Updates the identicon in the specified canvas or svg elements. - * @param {string=} hash Optional hash to be rendered. If not specified, the hash specified by the data-jdenticon-hash is used. - * @param {number=} padding Optional padding in percents. Extra padding might be added to center the rendered identicon. - */ - function update(el, hash, padding) { - if (typeof(el) === "string") { - if (supportsQuerySelectorAll) { - var elements = document.querySelectorAll(el); - for (var i = 0; i < elements.length; i++) { - update(elements[i], hash, padding); - } - } - return; - } - if (!el || !el["tagName"]) { - // No element found - return; - } - hash = hash || el.getAttribute(HASH_ATTRIBUTE); - if (!hash) { - // No hash specified - return; - } - - var isSvg = el["tagName"].toLowerCase() == "svg", - isCanvas = el["tagName"].toLowerCase() == "canvas"; - - // Ensure we have a supported element - if (!isSvg && !(isCanvas && "getContext" in el)) { - return; - } - - var width = Number(el.getAttribute("width")) || el.clientWidth || 0, - height = Number(el.getAttribute("height")) || el.clientHeight || 0, - renderer = isSvg ? new SvgRenderer(width, height) : new CanvasRenderer(el.getContext("2d"), width, height), - size = Math.min(width, height); - - // Draw icon - iconGenerator(renderer, hash, 0, 0, size, padding, getCurrentConfig()); - - // SVG needs postprocessing - if (isSvg) { - // Parse svg to a temporary span element. - // Simply using innerHTML does unfortunately not work on IE. - var wrapper = document.createElement("span"); - wrapper.innerHTML = renderer.toSvg(false); - - // Then replace the content of the target element with the parsed svg. - while (el.firstChild) { - el.removeChild(el.firstChild); - } - var newNodes = wrapper.firstChild.childNodes; - while (newNodes.length) { - el.appendChild(newNodes[0]); - } - - // Set viewBox attribute to ensure the svg scales nicely. - el.setAttribute("viewBox", "0 0 " + width + " " + height); - } - } - - /** - * Draws an identicon to a context. - */ - function drawIcon(ctx, hash, size) { - if (!ctx) { - throw new Error("No canvas specified."); - } - - var renderer = new CanvasRenderer(ctx, size, size); - iconGenerator(renderer, hash, 0, 0, size, 0, getCurrentConfig()); - } - - /** - * Draws an identicon to a context. - * @param {number=} padding Optional padding in percents. Extra padding might be added to center the rendered identicon. - */ - function toSvg(hash, size, padding) { - var renderer = new SvgRenderer(size, size); - iconGenerator(renderer, hash, 0, 0, size, padding, getCurrentConfig()); - return renderer.toSvg(); - } - - /** - * Updates all canvas elements with the data-jdenticon-hash attribute. - */ - function jdenticon() { - if (supportsQuerySelectorAll) { - update("svg[" + HASH_ATTRIBUTE + "],canvas[" + HASH_ATTRIBUTE + "]"); - } - } - - // Public API - jdenticon["drawIcon"] = drawIcon; - jdenticon["toSvg"] = toSvg; - jdenticon["update"] = update; - jdenticon["version"] = "1.3.2"; - - // Basic jQuery plugin - if (jQuery) { - jQuery["fn"]["jdenticon"] = function (hash, padding) { - this["each"](function (index, el) { - update(el, hash, padding); - }); - return this; - }; - } - - // Schedule to render all identicons on the page once it has been loaded. - if (typeof setTimeout === "function") { - setTimeout(jdenticon, 0); - } - - return jdenticon; - -}); \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.min.js b/src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.min.js deleted file mode 100644 index 739b92fbd..000000000 --- a/src/main/resources/gwt/material/design/addins/client/avatar/resources/js/jdenticon-1.3.2.min.js +++ /dev/null @@ -1,13 +0,0 @@ -// Jdenticon 1.3.2 | jdenticon.com | zlib licensed | (c) 2014-2015 Daniel Mester Pirttijärvi -(function(k,g,h){var l=h(k,k.jQuery);"undefined"!==typeof module&&"exports"in module?module.exports=l:"function"===typeof define&&define.amd?define([],function(){return l}):k[g]=l})(this,"jdenticon",function(k,g){function h(b,a){this.x=b;this.y=a}function l(b,a,c,d){this.o=b;this.s=a;this.f=c;this.l=d}function A(b){this.C=b;this.m=l.O}function m(b){b|=0;return 0>b?"00":16>b?"0"+b.toString(16):256>b?b.toString(16):"ff"}function q(b,a,c){c=0>c?c+6:6c?b+(a-b)*c:3>c?a:4>c?b+(a- -b)*(4-c):b))}function D(b,a){return[n.w(0,0,a.H(0)),n.v(b,a.A,a.u(.5)),n.w(0,0,a.H(1)),n.v(b,a.A,a.u(1)),n.v(b,a.A,a.u(0))]}function r(b,a,c,d,t){var f=0,u=0;function v(c,d,t,e,g){e=e?parseInt(a.charAt(e),16):0;d=d[parseInt(a.charAt(t),16)%d.length];b.F(n[m[c]]);for(c=0;cc)throw Error("Jdenticon cannot render identicons smaller than 30 pixels."); -if(!/^[0-9a-f]{11,}$/i.test(a))throw Error("Invalid hash passed to Jdenticon.");var k=new A(b),h=0|c/4,f=f+(0|d+c/2-2*h),u=u+(0|d+c/2-2*h),n=D(parseInt(a.substr(-7),16)/268435455,t),m=[],g;for(c=0;3>c;c++){g=parseInt(a.charAt(8+c),16)%n.length;if(e([0,4])||e([2,3]))g=1;m.push(g)}v(0,w.J,2,3,[[1,0],[2,0],[2,3],[1,3],[0,1],[3,1],[3,2],[0,2]]);v(1,w.J,4,5,[[0,0],[3,0],[3,3],[0,3]]);v(2,w.N,1,null,[[1,1],[2,1],[2,2],[1,2]])}function B(){this.i=""}function x(b,a){this.j={};this.f={M:b,I:a}}function y(b, -a,c){this.h=b;b.clearRect(0,0,a,c)}function z(){function b(a,b,f){var e=c[a]instanceof Array?c[a]:[b,f];return function(a){a=e[0]+a*(e[1]-e[0]);return 0>a?0:1=c?c*(a+1):c+a-c*a;c=2*c-a;return"#"+q(c,a,6*b+2)+q(c,a,6*b)+q(c,a,6*b-2)},v:function(b,a,c){var d=[.55,.5,.5,.46,.6,.55,.55][6*b+.5|0];return n.w(b,a,.5>c?c*d*2:d+(c-.5)*(1-d)*2)}};B.prototype={a:function(b){for(var a="M"+b[0].x+" "+b[0].y,c=1;c< -b.length;c++)a+="L"+b[c].x+" "+b[c].y;this.i+=a+"Z"},b:function(b,a,c){c=c?0:1;var d=a/2;this.i+="M"+b.x+" "+(b.y+d)+"a"+d+","+d+" 0 1,"+c+" "+a+",0a"+d+","+d+" 0 1,"+c+" "+-a+",0"}};x.prototype={F:function(b){this.B=this.j[b]||(this.j[b]=new B)},G:function(){},a:function(b){this.B.a(b)},b:function(b,a,c){this.B.b(b,a,c)},K:function(b){var a=b?"":'', -c;for(c in this.j)a+='';return b?a:a+""}};y.prototype={F:function(b){this.h.fillStyle=b;this.h.beginPath()},G:function(){this.h.fill()},a:function(b){var a=this.h,c;a.moveTo(b[0].x,b[0].y);for(c=1;cPrevious', - nextArrow: '', + prevArrow: '', + nextArrow: '', autoplay: false, autoplaySpeed: 3000, centerMode: false, centerPadding: '50px', cssEase: 'ease', customPaging: function(slider, i) { - return $('',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(b,c){return a('',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('