]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add outside-range styles for DateField. (#14711)
authorJouni Koivuviita <jouni@vaadin.com>
Mon, 22 Sep 2014 10:28:29 +0000 (13:28 +0300)
committerMarkus Koivisto <markus@vaadin.com>
Tue, 14 Oct 2014 14:59:09 +0000 (17:59 +0300)
Change-Id: I0f85fb72605c5500b0a835ddf715d60bc9c7a524

WebContent/VAADIN/themes/valo/components/_datefield.scss
uitest/src/com/vaadin/tests/themes/valo/DateFields.java
uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java

index 48977d4d20d496d753b75f56d1544b28ed0d4599..71b50b5a77373275bb87e012473299a8aa5b7022 100644 (file)
     @include valo-datefield-calendarpanel-day-focused-style;
   }
 
-
+  .#{$primary-stylename}-day.#{$primary-stylename}-day-outside-range,
+  .#{$primary-stylename}-day.#{$primary-stylename}-day-outside-range:hover {
+    @include valo-datefield-calendarpanel-outside-range-style;
+  }
 
   .#{$primary-stylename}-weekdays {
     height: round($v-unit-size * 0.7);
     }
   }
 
-
   .#{$primary-stylename}-header {
     white-space: nowrap;
   }
 
-  td[class$="year"],
-  td[class$="month"] {
+  td[class*="year"],
+  td[class*="month"] {
     button {
       @include appearance(none);
       border: none;
         }
       }
 
-      &:hover {
-        @include opacity(1);
-        &:before {
-          color: $v-focus-color;
+      &:hover:before {
+        color: $v-focus-color;
+      }
+
+      &.outside-range {
+        cursor: default;
+        @include opacity(.3);
+
+        &:hover:before {
+          color: mix($v-background-color, valo-font-color($v-background-color));
         }
       }
     }
   background: transparent;
 }
 
+/**
+ * Outputs the styles for an individual day element, which are outside available range.
+ *
+ * @group datefield
+ */
+@mixin valo-datefield-calendarpanel-outside-range-style {
+  color: mix(valo-font-color($v-background-color), $v-background-color);
+  cursor: not-allowed;
+}
 
 /**
  * Outputs the styles for todays day element in a calendar panel.
index 5dca5ab9af7693e024b8c3c70609b02a4c4914b2..5a752cd985851c9ccacd97cda07581ad52f53bc5 100644 (file)
@@ -190,6 +190,7 @@ public class DateFields extends VerticalLayout implements View {
 
         date = new InlineDateField("Date picker");
         setDate(date);
+        setDateRange(date);
         row.addComponent(date);
 
         date = new InlineDateField("Date picker with week numbers");
@@ -211,6 +212,14 @@ public class DateFields extends VerticalLayout implements View {
         row.addComponent(form);
     }
 
+    private void setDateRange(DateField date) {
+        date.setRangeStart(getDefaultDate());
+
+        Date endDate = getDefaultDate();
+        endDate.setMonth(endDate.getMonth() + 1);
+        date.setRangeEnd(endDate);
+    }
+
     private void setDate(DateField date) {
         date.setValue(getDefaultDate());
     }
index 20c74bff5eb38c9b9946c3da3239461379617f48..d4ddf2dcf990d5255ea452067302e24f7fcd183a 100644 (file)
@@ -64,7 +64,7 @@ public class ValoThemeUITest extends MultiBrowserTest {
         // Note that this can look broken in IE9 because of some browser
         // rendering issue... The problem seems to be in the customized
         // horizontal layout in the test app
-        compareScreen("datefields-with-disabled");
+        compareScreen("datefields-with-range");
     }
 
     @Test