-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
213 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "zdk-calendar", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"authors": [ | ||
"Fabrice <[email protected]>" | ||
], | ||
|
@@ -23,6 +23,7 @@ | |
"dependencies": { | ||
"momentjs": "~2.8.3", | ||
"polymer": "Polymer/polymer#~0.5.1", | ||
"core-icon":"Polymer/core-icon#~0.5.1", | ||
"core-iconset-svg": "Polymer/core-iconset-svg#~0.5.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="apple-mobile-web-app-capable" content="yes"/> | ||
<meta name="apple-touch-fullscreen" content="yes"> | ||
<meta name="mobile-web-app-capable" content="yes"> | ||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/> | ||
<script src="../webcomponentsjs/webcomponents.min.js"></script> | ||
<link rel="import" href="zdk-input-date.html"> | ||
<style> | ||
</style> | ||
</head> | ||
<body> | ||
<label>Date : </label><zdk-input-date autoCollapse="true" currentDateAuto="true" inputDisabled="true" style="width:200px"></zdk-input-date> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
:host { | ||
display:inline-block; | ||
align-self: baseline; | ||
} | ||
.input { | ||
display:-ms-flexbox; | ||
display:-webkit-flex; | ||
display:flex; | ||
} | ||
input { | ||
height:30px; | ||
padding:0px; | ||
margin: 0px; | ||
border:1px solid lightgray; | ||
/* Pour iOS*/ | ||
-webkit-appearance: none; | ||
-webkit-border-radius:0; | ||
box-sizing: border-box; | ||
font-size: 0.8em; | ||
padding-left: 5px; | ||
outline:none; | ||
} | ||
button { | ||
width:30px; | ||
height:30px; | ||
padding: 0px; | ||
margin: 0px; | ||
border:2px; | ||
background-color:lightgray; | ||
outline: none; | ||
} | ||
.dropdown { | ||
-webkit-animation: animation 1.2s; | ||
-moz-animation: animation 1.2s; | ||
animation: animation 1.2s | ||
} | ||
/* Chrome, Safari, Opera */ | ||
@-webkit-keyframes animation { | ||
0% {opacity:0;} | ||
100% {opacity:1:} | ||
} | ||
/* Firefox */ | ||
@-moz-keyframes animation { | ||
0% {opacity:0;} | ||
100% {opacity:1:} | ||
} | ||
/* IE */ | ||
@keyframes animation { | ||
0% {opacity:0;} | ||
100% {opacity:1:} | ||
} | ||
.collapse { | ||
display:none; | ||
} | ||
#arrowup { | ||
position:absolute; | ||
margin-top: -14px; | ||
} | ||
#arrowup div { | ||
position:absolute; | ||
width: 0; | ||
height: 0; | ||
border-left: 15px solid transparent; | ||
border-right: 15px solid transparent; | ||
} | ||
.outside { | ||
border-bottom: 15px solid lightgray; | ||
margin-top: 0px; | ||
} | ||
.inner { | ||
border-bottom: 15px solid white; | ||
margin-top: 1px; | ||
} | ||
zdk-calendar { | ||
border: 1px solid lightgrey; | ||
width:250px; | ||
height:250px; | ||
} | ||
#divcalendar { | ||
position:absolute; | ||
margin-top:7px; | ||
box-shadow: 2px 2px 20px lightgrey; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<link rel="import" href="../polymer/polymer.html"> | ||
<link rel="import" href="../zdk-calendar/zdk-calendar.html"> | ||
|
||
<polymer-element name="zdk-input-date" attributes="currentDateAuto autoCollapse inputDisabled i18n" onclick=""> | ||
<template> | ||
<link rel="stylesheet" href="zdk-input-date.css"> | ||
<div class="input"> | ||
<input id="dateinput"><button id="button"></button> | ||
</div> | ||
<div id="divcalendar" class="collapse"> | ||
<div id="arrowup"> | ||
<div class="outside"></div> | ||
<div class="inner"></div> | ||
</div> | ||
<zdk-calendar id="calendar"></zdk-calendar> | ||
</div> | ||
<content></content> | ||
</template> | ||
<script> | ||
Polymer('zdk-input-date', { | ||
i18n: null, | ||
currentDateAuto: false, | ||
autoCollapse:false, | ||
inputDisabled : false, | ||
domReady: function() { | ||
this.i18n = this.i18n?this.i18n:navigator.language || navigator.userLanguage; | ||
console.log("i18n",this.i18n); | ||
moment.locale(this.i18n); | ||
this.$.calendar.i18n = this.i18n; | ||
var pos = this.$.button.offsetLeft+15; | ||
this.$.divcalendar.style.left = (pos - 125)+"px"; | ||
this.$.arrowup.style.left = (pos - 125)+"px" | ||
var that=this; | ||
if (this.autoCollapse === true) { | ||
this.toggleCollapse(); | ||
} | ||
if (this.inputDisabled === true) { | ||
this.$.dateinput.setAttribute("disabled", ""); | ||
} | ||
this.$.button.addEventListener("click", function(e) { | ||
that.toggleCollapse(); | ||
}); | ||
this.$.dateinput.addEventListener("click", function(e) { | ||
that.toggleCollapse(); | ||
}); | ||
if (this.currentDateAuto === true) { | ||
console.log("date ",this.$.calendar.day.format("L"), this.$.calendar.i18n ); | ||
this.fillInput(this.$.calendar.day.format("L")); | ||
} | ||
this.$.calendar.addEventListener('select', function(e) { | ||
that.fillInput(e.detail.day); | ||
}); | ||
}, | ||
toggleCollapse: function() { | ||
if( this.$.dateinput.value ) { | ||
this.$.calendar.selected = this.$.dateinput.value; | ||
} | ||
var cad = this.$.divcalendar; | ||
if(cad.getAttribute("class") == "collapse") { | ||
cad.setAttribute("class", "dropdown"); | ||
} else { | ||
cad.setAttribute("class", "collapse"); | ||
} | ||
}, | ||
fillInput: function(date) { | ||
this.$.dateinput.value = date; | ||
this.toggleCollapse(); | ||
}, | ||
getValue: function() { | ||
return this.$.dateinput.value; | ||
} | ||
}); | ||
</script> | ||
</polymer-element> |