From 2d668c93a8537495b75929cde92da6ad30b9c075 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Wed, 28 Sep 2022 10:43:14 +0800 Subject: [PATCH 01/18] Deploy 2.7.0-SNAPSHOT --- .travis.yml | 6 +++--- .utility/deploy.sh | 2 +- README.md | 8 ++++---- pom.xml | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2dfe3768..e158a003 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,17 +8,17 @@ cache: - $HOME/.m2 before_install: # install the gwt-material-jquery library before we build the demo -- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git +- git clone -b release_2.7.0 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.6.1 https://github.com/GwtMaterialDesign/gwt-material.git +- git clone -b release_2.7.0 https://github.com/GwtMaterialDesign/gwt-material.git - cd gwt-material - mvn install -DskipTests=true -DdryRun=true - cd .. # install the gwt-material-table library before we build the demo -- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material-table.git +- git clone -b release_2.7.0 https://github.com/GwtMaterialDesign/gwt-material-table.git - cd gwt-material-table - mvn install -DskipTests=true -DdryRun=true - cd .. diff --git a/.utility/deploy.sh b/.utility/deploy.sh index 1b8ab8f1..71dc1f39 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.6.1" ]; then +if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.8.0" ]; then echo "ossrh\${env.OSSRH_USER}\${env.OSSRH_PASS}" > ~/settings.xml mvn deploy -DskipTests --settings ~/settings.xml fi \ No newline at end of file diff --git a/README.md b/README.md index 7aaea3c3..011316ba 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.6.1 +## Current Version 2.7.0 ```xml com.github.gwtmaterialdesign gwt-material-addins - 2.6.1 + 2.7.0 ``` -## Snapshot Version 2.6.1 +## Snapshot Version 2.8.0 ```xml com.github.gwtmaterialdesign gwt-material-addins - 2.6.1-SNAPSHOT + 2.8.0-SNAPSHOT ``` diff --git a/pom.xml b/pom.xml index 7baff4c8..ff67217c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ gwt-material-parent com.github.gwtmaterialdesign - 2.6.1 + 2.7.0-SNAPSHOT gwt-material-addins @@ -24,7 +24,7 @@ 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.6.1 + v2.7.0 From ca394a2a4273fa1827ef54807ff6b5e3d92c83c3 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Mon, 31 Oct 2022 18:11:10 +0800 Subject: [PATCH 02/18] Convert MaterialRating to AbstractValueWidget --- .../material/design/addins/client/rating/MaterialRating.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java b/src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java index 49586fb5..a562f8e1 100644 --- a/src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java +++ b/src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java @@ -29,6 +29,7 @@ import com.google.gwt.user.client.ui.HasValue; import gwt.material.design.addins.client.base.constants.AddinsCssName; import gwt.material.design.addins.client.dark.AddinsDarkThemeReloader; +import gwt.material.design.client.base.AbstractValueWidget; import gwt.material.design.client.base.MaterialWidget; import gwt.material.design.client.constants.Color; import gwt.material.design.client.constants.IconType; @@ -103,7 +104,7 @@ * * @author gilberto-torrezan */ -public class MaterialRating extends MaterialWidget implements HasValue { +public class MaterialRating extends AbstractValueWidget { private boolean editable = true; private int currentRating = 0; From 4eb8b6e2244de59faedfbcfde47b6c754f10c6af Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 18 Nov 2022 11:56:32 +0800 Subject: [PATCH 03/18] Added a way to pass the predefined label when selecting ranges on date range picker widget. --- .../incubator/client/daterange/DateRangePicker.java | 8 +++++++- .../incubator/client/daterange/js/JsDateRangePicker.java | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) 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 2ea46c96..0eaf7781 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 @@ -93,6 +93,7 @@ public class DateRangePicker extends AbstractValueWidget implements HasD private Date startDate; private Date endDate; private Date[] value; + private String predefinedLabel; private FieldTypeMixin fieldTypeMixin; private StatusTextMixin statusTextMixin; @@ -117,7 +118,8 @@ protected void load() { add(label); add(errorLabel); - getInputElement().daterangepicker(options, (startDate, endDate) -> { + getInputElement().daterangepicker(options, (startDate, endDate, label) -> { + this.predefinedLabel = label; setValue(new Date[]{new Date(startDate.toString()), new Date(endDate.toString())}, true); }); @@ -756,6 +758,10 @@ public void setMask(String mask) { this.mask = mask; } + public String getPredefinedLabel() { + return predefinedLabel; + } + @Override public boolean isNativeBrowserStyle() { return getNativeBrowserStyleMixin().isNativeBrowserStyle(); diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java b/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java index 0de7a69d..de34f603 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java @@ -52,6 +52,9 @@ public class JsDateRangePicker extends DateRangeOptions { @JsMethod public native void daterangepicker(DateRangeOptions options, Functions.Func2 callback); + @JsMethod + public native void daterangepicker(DateRangeOptions options, Functions.Func3 callback); + @JsMethod public native void daterangepicker(); From 5498b5a73e2dc0daad9c4ba0c2adede0b27d2c6a Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Mon, 28 Nov 2022 13:27:13 +0800 Subject: [PATCH 04/18] ComboBox added keyup / placeholder support on search input --- .../client/combobox/MaterialComboBox.java | 25 +++++++++++++++++++ .../combobox/events/ComboBoxEvents.java | 3 +++ 2 files changed, 28 insertions(+) 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 3e5712dd..9e6cb105 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 @@ -24,6 +24,7 @@ import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Style; import com.google.gwt.event.dom.client.DomEvent; +import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.logical.shared.*; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.DOM; @@ -59,12 +60,14 @@ import gwt.material.design.client.events.ClosingEvent; import gwt.material.design.client.events.OpeningEvent; import gwt.material.design.client.ui.MaterialLabel; +import gwt.material.design.client.ui.MaterialToast; import gwt.material.design.client.ui.html.Label; import gwt.material.design.client.ui.html.OptGroup; import gwt.material.design.client.ui.html.Option; import gwt.material.design.jquery.client.api.Event; import gwt.material.design.jquery.client.api.Functions; import gwt.material.design.jquery.client.api.JQueryElement; +import gwt.material.design.jquery.client.api.KeyEvent; import java.util.*; @@ -228,6 +231,12 @@ public void load() { return false; }); + body().on(ComboBoxEvents.KEYUP, getSearchFieldElement(), e -> { + KeyEvent keyEvent = (KeyEvent) e; + DomEvent.fireNativeEvent(Document.get().createKeyUpEvent(keyEvent.ctrlKey, keyEvent.altKey, keyEvent.shiftKey, Boolean.parseBoolean(keyEvent.metaKey), keyEvent.keyCode), this, getElement()); + return true; + }); + displayArrowForAllowClearOption(false); if (getTextColor() != null) { @@ -1243,6 +1252,18 @@ public List getOptions() { return values; } + public void focusSearchInput() { + $(getSearchFieldElement()).focus(); + } + + public void setSearchInputPlaceholder(String placeholder) { + $(getSearchFieldElement()).attr("placeholder", placeholder); + } + + public void setSearchInputValue(String value) { + $(getSearchFieldElement()).val(value); + } + @Override public void setAsyncDisplayLoader(AsyncDisplayLoader displayLoader) { getAsyncWidgetMixin().setAsyncDisplayLoader(displayLoader); @@ -1256,6 +1277,10 @@ public String getSelectContainerSelector() { return "#" + getId() + " .select2.select2-container"; } + public String getSearchFieldElement() { + return "#" + getId() + " .select2-search__field"; + } + @Override public AsyncDisplayLoader getAsyncDisplayLoader() { return getAsyncWidgetMixin().getAsyncDisplayLoader(); 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 43861d00..0fa75c98 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 @@ -19,6 +19,8 @@ */ package gwt.material.design.addins.client.combobox.events; +import gwt.material.design.jquery.client.api.Event; + /** * Events for Combobox * @@ -36,4 +38,5 @@ public interface ComboBoxEvents { String CLEAR = "select2:clear"; String CLEARING = "select2:clearing"; String FOCUS = "focus"; + String KEYUP = "keyup"; } From 55c5486707541c8ff2c0fa4046400b0b9e8b4f05 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Sat, 17 Dec 2022 05:43:03 +0800 Subject: [PATCH 05/18] Cleanup --- .../design/addins/client/inputmask/AbstractInputMask.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/gwt/material/design/addins/client/inputmask/AbstractInputMask.java b/src/main/java/gwt/material/design/addins/client/inputmask/AbstractInputMask.java index 530b78c3..37102b5e 100644 --- a/src/main/java/gwt/material/design/addins/client/inputmask/AbstractInputMask.java +++ b/src/main/java/gwt/material/design/addins/client/inputmask/AbstractInputMask.java @@ -101,9 +101,7 @@ protected void onLoad() { @Override public void load() { - if (mask == null || mask.isEmpty()) { - GWT.log("You must provide a mask pattern in order to mask your field"); - } else { + if (mask != null && !mask.isEmpty()) { load(mask); } } From ca4794d2cb5b79f996db2efdf330755f6b9fabaf Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 10 Feb 2023 13:09:56 +0800 Subject: [PATCH 06/18] Date Range added support range-label. --- .../client/daterange/DateRangePicker.java | 63 ++++++--- .../daterange/constants/DateRangeType.java | 26 ++++ .../client/daterange/js/RangeOption.java | 1 + .../resources/css/daterangepicker.css | 129 +++++++++++------- .../resources/css/daterangepicker.min.css | 32 ++++- 5 files changed, 183 insertions(+), 68 deletions(-) create mode 100644 src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java 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 0eaf7781..f0e0af45 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 @@ -27,7 +27,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.inputmask.MaterialInputMask; import gwt.material.design.addins.client.moment.Moment; import gwt.material.design.addins.client.moment.resources.MomentClientBundle; import gwt.material.design.addins.client.moment.resources.MomentClientDebugBundle; @@ -41,10 +40,12 @@ import gwt.material.design.client.js.Window; import gwt.material.design.client.ui.MaterialIcon; import gwt.material.design.client.ui.MaterialLabel; +import gwt.material.design.client.ui.MaterialTextBox; import gwt.material.design.client.ui.html.Label; import gwt.material.design.incubator.client.AddinsIncubator; 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.DateRangeType; import gwt.material.design.incubator.client.daterange.constants.DateRangeElementSelector; import gwt.material.design.incubator.client.daterange.events.SelectionEvent; import gwt.material.design.incubator.client.daterange.events.*; @@ -57,7 +58,7 @@ import static gwt.material.design.incubator.client.daterange.js.JsDateRangePicker.$; -public class DateRangePicker extends AbstractValueWidget implements HasDateRangeHandlers, HasFieldTypes, +public class DateRangePicker extends AbstractValueWidget implements HasDateRangeHandlers, HasFieldTypes, HasType, HasDateRangeOptions, HasIcon, HasReadOnly, HasPlaceholder, HasNativeBrowserStyle, HasLabel, HasSingleValue, HasRegex { private static final String DATE_RANGE_STYLENAME = "date-range-picker"; @@ -81,9 +82,10 @@ public class DateRangePicker extends AbstractValueWidget implements HasD } private final ScrollHelper scrollHelper = new ScrollHelper(); - private final MaterialInputMask dateInput = new MaterialInputMask(); + private final MaterialTextBox dateInput = new MaterialTextBox(); private final Label label = new Label(); private final MaterialLabel errorLabel = new MaterialLabel(); + private final MaterialIcon calendar = new MaterialIcon(IconType.CALENDAR_MONTH); private final MaterialIcon icon = new MaterialIcon(); private final DateRangeOptions options = new DateRangeOptions(); @@ -97,12 +99,16 @@ public class DateRangePicker extends AbstractValueWidget implements HasD private FieldTypeMixin fieldTypeMixin; private StatusTextMixin statusTextMixin; - private ReadOnlyMixin readOnlyMixin; + private ReadOnlyMixin readOnlyMixin; private NativeBrowserStyleMixin nativeBrowserStyleMixin; - private RegexMixin regexMixin; + private RegexMixin regexMixin; + private ToggleStyleMixin singleMixin; + private CssTypeMixin typeMixin; public DateRangePicker() { super(Document.get().createDivElement(), CssName.INPUT_FIELD, DATE_RANGE_STYLENAME); + + calendar.addStyleName("calendar"); } @Override @@ -113,7 +119,6 @@ protected void onLoad() { } protected void load() { - applyMasking(); add(dateInput); add(label); add(errorLabel); @@ -185,18 +190,18 @@ protected void load() { return true; }); - getHandlerRegistry().registerHandler(Window.addResizeHandler(event -> detectPosition())); + addClickHandler(clickEvent -> { + if (getType() == DateRangeType.LABEL) { + open(); + } + }); + add(calendar); + getHandlerRegistry().registerHandler(Window.addResizeHandler(event -> detectPosition())); setId(DOM.createUniqueId()); - IncubatorDarkThemeReloader.get().reload(DateRangeDarkTheme.class); } - protected void applyMasking() { - if (mask != null) { - dateInput.setMask(mask); - } - } protected void detectPosition() { if (!isInVerticalViewPort()) { @@ -441,6 +446,7 @@ public void setLocale(DateRangeLocale locale) { @Override public void setSingleDatePicker(boolean singleDatePicker) { options.setSingleDatePicker(singleDatePicker); + getSingleMixin().setOn(singleDatePicker); } @Override @@ -568,7 +574,7 @@ public Date[] getValue() { return value; } - public MaterialInputMask getDateInput() { + public MaterialTextBox getDateInput() { return dateInput; } @@ -762,6 +768,17 @@ public String getPredefinedLabel() { return predefinedLabel; } + @Override + public DateRangeType getType() { + return getTypeMixin().getType(); + } + + @Override + public void setType(DateRangeType type) { + getTypeMixin().setType(type); + dateInput.setReadOnly(type == DateRangeType.LABEL); + } + @Override public boolean isNativeBrowserStyle() { return getNativeBrowserStyleMixin().isNativeBrowserStyle(); @@ -837,7 +854,7 @@ public StatusTextMixin getStatusTextMixin() return statusTextMixin; } - protected ReadOnlyMixin getReadOnlyMixin() { + protected ReadOnlyMixin getReadOnlyMixin() { if (readOnlyMixin == null) { readOnlyMixin = new ReadOnlyMixin<>(this, dateInput); } @@ -851,10 +868,24 @@ protected NativeBrowserStyleMixin getNativeBrowserStyleMixin() return nativeBrowserStyleMixin; } - protected RegexMixin getRegexMixin() { + public ToggleStyleMixin getSingleMixin() { + if (singleMixin == null) { + singleMixin = new ToggleStyleMixin<>(this, "single"); + } + return singleMixin; + } + + protected RegexMixin getRegexMixin() { if (regexMixin == null) { regexMixin = new RegexMixin<>(dateInput); } return regexMixin; } + + public CssTypeMixin getTypeMixin() { + if (typeMixin == null) { + typeMixin = new CssTypeMixin<>(this); + } + return typeMixin; + } } diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java b/src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java new file mode 100644 index 00000000..e7774b58 --- /dev/null +++ b/src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java @@ -0,0 +1,26 @@ +package gwt.material.design.incubator.client.daterange.constants; + +import gwt.material.design.client.base.helper.EnumHelper; +import gwt.material.design.client.constants.ButtonType; +import gwt.material.design.client.constants.CssType; + +public enum DateRangeType implements CssType { + + FIELD("range-field"), + LABEL("range-label"); + + private String cssName; + + DateRangeType(String cssName) { + this.cssName = cssName; + } + + @Override + public String getCssName() { + return cssName; + } + + public static DateRangeType fromStyleName(final String styleName) { + return EnumHelper.fromStyleName(styleName, DateRangeType.class, FIELD); + } +} diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/js/RangeOption.java b/src/main/java/gwt/material/design/incubator/client/daterange/js/RangeOption.java index 79082a39..236a2e3d 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/js/RangeOption.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/js/RangeOption.java @@ -45,6 +45,7 @@ public static final RangeOption create() { range.Last7Days = new Moment[]{moment().subtract(6, "days"), moment()}; range.Last30Days = new Moment[]{moment().subtract(29, "days"), moment()}; range.ThisMonth = new Moment[]{moment().startOf("month"), moment().endOf("month")}; + //TODO: Bug -> Last Month -> ( range.LastMonth = new Moment[]{moment().subtract(1, "month"), moment().startOf("month")}; return range; } diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css index 73f36b0c..6e3d5abe 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css @@ -322,61 +322,88 @@ color: #fff; } +.date-range-picker i.calendar { + display: none; + position: absolute; + right: 28px; + top: 10px; +} + +.date-range-picker.range-label i.calendar { + display: block; +} + +.date-range-picker.range-label { + max-width: 200px; + height: 48px; +} + +.date-range-picker.range-label input { + cursor: pointer; +} + +.date-range-picker.range-label:hover { + background: #e8f1fd; + border-radius: 8px; + color: #3181eb; + cursor: pointer; +} + /* Larger Screen Styling */ @media (min-width: 564px) { .daterangepicker { width: auto; } - .daterangepicker .ranges ul { - width: 140px; } - .daterangepicker.single .ranges ul { - width: 100%; } - .daterangepicker.single .drp-calendar.left { - clear: none; } - .daterangepicker.single.ltr .ranges, .daterangepicker.single.ltr .drp-calendar { - float: left; } - .daterangepicker.single.rtl .ranges, .daterangepicker.single.rtl .drp-calendar { - float: right; } - .daterangepicker.ltr { - direction: ltr; - text-align: left; } - .daterangepicker.ltr .drp-calendar.left { - clear: left; - margin-right: 0; } - .daterangepicker.ltr .drp-calendar.left .calendar-table { - border-right: none; - border-top-right-radius: 0; - border-bottom-right-radius: 0; } - .daterangepicker.ltr .drp-calendar.right { - margin-left: 0; } - .daterangepicker.ltr .drp-calendar.right .calendar-table { - border-left: none; - border-top-left-radius: 0; - border-bottom-left-radius: 0; } - .daterangepicker.ltr .drp-calendar.left .calendar-table { - padding-right: 8px; } - .daterangepicker.ltr .ranges, .daterangepicker.ltr .drp-calendar { - float: left; } - .daterangepicker.rtl { - direction: rtl; - text-align: right; } - .daterangepicker.rtl .drp-calendar.left { - clear: right; - margin-left: 0; } - .daterangepicker.rtl .drp-calendar.left .calendar-table { - border-left: none; - border-top-left-radius: 0; - border-bottom-left-radius: 0; } - .daterangepicker.rtl .drp-calendar.right { - margin-right: 0; } - .daterangepicker.rtl .drp-calendar.right .calendar-table { - border-right: none; - border-top-right-radius: 0; - border-bottom-right-radius: 0; } - .daterangepicker.rtl .drp-calendar.left .calendar-table { - padding-left: 12px; } - .daterangepicker.rtl .ranges, .daterangepicker.rtl .drp-calendar { - text-align: right; - float: right; } } + .daterangepicker .ranges ul { + width: 140px; } + .daterangepicker.single .ranges ul { + width: 100%; } + .daterangepicker.single .drp-calendar.left { + clear: none; } + .daterangepicker.single.ltr .ranges, .daterangepicker.single.ltr .drp-calendar { + float: left; } + .daterangepicker.single.rtl .ranges, .daterangepicker.single.rtl .drp-calendar { + float: right; } + .daterangepicker.ltr { + direction: ltr; + text-align: left; } + .daterangepicker.ltr .drp-calendar.left { + clear: left; + margin-right: 0; } + .daterangepicker.ltr .drp-calendar.left .calendar-table { + border-right: none; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } + .daterangepicker.ltr .drp-calendar.right { + margin-left: 0; } + .daterangepicker.ltr .drp-calendar.right .calendar-table { + border-left: none; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } + .daterangepicker.ltr .drp-calendar.left .calendar-table { + padding-right: 8px; } + .daterangepicker.ltr .ranges, .daterangepicker.ltr .drp-calendar { + float: left; } + .daterangepicker.rtl { + direction: rtl; + text-align: right; } + .daterangepicker.rtl .drp-calendar.left { + clear: right; + margin-left: 0; } + .daterangepicker.rtl .drp-calendar.left .calendar-table { + border-left: none; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } + .daterangepicker.rtl .drp-calendar.right { + margin-right: 0; } + .daterangepicker.rtl .drp-calendar.right .calendar-table { + border-right: none; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } + .daterangepicker.rtl .drp-calendar.left .calendar-table { + padding-left: 12px; } + .daterangepicker.rtl .ranges, .daterangepicker.rtl .drp-calendar { + text-align: right; + float: right; } } @media (min-width: 730px) { .daterangepicker .ranges { width: auto; } diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.min.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.min.css index c905deaf..8f9c1218 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.min.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.min.css @@ -157,7 +157,6 @@ border: 1px solid transparent; white-space: nowrap; cursor: pointer; - padding: unset; } .daterangepicker .calendar-table { @@ -323,6 +322,37 @@ color: #fff; } +.date-range-picker i.calendar { + display: none; + position: absolute; + right: 28px; + top: 10px; +} + +.date-range-picker.range-label i.calendar { + display: block; +} + +.date-range-picker.range-label.single { + max-width: 200px; +} + +.date-range-picker.range-label { + max-width: 280px; + height: 48px; +} + +.date-range-picker.range-label input { + cursor: pointer; +} + +.date-range-picker.range-label:hover { + background: #e8f1fd; + border-radius: 8px; + color: #3181eb; + cursor: pointer; +} + /* Larger Screen Styling */ @media (min-width: 564px) { .daterangepicker { From 1f8ce012551e7b899efd566cef499f41bbc5dd61 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 10 Feb 2023 13:10:21 +0800 Subject: [PATCH 07/18] Follow up updates on daterangepicker. --- .../client/daterange/resources/css/daterangepicker.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css index 6e3d5abe..161f8799 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker.css @@ -333,8 +333,12 @@ display: block; } -.date-range-picker.range-label { +.date-range-picker.range-label.single { max-width: 200px; +} + +.date-range-picker.range-label { + max-width: 280px; height: 48px; } From d7e8f1bc5fa15312c2ed684a5cc7ee4c9afeab7d Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 10 Feb 2023 13:14:12 +0800 Subject: [PATCH 08/18] License header updates. --- .../daterange/constants/DateRangeType.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java b/src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java index e7774b58..8fae819b 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/constants/DateRangeType.java @@ -1,3 +1,22 @@ +/* + * #%L + * GwtMaterial + * %% + * Copyright (C) 2015 - 2023 GwtMaterialDesign + * %% + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ package gwt.material.design.incubator.client.daterange.constants; import gwt.material.design.client.base.helper.EnumHelper; From a665446e4b2f0483c52eaa2ee3300c844a4f4b5a Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Tue, 14 Feb 2023 06:29:13 +0800 Subject: [PATCH 09/18] EmptyState add ability to have actions. --- .../client/emptystate/MaterialEmptyState.java | 14 +++++++++++--- .../emptystate/resources/css/empty-state.css | 14 ++++++++++++++ .../emptystate/resources/css/empty-state.min.css | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/gwt/material/design/addins/client/emptystate/MaterialEmptyState.java b/src/main/java/gwt/material/design/addins/client/emptystate/MaterialEmptyState.java index 5ee1aaf4..d975f818 100644 --- a/src/main/java/gwt/material/design/addins/client/emptystate/MaterialEmptyState.java +++ b/src/main/java/gwt/material/design/addins/client/emptystate/MaterialEmptyState.java @@ -21,6 +21,7 @@ import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.user.client.ui.Widget; import gwt.material.design.addins.client.MaterialAddins; import gwt.material.design.addins.client.base.constants.AddinsCssName; import gwt.material.design.client.MaterialDesignBase; @@ -28,9 +29,7 @@ import gwt.material.design.client.base.HasTitle; import gwt.material.design.client.base.MaterialWidget; import gwt.material.design.client.constants.*; -import gwt.material.design.client.ui.MaterialIcon; -import gwt.material.design.client.ui.MaterialLoader; -import gwt.material.design.client.ui.MaterialTitle; +import gwt.material.design.client.ui.*; import gwt.material.design.client.ui.html.Div; //@formatter:off @@ -65,6 +64,7 @@ public class MaterialEmptyState extends MaterialWidget implements HasIcon, HasTi private boolean loading; private MaterialIcon icon = new MaterialIcon(); private MaterialTitle title = new MaterialTitle(); + private MaterialPanel actions = new MaterialPanel(); private Div container = new Div(); public MaterialEmptyState() { @@ -91,6 +91,8 @@ protected void onLoad() { container.setWidth("100%"); container.setStyleName(CssName.VALIGN + " " + CssName.CENTER); container.add(title); + actions.addStyleName("actions"); + container.add(actions); title.insert(icon, 0); } @@ -178,6 +180,12 @@ public Div getContainer() { return container; } + public void addAction(Widget widget) { + if (widget != null) { + actions.add(widget); + } + } + public boolean isLoading() { return loading; } diff --git a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css index afe5e5ca..59a48fd6 100644 --- a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css +++ b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css @@ -19,4 +19,18 @@ .empty-state h4 { overflow-wrap: break-word; +} + +.empty-state .actions a { + display: inline-block; + cursor: pointer; + font-size: 1.2em; + position: relative; + top: 20px; + font-weight: 600; +} + +.empty-state .actions a i { + margin-top: 4px; + color: #1a73e8; } \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css index be988c7c..ef2e4e80 100644 --- a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css +++ b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css @@ -1 +1 @@ -.empty-state i.large{border-radius:100%;padding:20px;background:#fff;color:#4caf50;font-size:4rem;box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.empty-state .preloader-wrapper{width:100px;height:100px}.empty-state .loader-wrapper{background:0 0!important;z-index:1}.empty-state h4{overflow-wrap:break-word} \ No newline at end of file +.empty-state i.large{border-radius:100%;padding:20px;background:#fff;color:#4caf50;font-size:4rem;box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.empty-state .preloader-wrapper{width:100px;height:100px}.empty-state .loader-wrapper{background:0 0!important;z-index:1}.empty-state h4{overflow-wrap:break-word}.empty-state .actions a{display:inline-block;cursor:pointer;font-size:1.2em;position:relative;top:20px;font-weight:600}.empty-state .actions a i{margin-top:4px;color:#1a73e8} \ No newline at end of file From 00c3594738d3dc778184f0a685b68b2afa1a3184 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Mon, 20 Feb 2023 09:28:29 +0800 Subject: [PATCH 10/18] Mobile DateRange updates. --- .../css/daterangepicker-materialize.css | 21 ++++++++++++------- .../css/daterangepicker-materialize.min.css | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) 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 0b0b330b..8976d7f9 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 @@ -271,13 +271,6 @@ button.cancelBtn:hover { margin-top: 12px; } - .daterangepicker:not(.single) .calendar-table th.next, - .daterangepicker:not(.single) .calendar-table th.prev { - top: 0px; - position: fixed; - margin: 12px; - } - .daterangepicker:not(.single) td.active, .daterangepicker:not(.single) td.active:hover, .daterangepicker:not(.single) td.in-range.active:not(.off) { @@ -381,6 +374,15 @@ button.cancelBtn:hover { text-transform: uppercase; font-weight: bold; } + + .daterangepicker:not(.single) .drp-calendar.left, + .daterangepicker:not(.single) .drp-calendar.right { + padding: 0px !important; + } + + .daterangepicker:not(.single) .calendar-table td { + line-height: 36px !important; + } } /** Tablet Queries **/ @@ -395,4 +397,9 @@ button.cancelBtn:hover { left: 0; margin-left: 0px; } + + .daterangepicker:not(.single) .calendar-table th.next, + .daterangepicker:not(.single) .calendar-table th.prev{ + top: 0px; + } } \ No newline at end of file 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 1b427d60..ba64904b 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 .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 +.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,.daterangepicker td.available:hover{position:relative}.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: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:12px}.daterangepicker:not(.single) .drp-buttons{position:fixed;bottom:0;width:100%;background:#fafafa;padding-right:5%}.daterangepicker:not(.single) .drp-calendar table thead tr:first-child,.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) 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 .ranges ul:hover:before,.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: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}.daterangepicker:not(.single) .drp-calendar.left,.daterangepicker:not(.single) .drp-calendar.right{padding:0!important}.daterangepicker:not(.single) .calendar-table td{line-height:36px!important}}@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}.daterangepicker:not(.single) .calendar-table th.next,.daterangepicker:not(.single) .calendar-table th.prev{top:0}} \ No newline at end of file From 0ec1400026097f50a2e3946be4532567c62a774f Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Mon, 20 Feb 2023 18:58:59 +0800 Subject: [PATCH 11/18] Make sure to turn events when combobox is detached. --- .../design/addins/client/combobox/MaterialComboBox.java | 4 ++++ 1 file changed, 4 insertions(+) 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 9e6cb105..3cf3ad6a 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 @@ -265,10 +265,14 @@ public void unload() { jsComboBox.off(ComboBoxEvents.CHANGE); jsComboBox.off(ComboBoxEvents.SELECT); jsComboBox.off(ComboBoxEvents.UNSELECT); + jsComboBox.off(ComboBoxEvents.OPENING); jsComboBox.off(ComboBoxEvents.OPEN); + jsComboBox.off(ComboBoxEvents.CLOSING); jsComboBox.off(ComboBoxEvents.CLOSE); jsComboBox.off(ComboBoxEvents.CLEAR); jsComboBox.off(ComboBoxEvents.CLEARING); + jsComboBox.off(ComboBoxEvents.FOCUS); + jsComboBox.off(ComboBoxEvents.KEYUP); body().off("focus"); jsComboBox.select2("destroy"); } From f6959a4c4364e3fa4b6d43d87dad11ed1c84ce95 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Mon, 20 Feb 2023 19:12:05 +0800 Subject: [PATCH 12/18] Add ComboBox to enable focus support. --- .../client/combobox/MaterialComboBox.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 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 3cf3ad6a..3f5a1988 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 @@ -118,6 +118,7 @@ public class MaterialComboBox extends AbstractValueWidget> implements private int selectedIndex; private boolean open; private boolean suppressChangeEvent; + private boolean enableFocus; protected List values = new ArrayList<>(); private Label label = new Label(); private MaterialLabel errorLabel = new MaterialLabel(); @@ -224,12 +225,14 @@ public void load() { return true; }); - body().on(ComboBoxEvents.FOCUS, getSelectContainerSelector(), (e, param1) -> { - if (!e.getCurrentTarget().getClassName().contains("select2-container--focus")) { - DomEvent.fireNativeEvent(Document.get().createFocusEvent(), this, getElement()); - } - return false; - }); + if (enableFocus) { + body().on(ComboBoxEvents.FOCUS, getSelectContainerSelector(), (e, param1) -> { + if (!e.getCurrentTarget().getClassName().contains("select2-container--focus")) { + DomEvent.fireNativeEvent(Document.get().createFocusEvent(), this, getElement()); + } + return false; + }); + } body().on(ComboBoxEvents.KEYUP, getSearchFieldElement(), e -> { KeyEvent keyEvent = (KeyEvent) e; @@ -1268,6 +1271,14 @@ public void setSearchInputValue(String value) { $(getSearchFieldElement()).val(value); } + public boolean isEnableFocus() { + return enableFocus; + } + + public void setEnableFocus(boolean enableFocus) { + this.enableFocus = enableFocus; + } + @Override public void setAsyncDisplayLoader(AsyncDisplayLoader displayLoader) { getAsyncWidgetMixin().setAsyncDisplayLoader(displayLoader); From d5fe1bddf4f1679679d23110a2a19a51a6f03b78 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 3 Mar 2023 05:38:33 +0800 Subject: [PATCH 13/18] Livestamp support for setting null values. --- .../client/livestamp/MaterialLiveStamp.java | 50 +++++++------------ .../client/livestamp/js/JsLiveStamp.java | 2 +- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/main/java/gwt/material/design/addins/client/livestamp/MaterialLiveStamp.java b/src/main/java/gwt/material/design/addins/client/livestamp/MaterialLiveStamp.java index 49cf7c9e..0c3b9077 100644 --- a/src/main/java/gwt/material/design/addins/client/livestamp/MaterialLiveStamp.java +++ b/src/main/java/gwt/material/design/addins/client/livestamp/MaterialLiveStamp.java @@ -19,15 +19,13 @@ */ package gwt.material.design.addins.client.livestamp; -import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Document; -import com.google.gwt.dom.client.Element; import gwt.material.design.addins.client.MaterialAddins; +import gwt.material.design.addins.client.livestamp.js.JsLiveStamp; import gwt.material.design.addins.client.moment.resources.MomentClientBundle; import gwt.material.design.addins.client.moment.resources.MomentClientDebugBundle; import gwt.material.design.client.MaterialDesignBase; import gwt.material.design.client.base.AbstractValueWidget; -import gwt.material.design.client.base.JsLoader; import java.util.Date; @@ -56,9 +54,9 @@ * @see Material Live Stamp * @see LiveStamp 1.1.2 */ -public class MaterialLiveStamp extends AbstractValueWidget implements JsLoader { +public class MaterialLiveStamp extends AbstractValueWidget { - private Date date = new Date(); + private Date value = new Date(); static { if (MaterialAddins.isDebug()) { @@ -75,45 +73,31 @@ public MaterialLiveStamp() { } @Override - protected void onLoad() { - super.onLoad(); + protected void onUnload() { + super.onUnload(); - load(); + destroy(); } @Override - public void load() { - if (date != null) { - setValue(date); + public void setValue(Date value, boolean fireEvents) { + super.setValue(value, fireEvents); + this.value = value; + + if (value != null) { + getElement().setAttribute("data-livestamp", value.toString()); } else { - GWT.log("You must specify the date value.", new IllegalStateException()); + destroy(); } } - @Override - public void unload() { - getElement().removeAttribute("data-livestamp"); - } - - @Override - public void reload() { - unload(); - load(); - } - - @Override - public void setValue(Date date, boolean fireEvents) { - this.date = date; - - if (date != null) { - getElement().setAttribute("data-livestamp", date.toString()); - - super.setValue(date, fireEvents); - } + public void destroy() { + JsLiveStamp.$(getElement()).livestamp("destroy"); + getElement().setInnerText("-"); } @Override public Date getValue() { - return date; + return value; } } diff --git a/src/main/java/gwt/material/design/addins/client/livestamp/js/JsLiveStamp.java b/src/main/java/gwt/material/design/addins/client/livestamp/js/JsLiveStamp.java index f60095b0..740d7669 100644 --- a/src/main/java/gwt/material/design/addins/client/livestamp/js/JsLiveStamp.java +++ b/src/main/java/gwt/material/design/addins/client/livestamp/js/JsLiveStamp.java @@ -43,5 +43,5 @@ public class JsLiveStamp extends JQueryElement { public static native JsLiveStamp $(String selector); @JsMethod - public native JsLiveStamp livestamp(int currentMillis); + public native JsLiveStamp livestamp(String method); } From 8d8b8dfc4f1289443694ba8a1fa619acf12acdee Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 3 Mar 2023 06:13:34 +0800 Subject: [PATCH 14/18] Add combobox reseting. --- .../incubator/client/daterange/DateRangePicker.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 f0e0af45..e37e6cb9 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 @@ -779,6 +779,15 @@ public void setType(DateRangeType type) { dateInput.setReadOnly(type == DateRangeType.LABEL); } + @Override + public void reset() { + super.reset(); + + setAutoUpdateInput(false); + getDateInput().clear(); + reload(); + } + @Override public boolean isNativeBrowserStyle() { return getNativeBrowserStyleMixin().isNativeBrowserStyle(); From b821c50eef5cbf3de36d06cb9081f51f34dae72f Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 24 Mar 2023 07:46:39 +0800 Subject: [PATCH 15/18] PopupMenu - added auto focus feature. --- .../addins/client/popupmenu/MaterialPopupMenu.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java b/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java index 92a325e8..0398df97 100644 --- a/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java +++ b/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java @@ -19,6 +19,7 @@ */ package gwt.material.design.addins.client.popupmenu; +import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Element; import com.google.gwt.event.logical.shared.*; import com.google.gwt.event.shared.HandlerRegistration; @@ -56,6 +57,7 @@ public class MaterialPopupMenu extends UnorderedList implements JsLoader, HasSel private String id; private Object selected; private boolean autoClose = true; + private boolean autoFocus = false; public MaterialPopupMenu() { id = DOM.createUniqueId(); @@ -189,7 +191,7 @@ public HandlerRegistration addSelectionHandler(SelectionHandler selecti @Override public void open() { setVisible(true); - /*Scheduler.get().scheduleDeferred(() -> setFocus(true));*/ + if (autoFocus) Scheduler.get().scheduleDeferred(() -> setFocus(true)); // Check if dropdown is out of the container (Left) if ($(this).width() + $(this).offset().left > body().width()) { @@ -217,6 +219,14 @@ public void setSelected(Object selected) { this.selected = selected; } + public boolean isAutoFocus() { + return autoFocus; + } + + public void setAutoFocus(boolean autoFocus) { + this.autoFocus = autoFocus; + } + @Override public HandlerRegistration addCloseHandler(CloseHandler closeHandler) { return addHandler(new CloseHandler() { From 724fff0fcfa382fc7329db37159f2a5db1356196 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 24 Mar 2023 10:59:57 +0800 Subject: [PATCH 16/18] Fixed popup issue --- .../client/popupmenu/MaterialPopupMenu.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java b/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java index 0398df97..c7b5a6a8 100644 --- a/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java +++ b/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java @@ -57,7 +57,6 @@ public class MaterialPopupMenu extends UnorderedList implements JsLoader, HasSel private String id; private Object selected; private boolean autoClose = true; - private boolean autoFocus = false; public MaterialPopupMenu() { id = DOM.createUniqueId(); @@ -74,8 +73,10 @@ protected void onLoad() { @Override public void load() { $(this).attr("tabindex", "0"); - $(this).on("blur", e -> { - if (autoClose) { + + $(window()).off().on("mouseup", e -> { + boolean closest = $(e.target).closest("#" + id).length() == 0; + if (autoClose && closest) { close(); } return true; @@ -191,7 +192,7 @@ public HandlerRegistration addSelectionHandler(SelectionHandler selecti @Override public void open() { setVisible(true); - if (autoFocus) Scheduler.get().scheduleDeferred(() -> setFocus(true)); + Scheduler.get().scheduleDeferred(() -> setFocus(true)); // Check if dropdown is out of the container (Left) if ($(this).width() + $(this).offset().left > body().width()) { @@ -219,14 +220,6 @@ public void setSelected(Object selected) { this.selected = selected; } - public boolean isAutoFocus() { - return autoFocus; - } - - public void setAutoFocus(boolean autoFocus) { - this.autoFocus = autoFocus; - } - @Override public HandlerRegistration addCloseHandler(CloseHandler closeHandler) { return addHandler(new CloseHandler() { From 33745d7953a39aac62cf3aafab0d03b8842def3b Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Fri, 28 Apr 2023 17:29:03 +0800 Subject: [PATCH 17/18] Fixed MaterialPopupMenu --- .../design/addins/client/popupmenu/MaterialPopupMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java b/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java index c7b5a6a8..70f8cc4a 100644 --- a/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java +++ b/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java @@ -74,7 +74,7 @@ protected void onLoad() { public void load() { $(this).attr("tabindex", "0"); - $(window()).off().on("mouseup", e -> { + $(this).off("mouseup").on("mouseup", e -> { boolean closest = $(e.target).closest("#" + id).length() == 0; if (autoClose && closest) { close(); From 6ae4fd0054ffeccb6144f53806c9fcb5acc6a4b5 Mon Sep 17 00:00:00 2001 From: kevzlou7979 Date: Mon, 8 May 2023 16:02:06 +0800 Subject: [PATCH 18/18] Preparation for 2.7.0 release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff67217c..c89f3259 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ gwt-material-parent com.github.gwtmaterialdesign - 2.7.0-SNAPSHOT + 2.7.0 gwt-material-addins