-
Notifications
You must be signed in to change notification settings - Fork 0
/
plain-picker.html
95 lines (89 loc) · 3.09 KB
/
plain-picker.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="./src/pp-nav.html">
<link rel="import" href="./src/pp-month.html">
<link rel="import" href="./src/pp-default-locale.html">
<link rel="import" href="./src/pp-week-header.html">
<link rel="import" href="./src/pp-date-transformer.html">
<!--
`plain-picker`
@demo demo/index.html
-->
<dom-module id="plain-picker">
<template>
<style>
:host {
display: block;
padding: 1.428em; /* 20 px on 14px font size */
}
pp-week-header {
margin: 0.3em 0;
border-color: var(--plain-picker-base-color, black);
border-width: 1px 0;
border-style: solid;
}
</style>
<!-- begin:data -->
<pp-date-transformer date="{{_date}}"
json="{{date}}"></pp-date-transformer>
<pp-date-transformer date="{{_minDate}}"
json="{{minDate}}"></pp-date-transformer>
<pp-date-transformer date="{{_maxDate}}"
json="{{maxDate}}"></pp-date-transformer>
<pp-default-locale id="default-locale" value="{{_defaultLocale}}"></pp-default-locale>
<!-- end: data -->
<!-- begin: ui -->
<pp-nav year="{{_year}}"
month="{{_month}}"
date="[[_date]]"
locale="[[_locale]]"
min-date="[[_minDate]]"
max-date="[[_maxDate]]"></pp-nav>
<pp-week-header locale="[[_locale]]"
day-format="single"></pp-week-header>
<pp-month active-date="{{_date}}"
year="[[_year]]"
month="[[_month]]"
locale="[[_locale]]"
min-date="[[_minDate]]"
max-date="[[_maxDate]]"></pp-month>
<!-- end: ui -->
</template>
<script>
Polymer({
is: 'plain-picker',
properties: {
date: {
type: String,
notify: true,
value: () => (new Date()).toJSON()
},
locale: {
type: Object,
value: () => ({})
},
minDate: {
type: Object,
value: null
},
maxDate: {
type: Object,
value: null
},
_locale: {
type: Object,
computed: '_localeWithDefaults(locale.*, _defaultLocale)'
},
_year: Number,
_month: Number,
_defaultLocale: Object,
_date: Object,
_minDate: Object,
_maxDate: Object
},
_localeWithDefaults (localeMutations, defaultLocale) {
const locale = localeMutations.base;
return Object.assign({}, defaultLocale, locale);
}
});
</script>
</dom-module>