diff options
author | 崖鹰 <zhao.wuz@alipay.com> | 2015-11-13 11:33:48 +0800 |
---|---|---|
committer | 崖鹰 <zhao.wuz@alipay.com> | 2015-11-13 11:33:48 +0800 |
commit | 02de449a0474765a4796fa607e7e3922252f574f (patch) | |
tree | dc37faf2f610343112ea1fc3707ad188092bd031 /src/util | |
parent | 1f336fabc9135ac971e53d9c2ae407db69b8f096 (diff) | |
download | time-picker-02de449a0474765a4796fa607e7e3922252f574f.tar.gz time-picker-02de449a0474765a4796fa607e7e3922252f574f.tar.zst time-picker-02de449a0474765a4796fa607e7e3922252f574f.zip |
release 0.1.0
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/index.js | 8 | ||||
-rw-r--r-- | src/util/placements.js | 35 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/util/index.js b/src/util/index.js new file mode 100644 index 0000000..5bc0a78 --- /dev/null +++ b/src/util/index.js | |||
@@ -0,0 +1,8 @@ | |||
1 | import DateTimeFormat from 'gregorian-calendar-format'; | ||
2 | |||
3 | export function getFormatter(format, locale) { | ||
4 | if (typeof format === 'string') { | ||
5 | return new DateTimeFormat(format, locale.format); | ||
6 | } | ||
7 | return format; | ||
8 | } | ||
diff --git a/src/util/placements.js b/src/util/placements.js new file mode 100644 index 0000000..2574da1 --- /dev/null +++ b/src/util/placements.js | |||
@@ -0,0 +1,35 @@ | |||
1 | const autoAdjustOverflow = { | ||
2 | adjustX: 1, | ||
3 | adjustY: 1, | ||
4 | }; | ||
5 | |||
6 | const targetOffset = [0, 0]; | ||
7 | |||
8 | const placements = { | ||
9 | topLeft: { | ||
10 | points: ['tl', 'tl'], | ||
11 | overflow: autoAdjustOverflow, | ||
12 | offset: [0, -3], | ||
13 | targetOffset, | ||
14 | }, | ||
15 | topRight: { | ||
16 | points: ['tr', 'tr'], | ||
17 | overflow: autoAdjustOverflow, | ||
18 | offset: [0, -3], | ||
19 | targetOffset, | ||
20 | }, | ||
21 | bottomRight: { | ||
22 | points: ['br', 'br'], | ||
23 | overflow: autoAdjustOverflow, | ||
24 | offset: [0, 3], | ||
25 | targetOffset, | ||
26 | }, | ||
27 | bottomLeft: { | ||
28 | points: ['bl', 'bl'], | ||
29 | overflow: autoAdjustOverflow, | ||
30 | offset: [0, 3], | ||
31 | targetOffset, | ||
32 | }, | ||
33 | }; | ||
34 | |||
35 | export default placements; | ||