myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject [myfaces-tobago] 02/02: Splitting the select-components into 6 files: one per tag
Date Wed, 07 Aug 2019 11:44:22 GMT
This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit d7767b6339a4943474280bd186327f89281153ab
Author: Udo Schnurpfeil <lofwyr@apache.org>
AuthorDate: Wed Aug 7 13:44:09 2019 +0200

    Splitting the select-components into 6 files: one per tag
    
    issue: TOBAGO-1633: TS refactoring
---
 .../src/main/npm/package.json                      |   2 +-
 .../src/main/npm/ts/tobago-all.ts                  |   7 +-
 ...go-all.ts => tobago-select-boolean-checkbox.ts} |  44 ++---
 ...bago-all.ts => tobago-select-boolean-toggle.ts} |  44 ++---
 ...obago-all.ts => tobago-select-many-checkbox.ts} |  44 ++---
 .../src/main/npm/ts/tobago-select-many-shuttle.ts  |  78 ++++++++
 .../src/main/npm/ts/tobago-select-one-listbox.ts   |  45 +++++
 .../src/main/npm/ts/tobago-select-one-radio.ts     |  64 ++++++
 .../src/main/npm/ts/tobago-select.ts               | 217 ---------------------
 .../src/main/resources/META-INF/tobago-config.xml  |   2 +-
 10 files changed, 255 insertions(+), 292 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/package.json b/tobago-theme/tobago-theme-standard/src/main/npm/package.json
index b396faf..fe0d72b 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/package.json
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/package.json
@@ -24,7 +24,7 @@
     "css-prefix": "postcss --config postcss.config.js --replace \"css/*.css\" \"!css/*.min.css\"",
     "css-minify": "cleancss --level 1 --source-map --source-map-inline-sources --output css/tobago.min.css
css/tobago.css",
     "ts-compile": "tsc",
