This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch feature/requirejs-less
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/feature/requirejs-less by this 
push:
     new c97f8b9f8 Fixes in DateField, FormFragment, Select, Autocomplete, Zone
c97f8b9f8 is described below

commit c97f8b9f8a690fd0d4a67a3b4ff4fc69394a4562
Author: Thiago H. de Paula Figueiredo <[email protected]>
AuthorDate: Sun Aug 3 23:02:40 2025 -0300

    Fixes in DateField, FormFragment, Select, Autocomplete, Zone
---
 build.gradle                                                  |  5 +++--
 tapestry-core/build.gradle                                    |  9 ---------
 .../org/apache/tapestry5/corelib/components/DateField.java    | 10 ++++++++--
 tapestry-core/src/main/typescript/src/t5/core/autocomplete.ts |  6 ++++--
 .../src/main/typescript/src/t5/core/form-fragment.ts          | 11 ++++-------
 tapestry-core/src/main/typescript/src/t5/core/select.ts       |  4 ++--
 tapestry-core/src/main/typescript/src/t5/core/typeahead.ts    |  2 +-
 tapestry-core/src/main/typescript/src/t5/core/zone.ts         |  2 +-
 8 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/build.gradle b/build.gradle
index 384375f87..bde9ee18d 100755
--- a/build.gradle
+++ b/build.gradle
@@ -538,10 +538,11 @@ task combinedJacocoReport(type:JacocoReport){
 }
 
 task continuousIntegration {
-    def dependants = [subprojects.build, 
+    def dependants = [
+            'tapestry-core:testWithPrototypeAndRequireJsDisabled',
             'tapestry-core:testWithJqueryAndRequireJsDisabled',
+            subprojects.build, // jQuery and Require.js enabled
             'tapestry-core:testWithPrototypeAndRequireJsEnabled', 
-            'tapestry-core:testWithPrototypeAndRequireJsDisabled',
             combinedJacocoReport]
     // tapestry-javadoc doesn't work with Java 8 anymore. That's why it's only 
added if != 8.
     if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
diff --git a/tapestry-core/build.gradle b/tapestry-core/build.gradle
index cbab38d33..1e66536cd 100644
--- a/tapestry-core/build.gradle
+++ b/tapestry-core/build.gradle
@@ -147,25 +147,16 @@ task runTestAppfolder(type:JavaExec) {
 // other combinations
 
 task testWithJqueryAndRequireJsDisabled(type:Test) {
-  println "-------------------------------------"
-  println "Test suite with jQuery as infrastructure and Require.js disabled"
-  println "-------------------------------------"
   systemProperties."tapestry.javascript-infrastructure-provider" = "jquery"
   systemProperties."tapestry.require-js-enabled" = "false"
 }
 
 task testWithPrototypeAndRequireJsEnabled(type:Test) {
-  println "-------------------------------------"
-  println "Test suite with Prototype.js as infrastructure and Require.js 
enabled"
-  println "-------------------------------------"
   systemProperties."tapestry.javascript-infrastructure-provider" = "prototype"
   systemProperties."tapestry.require-js-enabled" = "true"
 }  
 
 task testWithPrototypeAndRequireJsDisabled(type:Test) {
-  println "-------------------------------------"
-  println "Test suite with Prototype.js as infrastructure and Require.js 
disabled"
-  println "-------------------------------------"
   systemProperties."tapestry.javascript-infrastructure-provider" = "prototype"
   systemProperties."tapestry.require-js-enabled" = "false"
 }
\ No newline at end of file
diff --git 
a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
 
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
index c986beb19..569ebfdc3 100644
--- 
a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
+++ 
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
@@ -20,6 +20,7 @@ import org.apache.tapestry5.annotations.RequestParameter;
 import org.apache.tapestry5.commons.Messages;
 import org.apache.tapestry5.corelib.base.AbstractField;
 import org.apache.tapestry5.dom.Element;
+import org.apache.tapestry5.internal.services.ajax.RequireJsModeHelper;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.ioc.annotations.Symbol;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
@@ -49,8 +50,7 @@ import java.util.Locale;
  * @see TextField
  */
 // TODO: More testing; see https://issues.apache.org/jira/browse/TAPESTRY-1844
-@Import(stylesheet = "${tapestry.datepicker}/css/datepicker.css",
-        module = "t5/core/datefield")
+@Import(stylesheet = "${tapestry.datepicker}/css/datepicker.css")
 @Events(EventConstants.VALIDATE)
 public class DateField extends AbstractField
 {
@@ -127,6 +127,9 @@ public class DateField extends AbstractField
 
     @Inject
     private DeprecationWarning deprecationWarning;
+    
+    @Inject
+    private RequireJsModeHelper requireJsModeHelper;
 
     @Inject
     @Symbol(SymbolConstants.LENIENT_DATE_FORMAT)
@@ -225,6 +228,9 @@ public class DateField extends AbstractField
 
     void beginRender(MarkupWriter writer)
     {
+        
+        requireJsModeHelper.importModule("t5/core/datefield");
+        
         String value = validationTracker.getInput(this);
 
         if (value == null)
diff --git a/tapestry-core/src/main/typescript/src/t5/core/autocomplete.ts 
b/tapestry-core/src/main/typescript/src/t5/core/autocomplete.ts
index 69238e9fa..520ea8c58 100644
--- a/tapestry-core/src/main/typescript/src/t5/core/autocomplete.ts
+++ b/tapestry-core/src/main/typescript/src/t5/core/autocomplete.ts
@@ -22,11 +22,13 @@ import dom from "t5/core/dom";
 import _ from "underscore";
 import $ from "jquery"
 import utils from "t5/core/utils";
-import typeahead from "t5/core/typeahead";
+import "t5/core/typeahead";
 
 // Line below is used to force the TypeScript compiler to actually import 
t5/core/typeahead
 // as it's not used directly here. 
-let workaround = typeahead;
+// let workaround = typeahead;
+
+let Bloodhound = window.Bloodhound;
 
 export default function(spec) {
   const $field = $(document.getElementById(spec.id));
diff --git a/tapestry-core/src/main/typescript/src/t5/core/form-fragment.ts 
b/tapestry-core/src/main/typescript/src/t5/core/form-fragment.ts
index efe6cff8c..ef4931516 100644
--- a/tapestry-core/src/main/typescript/src/t5/core/form-fragment.ts
+++ b/tapestry-core/src/main/typescript/src/t5/core/form-fragment.ts
@@ -19,7 +19,7 @@ import _ from "underscore";
 import dom from "t5/core/dom";
 import events from "t5/core/events";
 import forms from  "t5/core/forms";
-import { ElementWrapper, EventWrapper }from "t5/core/types";
+import { ElementWrapper, EventWrapper } from "t5/core/types";
 
 // Line below is used to force the TypeScript compiler to actually import 
t5/core/forms
 // as it's not used directly here. This file uses events set up by the 
imported files.
@@ -82,7 +82,7 @@ dom.onDocument(events.formfragment.changeVisibility, 
SELECTOR, function(event: E
 
 // When a FormFragment is initially rendered as hidden, then we need to do some
 // book-keeping on the client side.
-const hide = function(id: string) {
+export const hide = function(id: string) {
   const field = dom(id);
 
   return updateFields(field!, false);
@@ -93,7 +93,7 @@ const hide = function(id: string) {
 // * spec.triggerId - id of checkbox or radio button
 // * spec.fragmentId - id of FormFragment element
 // * spec.invert - (optional) if true, then checked trigger hides (not shows) 
the fragment
-const linkTrigger = function(spec: { triggerId: string | HTMLElement | null; 
fragmentId: string | HTMLElement | null; invert: boolean; }) {
+export const linkTrigger = function(spec: { triggerId: string | HTMLElement | 
null; fragmentId: string | HTMLElement | null; invert: boolean; }) {
   if (spec.triggerId == null) { throw new Error("Incomplete parameters, 
triggerId is null"); }
   if (spec.fragmentId == null) { throw new Error("Incomplete parameters, 
fragmentId is null"); }
   const trigger = dom(spec.triggerId);
@@ -118,7 +118,4 @@ const linkTrigger = function(spec: { triggerId: string | 
HTMLElement | null; fra
   } else {
     return trigger!.on("click", null, update);
   }
-};
-
-// Module exports:
-export default { linkTrigger, hide };
+};
\ No newline at end of file
diff --git a/tapestry-core/src/main/typescript/src/t5/core/select.ts 
b/tapestry-core/src/main/typescript/src/t5/core/select.ts
index c109caf8a..40e537867 100644
--- a/tapestry-core/src/main/typescript/src/t5/core/select.ts
+++ b/tapestry-core/src/main/typescript/src/t5/core/select.ts
@@ -19,12 +19,12 @@
 
 import events from "t5/core/events";
 import dom from "t5/core/dom";
-import zone from "t5/core/zone";
+import { findZone } from "t5/core/zone";
 
 dom.onDocument("change", "select[data-update-zone]", function() {
 
   // @ts-ignore
-  const containingZone = zone.findZone(this);
+  const containingZone = findZone(this);
 
   if (containingZone) {
     containingZone.trigger(events.zone.refresh, {
diff --git a/tapestry-core/src/main/typescript/src/t5/core/typeahead.ts 
b/tapestry-core/src/main/typescript/src/t5/core/typeahead.ts
index 932fb05fc..6e0aa22f6 100644
--- a/tapestry-core/src/main/typescript/src/t5/core/typeahead.ts
+++ b/tapestry-core/src/main/typescript/src/t5/core/typeahead.ts
@@ -723,7 +723,7 @@
         function ignoreDuplicates() {
             return false;
         }
-    })(this);
+    })(this || window);
     var html = function() {
         return {
             wrapper: '<span class="twitter-typeahead"></span>',
diff --git a/tapestry-core/src/main/typescript/src/t5/core/zone.ts 
b/tapestry-core/src/main/typescript/src/t5/core/zone.ts
index 822e6da72..f08479029 100644
--- a/tapestry-core/src/main/typescript/src/t5/core/zone.ts
+++ b/tapestry-core/src/main/typescript/src/t5/core/zone.ts
@@ -213,5 +213,5 @@ const deferredZoneUpdate = (id: string, url: string) => 
_.defer(function() {
 });
 
 // Most of this module is document-level event handlers, but there's also some 
exports:
-export default { deferredZoneUpdate, findZone };
+export { deferredZoneUpdate, findZone };
 

Reply via email to