superdesk-ui-framework 5.0.2 → 5.0.3
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/.mocharc.json +1 -1
- package/app-typescript/components/TimePicker/TimePickerPopover.spec.ts +163 -0
- package/app-typescript/components/TimePicker/TimePickerPopover.tsx +286 -0
- package/app-typescript/components/TimePicker/TimeValueHolder.tsx +36 -0
- package/app-typescript/components/{TimePicker.tsx → TimePicker/index.tsx} +6 -12
- package/dist/components/TimePicker.tsx +7 -2
- package/dist/examples.bundle.js +1091 -1006
- package/dist/superdesk-ui.bundle.js +802 -717
- package/dist/vendor.bundle.js +15 -15
- package/package.json +1 -1
- package/react/components/TimePicker/TimePickerPopover.d.ts +27 -0
- package/react/components/TimePicker/TimePickerPopover.js +231 -0
- package/react/components/TimePicker/TimeValueHolder.d.ts +13 -0
- package/react/components/TimePicker/TimeValueHolder.js +73 -0
- package/react/components/{TimePicker.d.ts → TimePicker/index.d.ts} +1 -1
- package/react/components/{TimePicker.js → TimePicker/index.js} +5 -9
- package/app-typescript/components/TimePickerPopover.tsx +0 -283
- package/react/components/TimePickerPopover.d.ts +0 -18
- package/react/components/TimePickerPopover.js +0 -222
package/dist/vendor.bundle.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
var a = typeof exports === 'object' ? factory(require("react"), require("react-dom"), require("angular")) : factory(root["react"], root["react-dom"], root["angular"]);
|
|
8
8
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
9
|
}
|
|
10
|
-
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_13__,
|
|
10
|
+
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_13__, __WEBPACK_EXTERNAL_MODULE_919__) {
|
|
11
11
|
return /******/ (function(modules) { // webpackBootstrap
|
|
12
12
|
/******/ // The module cache
|
|
13
13
|
/******/ var installedModules = {};
|
|
@@ -70,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
70
70
|
/******/ __webpack_require__.p = "";
|
|
71
71
|
/******/
|
|
72
72
|
/******/ // Load entry module and return exports
|
|
73
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
73
|
+
/******/ return __webpack_require__(__webpack_require__.s = 916);
|
|
74
74
|
/******/ })
|
|
75
75
|
/************************************************************************/
|
|
76
76
|
/******/ ({
|
|
@@ -89,7 +89,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_13__;
|
|
|
89
89
|
|
|
90
90
|
/***/ }),
|
|
91
91
|
|
|
92
|
-
/***/
|
|
92
|
+
/***/ 24:
|
|
93
93
|
/***/ (function(module, exports, __webpack_require__) {
|
|
94
94
|
|
|
95
95
|
/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
@@ -28253,24 +28253,24 @@ return jQuery;
|
|
|
28253
28253
|
|
|
28254
28254
|
/***/ }),
|
|
28255
28255
|
|
|
28256
|
-
/***/
|
|
28256
|
+
/***/ 916:
|
|
28257
28257
|
/***/ (function(module, exports, __webpack_require__) {
|
|
28258
28258
|
|
|
28259
28259
|
"use strict";
|
|
28260
28260
|
|
|
28261
28261
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28262
|
-
__webpack_require__(
|
|
28262
|
+
__webpack_require__(24);
|
|
28263
28263
|
__webpack_require__(89);
|
|
28264
|
-
__webpack_require__(
|
|
28265
|
-
__webpack_require__(918);
|
|
28264
|
+
__webpack_require__(917);
|
|
28266
28265
|
__webpack_require__(919);
|
|
28266
|
+
__webpack_require__(920);
|
|
28267
28267
|
__webpack_require__(0);
|
|
28268
28268
|
__webpack_require__(13);
|
|
28269
28269
|
|
|
28270
28270
|
|
|
28271
28271
|
/***/ }),
|
|
28272
28272
|
|
|
28273
|
-
/***/
|
|
28273
|
+
/***/ 917:
|
|
28274
28274
|
/***/ (function(module, exports, __webpack_require__) {
|
|
28275
28275
|
|
|
28276
28276
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
@@ -28294,7 +28294,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
28294
28294
|
if ( true ) {
|
|
28295
28295
|
|
|
28296
28296
|
// AMD. Register as an anonymous module.
|
|
28297
|
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(89), __webpack_require__(
|
|
28297
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(89), __webpack_require__(918) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
28298
28298
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
28299
28299
|
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
|
28300
28300
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
@@ -29032,7 +29032,7 @@ return $.widget;
|
|
|
29032
29032
|
|
|
29033
29033
|
/***/ }),
|
|
29034
29034
|
|
|
29035
|
-
/***/
|
|
29035
|
+
/***/ 918:
|
|
29036
29036
|
/***/ (function(module, exports, __webpack_require__) {
|
|
29037
29037
|
|
|
29038
29038
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
|
|
@@ -29062,23 +29062,23 @@ return $.ui.version = "1.13.0";
|
|
|
29062
29062
|
|
|
29063
29063
|
/***/ }),
|
|
29064
29064
|
|
|
29065
|
-
/***/
|
|
29065
|
+
/***/ 919:
|
|
29066
29066
|
/***/ (function(module, exports) {
|
|
29067
29067
|
|
|
29068
|
-
module.exports =
|
|
29068
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_919__;
|
|
29069
29069
|
|
|
29070
29070
|
/***/ }),
|
|
29071
29071
|
|
|
29072
|
-
/***/
|
|
29072
|
+
/***/ 920:
|
|
29073
29073
|
/***/ (function(module, exports, __webpack_require__) {
|
|
29074
29074
|
|
|
29075
|
-
__webpack_require__(
|
|
29075
|
+
__webpack_require__(921);
|
|
29076
29076
|
module.exports = 'ngAnimate';
|
|
29077
29077
|
|
|
29078
29078
|
|
|
29079
29079
|
/***/ }),
|
|
29080
29080
|
|
|
29081
|
-
/***/
|
|
29081
|
+
/***/ 921:
|
|
29082
29082
|
/***/ (function(module, exports) {
|
|
29083
29083
|
|
|
29084
29084
|
/**
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function convert12HourTo24Hour(hour: number, period: 'am' | 'pm'): number;
|
|
3
|
+
export declare function convert24HourTo12Hour(hour: number): number;
|
|
4
|
+
export declare function toInternalState(timeStr: string | undefined | null): IState;
|
|
5
|
+
interface IProps {
|
|
6
|
+
headerTemplate?: React.ReactNode;
|
|
7
|
+
footerTemplate?: React.ReactNode;
|
|
8
|
+
allowSeconds?: boolean;
|
|
9
|
+
onChange: (nextValue: string) => void;
|
|
10
|
+
value: string | null;
|
|
11
|
+
}
|
|
12
|
+
interface IState {
|
|
13
|
+
hours: string | null;
|
|
14
|
+
minutes: string | null;
|
|
15
|
+
seconds: string | null;
|
|
16
|
+
period: 'am' | 'pm' | null;
|
|
17
|
+
}
|
|
18
|
+
export declare class TimePickerPopover extends React.PureComponent<IProps, IState> {
|
|
19
|
+
private inputRefs;
|
|
20
|
+
constructor(props: IProps);
|
|
21
|
+
private handleChange;
|
|
22
|
+
scrollToValues(): void;
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentDidUpdate(prevProps: Readonly<IProps>): void;
|
|
25
|
+
render(): React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
35
|
+
}) : (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
o[k2] = m[k];
|
|
38
|
+
}));
|
|
39
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
40
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
41
|
+
}) : function(o, v) {
|
|
42
|
+
o["default"] = v;
|
|
43
|
+
});
|
|
44
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
+
var ownKeys = function(o) {
|
|
46
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
+
var ar = [];
|
|
48
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
+
return ar;
|
|
50
|
+
};
|
|
51
|
+
return ownKeys(o);
|
|
52
|
+
};
|
|
53
|
+
return function (mod) {
|
|
54
|
+
if (mod && mod.__esModule) return mod;
|
|
55
|
+
var result = {};
|
|
56
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
+
__setModuleDefault(result, mod);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.TimePickerPopover = void 0;
|
|
63
|
+
exports.convert12HourTo24Hour = convert12HourTo24Hour;
|
|
64
|
+
exports.convert24HourTo12Hour = convert24HourTo12Hour;
|
|
65
|
+
exports.toInternalState = toInternalState;
|
|
66
|
+
var React = __importStar(require("react"));
|
|
67
|
+
var common_1 = require("@sourcefabric/common");
|
|
68
|
+
var ContentDivider_1 = require("../ContentDivider");
|
|
69
|
+
var RadioButtonGroup_1 = require("../RadioButtonGroup");
|
|
70
|
+
var time_1 = require("../../utils/time");
|
|
71
|
+
var TimeValueHolder_1 = require("./TimeValueHolder");
|
|
72
|
+
function convert12HourTo24Hour(hour, period) {
|
|
73
|
+
if (period === 'am' && hour === 12) {
|
|
74
|
+
return 0; // midnight
|
|
75
|
+
}
|
|
76
|
+
if (period === 'pm' && hour !== 12) {
|
|
77
|
+
return hour + 12; // PM and not 12
|
|
78
|
+
}
|
|
79
|
+
return hour; // For 12PM, 1-11AM
|
|
80
|
+
}
|
|
81
|
+
function convert24HourTo12Hour(hour) {
|
|
82
|
+
var remainder = hour % 12;
|
|
83
|
+
return remainder === 0 ? 12 : remainder;
|
|
84
|
+
}
|
|
85
|
+
function isAm(hours) {
|
|
86
|
+
return hours < 12;
|
|
87
|
+
}
|
|
88
|
+
function toInternalState(timeStr) {
|
|
89
|
+
if (timeStr == null || (timeStr !== null && timeStr !== void 0 ? timeStr : '').trim().length < 1) {
|
|
90
|
+
return {
|
|
91
|
+
hours: null,
|
|
92
|
+
minutes: null,
|
|
93
|
+
seconds: null,
|
|
94
|
+
period: null,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
var _a = timeStr.split(':'), hours = _a[0], minutes = _a[1], seconds = _a[2];
|
|
98
|
+
var secondsDefault = hours != null && minutes != null ? '00' : null;
|
|
99
|
+
return {
|
|
100
|
+
hours: (function () {
|
|
101
|
+
if (hours == null) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
if (is12HourFormat) {
|
|
105
|
+
return convert24HourTo12Hour(parseInt(hours, 10)).toString().padStart(2, '0');
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return hours;
|
|
109
|
+
}
|
|
110
|
+
})(),
|
|
111
|
+
minutes: minutes !== null && minutes !== void 0 ? minutes : null,
|
|
112
|
+
seconds: seconds !== null && seconds !== void 0 ? seconds : secondsDefault,
|
|
113
|
+
period: hours == null ? null : isAm(parseInt(hours, 10)) ? 'am' : 'pm',
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
var is12HourFormat = (function () {
|
|
117
|
+
var hour = new Date().toLocaleTimeString([]);
|
|
118
|
+
return hour.includes('AM') || hour.includes('PM');
|
|
119
|
+
})();
|
|
120
|
+
var TimePickerPopover = /** @class */ (function (_super) {
|
|
121
|
+
__extends(TimePickerPopover, _super);
|
|
122
|
+
function TimePickerPopover(props) {
|
|
123
|
+
var _this = _super.call(this, props) || this;
|
|
124
|
+
_this.inputRefs = [React.createRef(), React.createRef(), React.createRef()];
|
|
125
|
+
_this.handleChange = _this.handleChange.bind(_this);
|
|
126
|
+
_this.scrollToValues = _this.scrollToValues.bind(_this);
|
|
127
|
+
_this.state = toInternalState(props.value);
|
|
128
|
+
return _this;
|
|
129
|
+
}
|
|
130
|
+
TimePickerPopover.prototype.handleChange = function (nextState) {
|
|
131
|
+
var _this = this;
|
|
132
|
+
this.setState(nextState, function () {
|
|
133
|
+
var timeParts = [];
|
|
134
|
+
if (_this.state.hours == null) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (is12HourFormat) {
|
|
138
|
+
if (_this.state.period == null) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
timeParts.push(convert12HourTo24Hour(parseInt(_this.state.hours, 10), _this.state.period)
|
|
142
|
+
.toString()
|
|
143
|
+
.padStart(2, '0'));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
timeParts.push(_this.state.hours);
|
|
147
|
+
}
|
|
148
|
+
if (_this.state.minutes == null) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
timeParts.push(_this.state.minutes);
|
|
153
|
+
}
|
|
154
|
+
if (_this.props.allowSeconds) {
|
|
155
|
+
if (_this.state.seconds == null) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
timeParts.push(_this.state.seconds);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
_this.props.onChange(timeParts.join(':'));
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
TimePickerPopover.prototype.scrollToValues = function () {
|
|
166
|
+
this.inputRefs.forEach(function (unitOfTime) { var _a, _b; return (_b = (_a = unitOfTime === null || unitOfTime === void 0 ? void 0 : unitOfTime.current) === null || _a === void 0 ? void 0 : _a.scrollToValue) === null || _b === void 0 ? void 0 : _b.call(_a); });
|
|
167
|
+
};
|
|
168
|
+
TimePickerPopover.prototype.componentDidMount = function () {
|
|
169
|
+
this.scrollToValues();
|
|
170
|
+
};
|
|
171
|
+
TimePickerPopover.prototype.componentDidUpdate = function (prevProps) {
|
|
172
|
+
var _this = this;
|
|
173
|
+
if (this.props.value !== prevProps.value) {
|
|
174
|
+
this.setState(toInternalState(this.props.value), function () {
|
|
175
|
+
_this.scrollToValues();
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
TimePickerPopover.prototype.render = function () {
|
|
180
|
+
var _this = this;
|
|
181
|
+
var styleForColumnOfUnit = {
|
|
182
|
+
maxHeight: 190,
|
|
183
|
+
overflowY: 'auto',
|
|
184
|
+
scrollbarWidth: 'thin',
|
|
185
|
+
marginTop: 'var(--gap-1)',
|
|
186
|
+
scrollBehavior: 'smooth',
|
|
187
|
+
};
|
|
188
|
+
return (React.createElement("div", { className: "sd-shadow--z2 radius-md" },
|
|
189
|
+
React.createElement(common_1.Spacer, { v: true, gap: "0", style: {
|
|
190
|
+
minWidth: 200,
|
|
191
|
+
maxWidth: 'max-content',
|
|
192
|
+
backgroundColor: 'var(--color-dropdown-menu-Bg)',
|
|
193
|
+
borderRadius: 'var(--b-radius--small)',
|
|
194
|
+
} },
|
|
195
|
+
this.props.headerTemplate && (React.createElement("div", { className: "px-1-5 py-1", style: { borderBottom: '1px solid var(--color-line-x-light)' } }, this.props.headerTemplate)),
|
|
196
|
+
React.createElement(common_1.Spacer, { h: true, gap: "4", noWrap: true, justifyContent: "center", alignItems: "start", style: { paddingInline: 'var(--gap-1)' } },
|
|
197
|
+
React.createElement(common_1.Spacer, { v: true, gap: "4", style: styleForColumnOfUnit, alignItems: "center", noWrap: true }, (0, time_1.getOptionsForTimeUnit)('hours', is12HourFormat).map(function (hour) {
|
|
198
|
+
var isActiveHour = hour === _this.state.hours;
|
|
199
|
+
return (React.createElement(TimeValueHolder_1.TimeValueHolder, { key: hour, ref: isActiveHour ? _this.inputRefs[0] : undefined, onClick: function () {
|
|
200
|
+
_this.handleChange(__assign(__assign({}, _this.state), { hours: hour }));
|
|
201
|
+
}, isActive: isActiveHour, value: hour }));
|
|
202
|
+
})),
|
|
203
|
+
React.createElement(ContentDivider_1.ContentDivider, { align: "center", border: true, type: "solid", orientation: "vertical", margin: "none" }),
|
|
204
|
+
React.createElement(common_1.Spacer, { v: true, gap: "4", style: styleForColumnOfUnit, alignItems: "center", noWrap: true }, (0, time_1.getOptionsForTimeUnit)('minutes', is12HourFormat).map(function (minute) {
|
|
205
|
+
var isActiveMinute = minute === _this.state.minutes;
|
|
206
|
+
return (React.createElement(TimeValueHolder_1.TimeValueHolder, { key: minute, ref: isActiveMinute ? _this.inputRefs[1] : undefined, isActive: isActiveMinute, value: minute, onClick: function () {
|
|
207
|
+
_this.handleChange(__assign(__assign({}, _this.state), { minutes: minute }));
|
|
208
|
+
} }));
|
|
209
|
+
})),
|
|
210
|
+
this.props.allowSeconds && (React.createElement(React.Fragment, null,
|
|
211
|
+
React.createElement(ContentDivider_1.ContentDivider, { align: "center", border: true, type: "solid", orientation: "vertical", margin: "none" }),
|
|
212
|
+
React.createElement(common_1.Spacer, { v: true, gap: "4", style: styleForColumnOfUnit, alignItems: "center", noWrap: true }, (0, time_1.getOptionsForTimeUnit)('seconds', is12HourFormat).map(function (second) {
|
|
213
|
+
var isActiveSecond = second === _this.state.seconds;
|
|
214
|
+
return (React.createElement(TimeValueHolder_1.TimeValueHolder, { key: second, ref: isActiveSecond ? _this.inputRefs[2] : undefined, onClick: function () {
|
|
215
|
+
_this.handleChange(__assign(__assign({}, _this.state), { seconds: second }));
|
|
216
|
+
}, isActive: isActiveSecond, value: second }));
|
|
217
|
+
})))),
|
|
218
|
+
is12HourFormat && (React.createElement("div", { style: {
|
|
219
|
+
marginTop: 'var(--gap-1)',
|
|
220
|
+
} },
|
|
221
|
+
React.createElement(RadioButtonGroup_1.RadioButtonGroup, { onChange: function (nextValue) {
|
|
222
|
+
_this.handleChange(__assign(__assign({}, _this.state), { period: nextValue }));
|
|
223
|
+
}, options: [
|
|
224
|
+
{ label: 'AM', value: 'am' },
|
|
225
|
+
{ label: 'PM', value: 'pm' },
|
|
226
|
+
], value: this.state.period == null ? '' : this.state.period })))),
|
|
227
|
+
this.props.footerTemplate && (React.createElement("div", { className: "px-1-5 py-1", style: { borderTop: '1px solid var(--color-line-x-light)' } }, this.props.footerTemplate)))));
|
|
228
|
+
};
|
|
229
|
+
return TimePickerPopover;
|
|
230
|
+
}(React.PureComponent));
|
|
231
|
+
exports.TimePickerPopover = TimePickerPopover;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface IProps {
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
value: string;
|
|
5
|
+
onClick(event: React.MouseEvent<HTMLSpanElement>): void;
|
|
6
|
+
}
|
|
7
|
+
export declare class TimeValueHolder extends React.PureComponent<IProps> {
|
|
8
|
+
private spanEl;
|
|
9
|
+
constructor(props: IProps);
|
|
10
|
+
scrollToValue(): void;
|
|
11
|
+
render(): JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.TimeValueHolder = void 0;
|
|
52
|
+
var React = __importStar(require("react"));
|
|
53
|
+
var common_1 = require("@sourcefabric/common");
|
|
54
|
+
var TimeValueHolder = /** @class */ (function (_super) {
|
|
55
|
+
__extends(TimeValueHolder, _super);
|
|
56
|
+
function TimeValueHolder(props) {
|
|
57
|
+
var _this = _super.call(this, props) || this;
|
|
58
|
+
_this.spanEl = React.createRef();
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
TimeValueHolder.prototype.scrollToValue = function () {
|
|
62
|
+
var _a;
|
|
63
|
+
(_a = this.spanEl.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'start', behavior: 'smooth' });
|
|
64
|
+
};
|
|
65
|
+
TimeValueHolder.prototype.render = function () {
|
|
66
|
+
var _a;
|
|
67
|
+
return (React.createElement("span", { ref: this.props.isActive ? this.spanEl : undefined, onClick: this.props.onClick, className: (0, common_1.classnames)('p-1 time-unit', {
|
|
68
|
+
'time-unit-highlight': (_a = this.props.isActive) !== null && _a !== void 0 ? _a : false,
|
|
69
|
+
}) }, this.props.value));
|
|
70
|
+
};
|
|
71
|
+
return TimeValueHolder;
|
|
72
|
+
}(React.PureComponent));
|
|
73
|
+
exports.TimeValueHolder = TimeValueHolder;
|
|
@@ -55,11 +55,11 @@ exports.TimePicker = void 0;
|
|
|
55
55
|
var React = __importStar(require("react"));
|
|
56
56
|
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
|
57
57
|
var classnames_1 = __importDefault(require("classnames"));
|
|
58
|
-
var Form_1 = require("
|
|
58
|
+
var Form_1 = require("../Form");
|
|
59
59
|
var TimePickerPopover_1 = require("./TimePickerPopover");
|
|
60
|
-
var ShowPopup_1 = require("
|
|
61
|
-
var Icon_1 = require("
|
|
62
|
-
var IconButton_1 = require("
|
|
60
|
+
var ShowPopup_1 = require("../ShowPopup");
|
|
61
|
+
var Icon_1 = require("../Icon");
|
|
62
|
+
var IconButton_1 = require("../IconButton");
|
|
63
63
|
var TimePicker = /** @class */ (function (_super) {
|
|
64
64
|
__extends(TimePicker, _super);
|
|
65
65
|
function TimePicker(props) {
|
|
@@ -108,15 +108,11 @@ var TimePicker = /** @class */ (function (_super) {
|
|
|
108
108
|
React.createElement("div", { className: "time-picker__input" },
|
|
109
109
|
React.createElement("input", { style: {
|
|
110
110
|
cursor: 'pointer',
|
|
111
|
-
}, ref: this.timeInputRef, value: (_b = this.props.value) !== null && _b !== void 0 ? _b : '', type: "time", onClick: function (
|
|
112
|
-
// don't show default popup
|
|
113
|
-
e.preventDefault();
|
|
111
|
+
}, ref: this.timeInputRef, value: (_b = this.props.value) !== null && _b !== void 0 ? _b : '', type: "time", onClick: function () {
|
|
114
112
|
_this.setState({
|
|
115
113
|
popupOpen: !_this.state.popupOpen,
|
|
116
114
|
});
|
|
117
115
|
}, onKeyDown: function (event) {
|
|
118
|
-
// don't show default popup
|
|
119
|
-
event.preventDefault();
|
|
120
116
|
if (event.key === ' ') {
|
|
121
117
|
_this.setState({
|
|
122
118
|
popupOpen: !_this.state.popupOpen,
|