@gpa-gemstone/react-forms 1.1.60 → 1.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ArrayCheckBoxes.d.ts +33 -11
- package/lib/ArrayCheckBoxes.js +81 -79
- package/lib/ArrayMultiSelect.d.ts +47 -13
- package/lib/ArrayMultiSelect.js +49 -47
- package/lib/CheckBox.d.ts +37 -11
- package/lib/CheckBox.js +62 -60
- package/lib/ColorPicker.d.ts +59 -15
- package/lib/ColorPicker.js +114 -114
- package/lib/DatePicker.d.ts +23 -21
- package/lib/DatePicker.js +221 -214
- package/lib/DateRangePicker.d.ts +64 -13
- package/lib/DateRangePicker.js +143 -132
- package/lib/DateTimeUI/Calender.d.ts +7 -8
- package/lib/DateTimeUI/Calender.js +180 -180
- package/lib/DateTimeUI/Clock.d.ts +9 -10
- package/lib/DateTimeUI/Clock.js +153 -153
- package/lib/DateTimeUI/DateTimePopup.d.ts +16 -17
- package/lib/DateTimeUI/DateTimePopup.js +59 -59
- package/lib/DoubleInput.d.ts +58 -12
- package/lib/DoubleInput.js +55 -51
- package/lib/EnumCheckBoxes.d.ts +41 -9
- package/lib/EnumCheckBoxes.js +65 -58
- package/lib/HelperMessage.d.ts +37 -10
- package/lib/HelperMessage.js +93 -83
- package/lib/Input.d.ts +80 -18
- package/lib/Input.js +111 -106
- package/lib/InputWithButton.d.ts +109 -23
- package/lib/InputWithButton.js +107 -107
- package/lib/MutliCheckBoxSelect.d.ts +42 -18
- package/lib/MutliCheckBoxSelect.js +110 -104
- package/lib/RadioButtons.d.ts +15 -0
- package/lib/RadioButtons.js +62 -0
- package/lib/SearchableSelect.d.ts +60 -18
- package/lib/SearchableSelect.js +84 -85
- package/lib/Select.d.ts +57 -17
- package/lib/Select.js +84 -80
- package/lib/StylableSelect.d.ts +53 -17
- package/lib/StylableSelect.js +106 -101
- package/lib/TextArea.d.ts +54 -14
- package/lib/TextArea.js +76 -72
- package/lib/TimePicker.d.ts +50 -11
- package/lib/TimePicker.js +60 -51
- package/lib/ToggleSwitch.d.ts +44 -12
- package/lib/ToggleSwitch.js +57 -61
- package/lib/index.d.ts +19 -18
- package/lib/index.js +61 -59
- package/package.json +6 -5
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ******************************************************************************************************
|
|
3
|
-
// Calender.tsx - Gbtc
|
|
4
|
-
//
|
|
5
|
-
// Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
|
|
6
|
-
//
|
|
7
|
-
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
|
8
|
-
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
|
9
|
-
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
|
10
|
-
// file except in compliance with the License. You may obtain a copy of the License at:
|
|
11
|
-
//
|
|
12
|
-
// http://opensource.org/licenses/MIT
|
|
13
|
-
//
|
|
14
|
-
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
|
15
|
-
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
|
16
|
-
// License for the specific language governing permissions and limitations.
|
|
17
|
-
//
|
|
18
|
-
// Code Modification History:
|
|
19
|
-
// ----------------------------------------------------------------------------------------------------
|
|
20
|
-
// 05/15/2023 - C. Lackner
|
|
21
|
-
// Generated original version of source code.
|
|
22
|
-
//
|
|
23
|
-
// ******************************************************************************************************
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
React.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
d1
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
React.createElement("th", { style: { width:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
mode === '
|
|
107
|
-
mode === '
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
React.createElement("td", { style: { width: 20, padding: 5 } }, "
|
|
112
|
-
React.createElement("td", { style: { width: 20, padding: 5 } }, "
|
|
113
|
-
React.createElement("td", { style: { width: 20, padding: 5 } }, "
|
|
114
|
-
React.createElement("td", { style: { width: 20, padding: 5 } }, "
|
|
115
|
-
React.createElement("td", { style: { width: 20, padding: 5 } }, "
|
|
116
|
-
React.createElement("td", { style: { width: 20, padding: 5 } }, "
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
React.createElement(DayCell, { date: w.
|
|
123
|
-
React.createElement(DayCell, { date: w.
|
|
124
|
-
React.createElement(DayCell, { date: w.
|
|
125
|
-
React.createElement(DayCell, { date: w.
|
|
126
|
-
React.createElement(DayCell, { date: w.
|
|
127
|
-
React.createElement(DayCell, { date: w.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
133
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
134
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
138
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
139
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
143
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
144
|
-
React.createElement(MonthCell, { date: moment([year,
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
var DayCell = function (props) {
|
|
148
|
-
var _a = React.useState(false), active = _a[0], setActive = _a[1];
|
|
149
|
-
var _b = React.useState(false), hover = _b[0], setHover = _b[1];
|
|
150
|
-
var _c = React.useState(false), disabled = _c[0], setDisabled = _c[1];
|
|
151
|
-
React.useEffect(function () {
|
|
152
|
-
setActive(props.date.date() === props.day && props.month === props.date.month());
|
|
153
|
-
setDisabled(props.date.month() !== props.month);
|
|
154
|
-
}, [props.month, props.date, props.day]);
|
|
155
|
-
var color = (disabled ? '#777' : (active ? '#fff' : undefined));
|
|
156
|
-
var bg = (active ? '#337ab7' : hover ? '#d3d3d3' : undefined);
|
|
157
|
-
return React.createElement("td", { style: {
|
|
158
|
-
width: 20,
|
|
159
|
-
padding: 5,
|
|
160
|
-
color: color,
|
|
161
|
-
backgroundColor: bg,
|
|
162
|
-
cursor: (!active ? 'pointer' : 'default')
|
|
163
|
-
}, onClick: props.onClick, onMouseEnter: function () { return setHover(true); }, onMouseLeave: function () { return setHover(false); } }, props.date.format("DD"));
|
|
164
|
-
};
|
|
165
|
-
var MonthCell = function (props) {
|
|
166
|
-
var _a = React.useState(false), active = _a[0], setActive = _a[1];
|
|
167
|
-
var _b = React.useState(false), hover = _b[0], setHover = _b[1];
|
|
168
|
-
React.useEffect(function () {
|
|
169
|
-
setActive(props.date.month() === props.month);
|
|
170
|
-
}, [props.month, props.date]);
|
|
171
|
-
var color = (active ? '#fff' : undefined);
|
|
172
|
-
var bg = (active ? '#337ab7' : hover ? '#d3d3d3' : undefined);
|
|
173
|
-
return React.createElement("td", { style: {
|
|
174
|
-
width: 54,
|
|
175
|
-
padding: 5,
|
|
176
|
-
color: color,
|
|
177
|
-
backgroundColor: bg,
|
|
178
|
-
cursor: (!active ? 'pointer' : 'default')
|
|
179
|
-
}, onMouseEnter: function () { return setHover(true); }, onMouseLeave: function () { return setHover(false); }, onClick: props.onClick }, props.date.format("MMM"));
|
|
180
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// Calender.tsx - Gbtc
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
|
|
6
|
+
//
|
|
7
|
+
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
|
8
|
+
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
|
9
|
+
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
|
10
|
+
// file except in compliance with the License. You may obtain a copy of the License at:
|
|
11
|
+
//
|
|
12
|
+
// http://opensource.org/licenses/MIT
|
|
13
|
+
//
|
|
14
|
+
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
|
15
|
+
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
|
16
|
+
// License for the specific language governing permissions and limitations.
|
|
17
|
+
//
|
|
18
|
+
// Code Modification History:
|
|
19
|
+
// ----------------------------------------------------------------------------------------------------
|
|
20
|
+
// 05/15/2023 - C. Lackner
|
|
21
|
+
// Generated original version of source code.
|
|
22
|
+
//
|
|
23
|
+
// ******************************************************************************************************
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.default = Calender;
|
|
26
|
+
var React = require("react");
|
|
27
|
+
var moment = require("moment");
|
|
28
|
+
function Calender(props) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
var _e = React.useState([]), weeks = _e[0], setWeeks = _e[1];
|
|
31
|
+
var _f = React.useState((_b = (_a = props.DateTime) === null || _a === void 0 ? void 0 : _a.month()) !== null && _b !== void 0 ? _b : 0), month = _f[0], setMonth = _f[1];
|
|
32
|
+
var _g = React.useState((_d = (_c = props.DateTime) === null || _c === void 0 ? void 0 : _c.year()) !== null && _d !== void 0 ? _d : moment.utc().year()), year = _g[0], setYear = _g[1];
|
|
33
|
+
var _h = React.useState('month'), mode = _h[0], setMode = _h[1];
|
|
34
|
+
var _j = React.useState('None'), hover = _j[0], setHover = _j[1];
|
|
35
|
+
React.useEffect(function () {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
37
|
+
setMonth(isNaN((_b = (_a = props.DateTime) === null || _a === void 0 ? void 0 : _a.month()) !== null && _b !== void 0 ? _b : NaN) ? 0 : ((_d = (_c = props.DateTime) === null || _c === void 0 ? void 0 : _c.month()) !== null && _d !== void 0 ? _d : 0));
|
|
38
|
+
setYear(isNaN((_f = (_e = props.DateTime) === null || _e === void 0 ? void 0 : _e.year()) !== null && _f !== void 0 ? _f : NaN) ? moment.utc().year() : ((_h = (_g = props.DateTime) === null || _g === void 0 ? void 0 : _g.year()) !== null && _h !== void 0 ? _h : moment.utc().year()));
|
|
39
|
+
}, [props.DateTime]);
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
var d1 = moment([year, month, 1]).startOf('week');
|
|
42
|
+
var w = [];
|
|
43
|
+
while ((d1.month() <= month && d1.year() === year) || (d1.year() < year)) {
|
|
44
|
+
w.push({
|
|
45
|
+
sunday: moment(d1),
|
|
46
|
+
monday: moment(d1).add(1, 'day'),
|
|
47
|
+
tuesday: moment(d1).add(2, 'day'),
|
|
48
|
+
wednesday: moment(d1).add(3, 'day'),
|
|
49
|
+
thursday: moment(d1).add(4, 'day'),
|
|
50
|
+
friday: moment(d1).add(5, 'day'),
|
|
51
|
+
saturday: moment(d1).add(6, 'day')
|
|
52
|
+
});
|
|
53
|
+
d1.add(1, 'week');
|
|
54
|
+
d1 = moment(d1).startOf('week');
|
|
55
|
+
}
|
|
56
|
+
setWeeks(w);
|
|
57
|
+
}, [month, year]);
|
|
58
|
+
function toNext() {
|
|
59
|
+
if (mode === 'month' && month === 11) {
|
|
60
|
+
setMonth(0);
|
|
61
|
+
setYear(function (y) { return y + 1; });
|
|
62
|
+
}
|
|
63
|
+
else if (mode === 'month') {
|
|
64
|
+
setMonth(function (m) { return m + 1; });
|
|
65
|
+
}
|
|
66
|
+
else if (mode === 'year') {
|
|
67
|
+
setYear(function (y) { return y + 1; });
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
setYear(function (y) { return y + 12; });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function toPrev() {
|
|
74
|
+
if (mode === 'month' && month === 0) {
|
|
75
|
+
setMonth(11);
|
|
76
|
+
setYear(function (y) { return y - 1; });
|
|
77
|
+
}
|
|
78
|
+
else if (mode === 'month') {
|
|
79
|
+
setMonth(function (m) { return m - 1; });
|
|
80
|
+
}
|
|
81
|
+
else if (mode === 'year') {
|
|
82
|
+
setYear(function (y) { return y - 1; });
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setYear(function (y) { return y - 12; });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function setDate(d) {
|
|
89
|
+
var ud = moment(props.DateTime);
|
|
90
|
+
if (!ud.isValid())
|
|
91
|
+
ud = moment.utc().startOf('d');
|
|
92
|
+
ud.year(d.year()).month(d.month()).date(d.date());
|
|
93
|
+
props.Setter(ud);
|
|
94
|
+
}
|
|
95
|
+
var headerWidth = (mode === 'month' ? 5 : 2);
|
|
96
|
+
return (React.createElement("div", { style: { background: '#f0f0f0', opacity: 1 } },
|
|
97
|
+
React.createElement("table", { style: { textAlign: 'center' } },
|
|
98
|
+
React.createElement("thead", { style: { verticalAlign: 'middle', fontWeight: 'bold' } },
|
|
99
|
+
React.createElement("tr", { style: { height: 20, lineHeight: '20px' } },
|
|
100
|
+
React.createElement("th", { style: { width: 20, padding: 5, cursor: 'pointer' }, onMouseEnter: function () { return setHover('Previous'); }, onMouseLeave: function () { return setHover('None'); }, onClick: toPrev }, '<'),
|
|
101
|
+
React.createElement("th", { style: { width: 145, padding: 5, cursor: 'pointer' }, colSpan: headerWidth, onClick: function (evt) {
|
|
102
|
+
evt.stopPropagation();
|
|
103
|
+
if (mode === 'month')
|
|
104
|
+
setMode('year');
|
|
105
|
+
}, onMouseEnter: function () { return setHover('Center'); }, onMouseLeave: function () { return setHover('None'); } },
|
|
106
|
+
mode === 'month' ? moment([year, month, 1]).format('MMMM YYYY') : '',
|
|
107
|
+
mode === 'year' ? year : '',
|
|
108
|
+
mode === 'dozenYear' ? "".concat(year - 6, "-").concat(year + 5) : ''),
|
|
109
|
+
React.createElement("th", { style: { width: 20, padding: 5, cursor: 'pointer' }, onClick: toNext, onMouseEnter: function () { return setHover('Next'); }, onMouseLeave: function () { return setHover('None'); } }, '>')),
|
|
110
|
+
mode === 'month' ? React.createElement("tr", { style: { height: 20, lineHeight: '20px' } },
|
|
111
|
+
React.createElement("td", { style: { width: 20, padding: 5 } }, "SU"),
|
|
112
|
+
React.createElement("td", { style: { width: 20, padding: 5 } }, "MO"),
|
|
113
|
+
React.createElement("td", { style: { width: 20, padding: 5 } }, "TU"),
|
|
114
|
+
React.createElement("td", { style: { width: 20, padding: 5 } }, "WE"),
|
|
115
|
+
React.createElement("td", { style: { width: 20, padding: 5 } }, "TH"),
|
|
116
|
+
React.createElement("td", { style: { width: 20, padding: 5 } }, "FR"),
|
|
117
|
+
React.createElement("td", { style: { width: 20, padding: 5 } }, "SA")) : null),
|
|
118
|
+
React.createElement("tbody", null,
|
|
119
|
+
mode === 'month' ? weeks.map(function (w) {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
121
|
+
return React.createElement("tr", { key: w.sunday.isoWeek(), style: { height: 20, lineHeight: '20px' } },
|
|
122
|
+
React.createElement(DayCell, { date: w.sunday, month: month, day: (_b = (_a = props.DateTime) === null || _a === void 0 ? void 0 : _a.date()) !== null && _b !== void 0 ? _b : -1, onClick: function (evt) { evt.stopPropagation(); setDate(w.sunday); } }),
|
|
123
|
+
React.createElement(DayCell, { date: w.monday, month: month, day: (_d = (_c = props.DateTime) === null || _c === void 0 ? void 0 : _c.date()) !== null && _d !== void 0 ? _d : -1, onClick: function (evt) { evt.stopPropagation(); setDate(w.monday); } }),
|
|
124
|
+
React.createElement(DayCell, { date: w.tuesday, month: month, day: (_f = (_e = props.DateTime) === null || _e === void 0 ? void 0 : _e.date()) !== null && _f !== void 0 ? _f : -1, onClick: function (evt) { evt.stopPropagation(); setDate(w.tuesday); } }),
|
|
125
|
+
React.createElement(DayCell, { date: w.wednesday, month: month, day: (_h = (_g = props.DateTime) === null || _g === void 0 ? void 0 : _g.date()) !== null && _h !== void 0 ? _h : -1, onClick: function (evt) { evt.stopPropagation(); setDate(w.wednesday); } }),
|
|
126
|
+
React.createElement(DayCell, { date: w.thursday, month: month, day: (_k = (_j = props.DateTime) === null || _j === void 0 ? void 0 : _j.date()) !== null && _k !== void 0 ? _k : -1, onClick: function (evt) { evt.stopPropagation(); setDate(w.thursday); } }),
|
|
127
|
+
React.createElement(DayCell, { date: w.friday, month: month, day: (_m = (_l = props.DateTime) === null || _l === void 0 ? void 0 : _l.date()) !== null && _m !== void 0 ? _m : -1, onClick: function (evt) { evt.stopPropagation(); setDate(w.friday); } }),
|
|
128
|
+
React.createElement(DayCell, { date: w.saturday, month: month, day: (_p = (_o = props.DateTime) === null || _o === void 0 ? void 0 : _o.date()) !== null && _p !== void 0 ? _p : -1, onClick: function (evt) { evt.stopPropagation(); setDate(w.saturday); } }));
|
|
129
|
+
}) : null,
|
|
130
|
+
mode === 'year' ? React.createElement(React.Fragment, null,
|
|
131
|
+
React.createElement("tr", { style: { height: 54, lineHeight: '54px' } },
|
|
132
|
+
React.createElement(MonthCell, { date: moment([year, 0, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(0); } }),
|
|
133
|
+
React.createElement(MonthCell, { date: moment([year, 1, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(1); } }),
|
|
134
|
+
React.createElement(MonthCell, { date: moment([year, 2, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(2); } }),
|
|
135
|
+
React.createElement(MonthCell, { date: moment([year, 3, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(3); } })),
|
|
136
|
+
React.createElement("tr", { style: { height: 54, lineHeight: '54px' } },
|
|
137
|
+
React.createElement(MonthCell, { date: moment([year, 4, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(4); } }),
|
|
138
|
+
React.createElement(MonthCell, { date: moment([year, 5, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(5); } }),
|
|
139
|
+
React.createElement(MonthCell, { date: moment([year, 6, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(6); } }),
|
|
140
|
+
React.createElement(MonthCell, { date: moment([year, 7, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(7); } })),
|
|
141
|
+
React.createElement("tr", { style: { height: 54, lineHeight: '54px' } },
|
|
142
|
+
React.createElement(MonthCell, { date: moment([year, 8, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(8); } }),
|
|
143
|
+
React.createElement(MonthCell, { date: moment([year, 9, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(9); } }),
|
|
144
|
+
React.createElement(MonthCell, { date: moment([year, 10, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(10); } }),
|
|
145
|
+
React.createElement(MonthCell, { date: moment([year, 11, 1]), month: month, onClick: function (evt) { evt.stopPropagation(); setMode('month'); setMonth(11); } }))) : null))));
|
|
146
|
+
}
|
|
147
|
+
var DayCell = function (props) {
|
|
148
|
+
var _a = React.useState(false), active = _a[0], setActive = _a[1];
|
|
149
|
+
var _b = React.useState(false), hover = _b[0], setHover = _b[1];
|
|
150
|
+
var _c = React.useState(false), disabled = _c[0], setDisabled = _c[1];
|
|
151
|
+
React.useEffect(function () {
|
|
152
|
+
setActive(props.date.date() === props.day && props.month === props.date.month());
|
|
153
|
+
setDisabled(props.date.month() !== props.month);
|
|
154
|
+
}, [props.month, props.date, props.day]);
|
|
155
|
+
var color = (disabled ? '#777' : (active ? '#fff' : undefined));
|
|
156
|
+
var bg = (active ? '#337ab7' : hover ? '#d3d3d3' : undefined);
|
|
157
|
+
return React.createElement("td", { style: {
|
|
158
|
+
width: 20,
|
|
159
|
+
padding: 5,
|
|
160
|
+
color: color,
|
|
161
|
+
backgroundColor: bg,
|
|
162
|
+
cursor: (!active ? 'pointer' : 'default')
|
|
163
|
+
}, onClick: props.onClick, onMouseEnter: function () { return setHover(true); }, onMouseLeave: function () { return setHover(false); } }, props.date.format("DD"));
|
|
164
|
+
};
|
|
165
|
+
var MonthCell = function (props) {
|
|
166
|
+
var _a = React.useState(false), active = _a[0], setActive = _a[1];
|
|
167
|
+
var _b = React.useState(false), hover = _b[0], setHover = _b[1];
|
|
168
|
+
React.useEffect(function () {
|
|
169
|
+
setActive(props.date.month() === props.month);
|
|
170
|
+
}, [props.month, props.date]);
|
|
171
|
+
var color = (active ? '#fff' : undefined);
|
|
172
|
+
var bg = (active ? '#337ab7' : hover ? '#d3d3d3' : undefined);
|
|
173
|
+
return React.createElement("td", { style: {
|
|
174
|
+
width: 54,
|
|
175
|
+
padding: 5,
|
|
176
|
+
color: color,
|
|
177
|
+
backgroundColor: bg,
|
|
178
|
+
cursor: (!active ? 'pointer' : 'default')
|
|
179
|
+
}, onMouseEnter: function () { return setHover(true); }, onMouseLeave: function () { return setHover(false); }, onClick: props.onClick }, props.date.format("MMM"));
|
|
180
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
1
|
+
import * as moment from 'moment';
|
|
2
|
+
interface IProps {
|
|
3
|
+
DateTime: moment.Moment | undefined;
|
|
4
|
+
Setter: (record: moment.Moment) => void;
|
|
5
|
+
Accuracy?: Accuracy;
|
|
6
|
+
}
|
|
7
|
+
export type Accuracy = ('minute' | 'second' | 'millisecond');
|
|
8
|
+
export default function Clock(props: IProps): JSX.Element;
|
|
9
|
+
export {};
|