-    "js-minify": "uglifyjs --compress typeofs=false,drop_console=true --mangle --source-map
includeSources --output js/tobago.min.js js/tobago-myfaces.js js/tobago-deltaspike.js js/tobago-polyfill.js
js/tobago-listener.js js/tobago-core.js js/tobago-dropdown.js js/tobago-calendar.js js/tobago-command.js
js/tobago-file.js js/tobago-focus.js js/tobago-header-footer.js js/tobago-in.js js/tobago-jsf.js
js/tobago-overlay.js js/tobago-panel.js js/tobago-popover.js js/tobago-popup.js js/tobago-
[...]
+    "js-minify": "uglifyjs --compress typeofs=false,drop_console=true --mangle --source-map
includeSources --output js/tobago.min.js js/tobago-myfaces.js js/tobago-deltaspike.js js/tobago-polyfill.js
js/tobago-listener.js js/tobago-core.js js/tobago-dropdown.js js/tobago-calendar.js js/tobago-command.js
js/tobago-file.js js/tobago-focus.js js/tobago-header-footer.js js/tobago-in.js js/tobago-jsf.js
js/tobago-overlay.js js/tobago-panel.js js/tobago-popover.js js/tobago-popup.js js/tobago-
[...]
     "test": "jest"
   },
   "devDependencies": {
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
index a3f884a..1813a8f 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
@@ -30,7 +30,12 @@ import "./tobago-panel";
 import "./tobago-popover";
 import "./tobago-popup";
 import "./tobago-reload";
-import "./tobago-select";
+import "./tobago-select-boolean-checkbox";
+import "./tobago-select-boolean-toggle";
+import "./tobago-select-many-checkbox";
+import "./tobago-select-many-shuttle";
+import "./tobago-select-one-listbox";
+import "./tobago-select-one-radio";
 import "./tobago-sheet";
 import "./tobago-split-layout";
 import "./tobago-stars";
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-boolean-checkbox.ts
similarity index 50%
copy from tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
copy to tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-boolean-checkbox.ts
index a3f884a..ae105e9 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-boolean-checkbox.ts
@@ -15,27 +15,23 @@
  * limitations under the License.
  */
 
-import "./tobago-listener";
-import "./tobago-core";
-import "./tobago-dropdown";
-import "./tobago-calendar";
-import "./tobago-command";
-import "./tobago-file";
-import "./tobago-focus";
-import "./tobago-header-footer";
-import "./tobago-in";
-import "./tobago-jsf";
-import "./tobago-overlay";
-import "./tobago-panel";
-import "./tobago-popover";
-import "./tobago-popup";
-import "./tobago-reload";
-import "./tobago-select";
-import "./tobago-sheet";
-import "./tobago-split-layout";
-import "./tobago-stars";
-import "./tobago-suggest";
-import "./tobago-tab";
-import "./tobago-tree";
-import "./tobago-tree-listbox";
-import "./tobago-utils";
+import {Listener, Phase} from "./tobago-listener";
+import {Tobago4Utils} from "./tobago-utils";
+
+class SelectBooleanCheckbox {
+
+  static init = function (elements) {
+    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
+    var checkboxes = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectBooleanCheckbox
input[readonly]");
+    checkboxes.each(function () {
+      // Save the initial state to restore it, when the user tries to manipulate it.
+      var initial = jQuery(this).is(":checked");
+      jQuery(this).click(function () {
+        jQuery(this).prop("checked", initial);
+      });
+    });
+  };
+}
+
+Listener.register(SelectBooleanCheckbox.init, Phase.DOCUMENT_READY);
+Listener.register(SelectBooleanCheckbox.init, Phase.AFTER_UPDATE);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-boolean-toggle.ts
similarity index 51%
copy from tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
copy to tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-boolean-toggle.ts
index a3f884a..2330270 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-boolean-toggle.ts
@@ -15,27 +15,23 @@
  * limitations under the License.
  */
 
-import "./tobago-listener";
-import "./tobago-core";
-import "./tobago-dropdown";
-import "./tobago-calendar";
-import "./tobago-command";
-import "./tobago-file";
-import "./tobago-focus";
-import "./tobago-header-footer";
-import "./tobago-in";
-import "./tobago-jsf";
-import "./tobago-overlay";
-import "./tobago-panel";
-import "./tobago-popover";
-import "./tobago-popup";
-import "./tobago-reload";
-import "./tobago-select";
-import "./tobago-sheet";
-import "./tobago-split-layout";
-import "./tobago-stars";
-import "./tobago-suggest";
-import "./tobago-tab";
-import "./tobago-tree";
-import "./tobago-tree-listbox";
-import "./tobago-utils";
+import {Listener, Phase} from "./tobago-listener";
+import {Tobago4Utils} from "./tobago-utils";
+
+class SelectBooleanToggle {
+
+  static init = function (elements) {
+    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
+    var toggles = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectBooleanToggle input[readonly]");
+    toggles.each(function () {
+      // Save the initial state to restore it, when the user tries to manipulate it.
+      var initial = jQuery(this).is(":checked");
+      jQuery(this).click(function () {
+        jQuery(this).prop("checked", initial);
+      });
+    });
+  };
+}
+
+Listener.register(SelectBooleanToggle.init, Phase.DOCUMENT_READY);
+Listener.register(SelectBooleanToggle.init, Phase.AFTER_UPDATE);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-many-checkbox.ts
similarity index 51%
copy from tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
copy to tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-many-checkbox.ts
index a3f884a..7a584cc 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-all.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-many-checkbox.ts
@@ -15,27 +15,23 @@
  * limitations under the License.
  */
 
-import "./tobago-listener";
-import "./tobago-core";
-import "./tobago-dropdown";
-import "./tobago-calendar";
-import "./tobago-command";
-import "./tobago-file";
-import "./tobago-focus";
-import "./tobago-header-footer";
-import "./tobago-in";
-import "./tobago-jsf";
-import "./tobago-overlay";
-import "./tobago-panel";
-import "./tobago-popover";
-import "./tobago-popup";
-import "./tobago-reload";
-import "./tobago-select";
-import "./tobago-sheet";
-import "./tobago-split-layout";
-import "./tobago-stars";
-import "./tobago-suggest";
-import "./tobago-tab";
-import "./tobago-tree";
-import "./tobago-tree-listbox";
-import "./tobago-utils";
+import {Listener, Phase} from "./tobago-listener";
+import {Tobago4Utils} from "./tobago-utils";
+
+class SelectManyCheckbox {
+
+  static init = function (elements) {
+    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
+    var checkboxes = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectManyCheckbox
input[readonly]");
+    checkboxes.each(function () {
+      // Save the initial state to restore it, when the user tries to manipulate it.
+      var initial = jQuery(this).is(":checked");
+      jQuery(this).click(function () {
+        jQuery(this).prop("checked", initial);
+      });
+    });
+  };
+}
+
+Listener.register(SelectManyCheckbox.init, Phase.DOCUMENT_READY);
+Listener.register(SelectManyCheckbox.init, Phase.AFTER_UPDATE);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-many-shuttle.ts
b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-many-shuttle.ts
new file mode 100644
index 0000000..2ed8781
--- /dev/null
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-many-shuttle.ts
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Listener, Phase} from "./tobago-listener";
+import {Tobago4Utils} from "./tobago-utils";
+
+class SelectManyShuttle {
+
+  static init = function (elements) {
+    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
+    var shuttles = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectManyShuttle:not(.tobago-selectManyShuttle-disabled)");
+
+    shuttles.find(".tobago-selectManyShuttle-unselected").dblclick(function () {
+      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
true, false);
+    });
+
+    shuttles.find(".tobago-selectManyShuttle-selected").dblclick(function () {
+      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
false, false);
+    });
+
+    shuttles.find(".tobago-selectManyShuttle-addAll").click(function () {
+      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
true, true);
+    });
+
+    shuttles.find(".tobago-selectManyShuttle-add").click(function () {
+      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
true, false);
+    });
+
+    shuttles.find(".tobago-selectManyShuttle-removeAll").click(function () {
+      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
false, true);
+    });
+
+    shuttles.find(".tobago-selectManyShuttle-remove").click(function () {
+      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
false, false);
+    });
+  };
+
+  static moveSelectedItems = function ($shuttle, direction, all) {
+    var $unselected = $shuttle.find(".tobago-selectManyShuttle-unselected");
+    var $selected = $shuttle.find(".tobago-selectManyShuttle-selected");
+    var count = $selected.children().length;
+    var $source = direction ? $unselected : $selected;
+    var $target = direction ? $selected : $unselected;
+    var $shifted = $source.find(all ? "option:not(:disabled)" : "option:selected").remove().appendTo($target);
+
+    // synchronize the hidden select
+    var $hidden = $shuttle.find(".tobago-selectManyShuttle-hidden");
+    var $hiddenOptions = $hidden.find("option");
+    // todo: may be optimized: put values in a hash map?
+    $shifted.each(function () {
+      var $option = jQuery(this);
+      $hiddenOptions.filter("[value='" + $option.val() + "']").prop("selected", direction);
+    });
+
+    if (count !== $selected.children().length) {
+      var e = jQuery.Event("change");
+      // trigger an change event for command facets
+      $hidden.trigger(e);
+    }
+  };
+}
+
+Listener.register(SelectManyShuttle.init, Phase.DOCUMENT_READY);
+Listener.register(SelectManyShuttle.init, Phase.AFTER_UPDATE);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-one-listbox.ts
b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-one-listbox.ts
new file mode 100644
index 0000000..c211860
--- /dev/null
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-one-listbox.ts
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Listener, Phase} from "./tobago-listener";
+import {Tobago4Utils} from "./tobago-utils";
+
+class SelectOneListbox {
+
+  static init = function (elements) {
+    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
+    var selects = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectOneListbox");
+    var notRequired = selects.not(".tobago-selectOneListbox-markup-required");
+    notRequired
+        .change(function () {
+          var element = jQuery(this);
+          if (element.data("tobago-old-value") == undefined) {
+            element.data("tobago-old-value", -1);
+          }
+        }).click(function () {
+      var element = jQuery(this);
+      if (element.data("tobago-old-value") == undefined
+          || element.data("tobago-old-value") == element.prop("selectedIndex")) {
+        element.prop("selectedIndex", -1);
+      }
+      element.data("tobago-old-value", element.prop("selectedIndex"));
+    });
+  };
+}
+
+Listener.register(SelectOneListbox.init, Phase.DOCUMENT_READY);
+Listener.register(SelectOneListbox.init, Phase.AFTER_UPDATE);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-one-radio.ts
b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-one-radio.ts
new file mode 100644
index 0000000..abd8358
--- /dev/null
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select-one-radio.ts
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Listener, Phase} from "./tobago-listener";
+import {Tobago4Utils} from "./tobago-utils";
+
+class SelectOneRadio {
+
+  static init = function (elements) {
+    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
+    var selectOneRadios = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectOneRadio");
+    selectOneRadios.each(function () {
+      var ul = jQuery(this);
+      var id = ul.closest("[id]").attr("id");
+      var radios = jQuery('input[name="' + id.replace(/([:\.])/g, '\\$1') + '"]');
+      radios.each(function () {
+        var selectOneRadio = jQuery(this);
+        selectOneRadio.data("tobago-old-value", selectOneRadio.prop("checked"));
+      });
+      radios.click(function () {
+        var selectOneRadio = jQuery(this);
+        var readonly = selectOneRadio.prop("readonly");
+        var required = selectOneRadio.prop("required");
+        if (!required && !readonly) {
+          if (selectOneRadio.data("tobago-old-value") == selectOneRadio.prop("checked"))
{
+            selectOneRadio.prop("checked", false);
+          }
+          selectOneRadio.data("tobago-old-value", selectOneRadio.prop("checked"));
+        }
+        if (readonly) {
+          radios.each(function () {
+            var radio = jQuery(this);
+            radio.prop("checked", radio.data("tobago-old-value"));
+          });
+        } else {
+          radios.each(function () {
+            if (this.id != selectOneRadio.get(0).id) {
+              var radio = jQuery(this);
+              radio.prop("checked", false);
+              radio.data("tobago-old-value", radio.prop("checked"));
+            }
+          });
+        }
+      });
+    });
+  };
+}
+
+Listener.register(SelectOneRadio.init, Phase.DOCUMENT_READY);
+Listener.register(SelectOneRadio.init, Phase.AFTER_UPDATE);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select.ts
deleted file mode 100644
index 47f48fa..0000000
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-select.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-import {Listener, Phase} from "./tobago-listener";
-import {Tobago4Utils} from "./tobago-utils";
-
-class SelectManyShuttle {
-
-  static init = function (elements) {
-    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
-    var shuttles = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectManyShuttle:not(.tobago-selectManyShuttle-disabled)");
-
-    shuttles.find(".tobago-selectManyShuttle-unselected").dblclick(function () {
-      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
true, false);
-    });
-
-    shuttles.find(".tobago-selectManyShuttle-selected").dblclick(function () {
-      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
false, false);
-    });
-
-    shuttles.find(".tobago-selectManyShuttle-addAll").click(function () {
-      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
true, true);
-    });
-
-    shuttles.find(".tobago-selectManyShuttle-add").click(function () {
-      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
true, false);
-    });
-
-    shuttles.find(".tobago-selectManyShuttle-removeAll").click(function () {
-      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
false, true);
-    });
-
-    shuttles.find(".tobago-selectManyShuttle-remove").click(function () {
-      SelectManyShuttle.moveSelectedItems(jQuery(this).parents(".tobago-selectManyShuttle"),
false, false);
-    });
-  };
-
-  static moveSelectedItems = function ($shuttle, direction, all) {
-    var $unselected = $shuttle.find(".tobago-selectManyShuttle-unselected");
-    var $selected = $shuttle.find(".tobago-selectManyShuttle-selected");
-    var count = $selected.children().length;
-    var $source = direction ? $unselected : $selected;
-    var $target = direction ? $selected : $unselected;
-    var $shifted = $source.find(all ? "option:not(:disabled)" : "option:selected").remove().appendTo($target);
-
-    // synchronize the hidden select
-    var $hidden = $shuttle.find(".tobago-selectManyShuttle-hidden");
-    var $hiddenOptions = $hidden.find("option");
-    // todo: may be optimized: put values in a hash map?
-    $shifted.each(function () {
-      var $option = jQuery(this);
-      $hiddenOptions.filter("[value='" + $option.val() + "']").prop("selected", direction);
-    });
-
-    if (count !== $selected.children().length) {
-      var e = jQuery.Event("change");
-      // trigger an change event for command facets
-      $hidden.trigger(e);
-    }
-  };
-}
-
-Listener.register(SelectManyShuttle.init, Phase.DOCUMENT_READY);
-Listener.register(SelectManyShuttle.init, Phase.AFTER_UPDATE);
-
-// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SelectOneRadio {
-
-  static init = function (elements) {
-    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
-    var selectOneRadios = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectOneRadio");
-    selectOneRadios.each(function () {
-      var ul = jQuery(this);
-      var id = ul.closest("[id]").attr("id");
-      var radios = jQuery('input[name="' + id.replace(/([:\.])/g, '\\$1') + '"]');
-      radios.each(function () {
-        var selectOneRadio = jQuery(this);
-        selectOneRadio.data("tobago-old-value", selectOneRadio.prop("checked"));
-      });
-      radios.click(function () {
-        var selectOneRadio = jQuery(this);
-        var readonly = selectOneRadio.prop("readonly");
-        var required = selectOneRadio.prop("required");
-        if (!required && !readonly) {
-          if (selectOneRadio.data("tobago-old-value") == selectOneRadio.prop("checked"))
{
-            selectOneRadio.prop("checked", false);
-          }
-          selectOneRadio.data("tobago-old-value", selectOneRadio.prop("checked"));
-        }
-        if (readonly) {
-          radios.each(function () {
-            var radio = jQuery(this);
-            radio.prop("checked", radio.data("tobago-old-value"));
-          });
-        } else {
-          radios.each(function () {
-            if (this.id != selectOneRadio.get(0).id) {
-              var radio = jQuery(this);
-              radio.prop("checked", false);
-              radio.data("tobago-old-value", radio.prop("checked"));
-            }
-          });
-        }
-      });
-    });
-  };
-}
-
-Listener.register(SelectOneRadio.init, Phase.DOCUMENT_READY);
-Listener.register(SelectOneRadio.init, Phase.AFTER_UPDATE);
-
-// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SelectOneListbox {
-
-  static init = function (elements) {
-    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
-    var selects = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectOneListbox");
-    var notRequired = selects.not(".tobago-selectOneListbox-markup-required");
-    notRequired
-        .change(function () {
-          var element = jQuery(this);
-          if (element.data("tobago-old-value") == undefined) {
-            element.data("tobago-old-value", -1);
-          }
-        }).click(function () {
-      var element = jQuery(this);
-      if (element.data("tobago-old-value") == undefined
-          || element.data("tobago-old-value") == element.prop("selectedIndex")) {
-        element.prop("selectedIndex", -1);
-      }
-      element.data("tobago-old-value", element.prop("selectedIndex"));
-    });
-  };
-}
-
-Listener.register(SelectOneListbox.init, Phase.DOCUMENT_READY);
-Listener.register(SelectOneListbox.init, Phase.AFTER_UPDATE);
-
-// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SelectBooleanCheckbox {
-
-  static init = function (elements) {
-    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
-    var checkboxes = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectBooleanCheckbox
input[readonly]");
-    checkboxes.each(function () {
-      // Save the initial state to restore it, when the user tries to manipulate it.
-      var initial = jQuery(this).is(":checked");
-      jQuery(this).click(function () {
-        jQuery(this).prop("checked", initial);
-      });
-    });
-  };
-}
-
-Listener.register(SelectBooleanCheckbox.init, Phase.DOCUMENT_READY);
-Listener.register(SelectBooleanCheckbox.init, Phase.AFTER_UPDATE);
-
-// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SelectBooleanToggle {
-
-  static init = function (elements) {
-    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
-    var toggles = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectBooleanToggle input[readonly]");
-    toggles.each(function () {
-      // Save the initial state to restore it, when the user tries to manipulate it.
-      var initial = jQuery(this).is(":checked");
-      jQuery(this).click(function () {
-        jQuery(this).prop("checked", initial);
-      });
-    });
-  };
-}
-
-Listener.register(SelectBooleanToggle.init, Phase.DOCUMENT_READY);
-Listener.register(SelectBooleanToggle.init, Phase.AFTER_UPDATE);
-
-// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SelectManyCheckbox {
-
-  static init = function (elements) {
-    elements = elements.jQuery ? elements : jQuery(elements); // fixme jQuery -> ES5
-    var checkboxes = Tobago4Utils.selectWithJQuery(elements, ".tobago-selectManyCheckbox
input[readonly]");
-    checkboxes.each(function () {
-      // Save the initial state to restore it, when the user tries to manipulate it.
-      var initial = jQuery(this).is(":checked");
-      jQuery(this).click(function () {
-        jQuery(this).prop("checked", initial);
-      });
-    });
-  };
-}
-
-Listener.register(SelectManyCheckbox.init, Phase.DOCUMENT_READY);
-Listener.register(SelectManyCheckbox.init, Phase.AFTER_UPDATE);
-
-// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
index 5f3f5c1..948a1eb 100644
--- a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
+++ b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
@@ -84,7 +84,7 @@
           <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-popover.js"/>
           <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-popup.js"/>
           <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-reload.js"/>
-          <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-select.js"/>
+          <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-select-....js"/>
           <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-sheet.js"/>
           <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-split-layout.js"/>
           <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-stars.js"/>


Mime
View raw message