Skip to content

Commit

Permalink
DateTimePicker: widget implementation and sample
Browse files Browse the repository at this point in the history
[Issue] #1074
[Problem] DateTime picker is not implemented yet
[Solution]
  - added new DataTimePicker widget
  - widget triggers event "selected" on date click/tap
  - widget accepts "data-value" attribute to set value
    in the same way like Date constructor,
    example: data-value="December 17, 1995 03:24:00"
  - added examples

Signed-off-by: Tomasz Lukawski <t.lukawski@samsung.com>
  • Loading branch information
TomaszLukawskiSam committed May 19, 2020
1 parent a9f26cc commit 0260929
Show file tree
Hide file tree
Showing 6 changed files with 770 additions and 16 deletions.
22 changes: 6 additions & 16 deletions examples/mobile/ScheduleApp/create-event.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,15 @@
<div class="ui-content-subheader">
Device on
</div>
<ul class="ui-listview ui-content-area">
<li>
<div class="ui-li-text">
<!--@ToDo: date+time component -->
Sat, Jun20 7:06 AM
</div>
</li>
</ul>
<div class="ui-content-area">
<div id="date-on" class="ui-datetime-picker" data-view="wheel" data-format="12"></div>
</div>
<div class="ui-content-subheader">
Device off
</div>
<ul class="ui-listview ui-content-area">
<li>
<div class="ui-li-text">
<!--@ToDo: date+time component -->
Sat, Jun20 7:06 AM
</div>
</li>
</ul>
<div class="ui-content-area">
<div id="date-off" class="ui-datetime-picker" data-view="wheel" data-format="12"></div>
</div>
<div class="ui-content-subheader">
Repeat weekly
</div>
Expand Down
15 changes: 15 additions & 0 deletions examples/mobile/UIComponents/components/dialogs/picker.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ <h1>
Date picker (Wheel view)
</a>
</li>
<li class="ui-li-anchor">
<a data-position-to="window" data-rel="popup" href="date-time-picker-wheel">
Date Time picker (Wheel view)
</a>
</li>
</ul>
<div class="ui-popup" id="date-picker-calendar-dialog">
<div class="ui-popup-header">
Expand Down Expand Up @@ -93,6 +98,16 @@ <h1>
<button class="ui-btn" data-style="flat">Done</button>
</div>
</div>
<div class="ui-popup" id="date-time-picker-wheel">
<div class="ui-popup-content ui-popup-has-date-picker">
<div class="ui-datetime-picker" data-view="wheel" data-format="12" data-value="2020-03-12 14:46:20"></div>
</div>
<div class="ui-popup-footer">
<button class="ui-btn" data-style="flat">Cancel</button>
<div class="ui-li-divider"></div>
<button class="ui-btn" data-style="flat">Done</button>
</div>
</div>
</div>
<script src="./picker.js"></script>
</div>
Expand Down
105 changes: 105 additions & 0 deletions src/css/profile/mobile/common/datetimepicker.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.ui-datetime-picker {
display: flex;
height: 164 * @px_base;
margin-left: 4%;
margin-right: 6%;
padding-top: 60 * @px_base;
padding-bottom: 81 * @px_base;

&-container {
flex: 1;
font-size: 22 * @sp_base;

&-separator {
position: relative;
&::after {
content: ":";
height: 100%;
width: auto;
color: var(--primary-dark-color);
position: absolute;
display: inline-flex;
align-items: center;
justify-content: center;
right: 0;
}
}
}

&[data-format="12"] {
.ui-datetime-picker-container {
&-date {
min-width: 47%;
}
&-hour {
min-width: 14%;
}
&-minute {
min-width: 14%;
}
&-format {
min-width: 13%;
}
}
}

&[data-format="24"] {
.ui-datetime-picker-container {
&-date {
min-width: 47%;
}
&-hour {
min-width: 14%;
}
&-minute {
min-width: 14%;
}
&-format {
display: none;
}
}
}


.ui-spin {
width: 100%;
height: 164 * @px_base;
justify-content: center;
white-space: nowrap;
font-size: 22 * @sp_base;

.ui-datetime-picker-input {
width: 50 * @px_base;
height: 50 * @px_base;
align-self: center;
text-align: center;
font-size: 22 * @sp_base;
color: transparent;
.font(regular);
border-width: 0;
outline: unset;
outline-offset: unset;
text-shadow: 0 0 0 var(--primary-dark-color);
opacity: 0;

&:focus {
background-color: var(--primary-color-20p);
}
}

&-item {
.font(regular);
line-height: 54 * @px_base;
}
}

&-input-active &-container-hour, &-input-active &-container-minute {
.ui-spin-item {
opacity: 0 !important;
}

.ui-datetime-picker-input {
opacity: 1;
}
}
}
1 change: 1 addition & 0 deletions src/css/profile/mobile/mobile.less
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@
@import "common/timepicker.less";
@import "common/calendar.less";
@import "common/datepicker.less";
@import "common/datetimepicker.less";
1 change: 1 addition & 0 deletions src/js/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"./profile/mobile/widget/Spin",
"./profile/mobile/widget/TimePicker",
"./profile/mobile/widget/DatePicker",
"./profile/mobile/widget/DateTimePicker",
"./core/widget/core/ScrollHandler",
"./core/widget/core/Tabs",
"./profile/mobile/widget/GridView",
Expand Down
Loading

0 comments on commit 0260929

Please sign in to comment.