1 | import { View, CSSType } from '../core/view';
|
2 | import { booleanConverter } from '../core/view-base';
|
3 | import { Property } from '../core/properties';
|
4 | const defaultDate = new Date();
|
5 | const dateComparer = (x, y) => x <= y && x >= y;
|
6 | let DatePickerBase = class DatePickerBase extends View {
|
7 | };
|
8 | DatePickerBase = __decorate([
|
9 | CSSType('DatePicker')
|
10 | ], DatePickerBase);
|
11 | export { DatePickerBase };
|
12 | DatePickerBase.prototype.recycleNativeView = 'auto';
|
13 | export const yearProperty = new Property({
|
14 | name: 'year',
|
15 | defaultValue: defaultDate.getFullYear(),
|
16 | valueConverter: (v) => parseInt(v),
|
17 | });
|
18 | yearProperty.register(DatePickerBase);
|
19 | export const monthProperty = new Property({
|
20 | name: 'month',
|
21 | defaultValue: defaultDate.getMonth() + 1,
|
22 | valueConverter: (v) => parseInt(v),
|
23 | });
|
24 | monthProperty.register(DatePickerBase);
|
25 | export const dayProperty = new Property({
|
26 | name: 'day',
|
27 | defaultValue: defaultDate.getDate(),
|
28 | valueConverter: (v) => parseInt(v),
|
29 | });
|
30 | dayProperty.register(DatePickerBase);
|
31 | export const hourProperty = new Property({
|
32 | name: 'hour',
|
33 | defaultValue: defaultDate.getHours(),
|
34 | valueConverter: (v) => parseInt(v),
|
35 | });
|
36 | hourProperty.register(DatePickerBase);
|
37 | export const minuteProperty = new Property({
|
38 | name: 'minute',
|
39 | defaultValue: defaultDate.getMinutes(),
|
40 | valueConverter: (v) => parseInt(v),
|
41 | });
|
42 | minuteProperty.register(DatePickerBase);
|
43 | export const secondProperty = new Property({
|
44 | name: 'second',
|
45 | defaultValue: defaultDate.getSeconds(),
|
46 | valueConverter: (v) => parseInt(v),
|
47 | });
|
48 | secondProperty.register(DatePickerBase);
|
49 |
|
50 | export const maxDateProperty = new Property({
|
51 | name: 'maxDate',
|
52 | equalityComparer: dateComparer,
|
53 | valueConverter: (v) => new Date(v),
|
54 | });
|
55 | maxDateProperty.register(DatePickerBase);
|
56 | export const minDateProperty = new Property({
|
57 | name: 'minDate',
|
58 | equalityComparer: dateComparer,
|
59 | valueConverter: (v) => new Date(v),
|
60 | });
|
61 | minDateProperty.register(DatePickerBase);
|
62 | export const dateProperty = new Property({
|
63 | name: 'date',
|
64 | defaultValue: defaultDate,
|
65 | equalityComparer: dateComparer,
|
66 | valueConverter: (v) => new Date(v),
|
67 | });
|
68 | dateProperty.register(DatePickerBase);
|
69 | export const showTimeProperty = new Property({
|
70 | name: 'showTime',
|
71 | defaultValue: false,
|
72 | valueConverter: (v) => booleanConverter(v),
|
73 | });
|
74 | showTimeProperty.register(DatePickerBase);
|
75 | export const iosPreferredDatePickerStyleProperty = new Property({
|
76 | name: 'iosPreferredDatePickerStyle',
|
77 | defaultValue: 0,
|
78 | valueConverter: (v) => parseInt(v),
|
79 | });
|
80 | iosPreferredDatePickerStyleProperty.register(DatePickerBase);
|
81 |
|
\ | No newline at end of file |