@try-at-software/input-elements
Version:
A package providing different input elements that are extensible and easily configurable for your custom needs.
36 lines (35 loc) • 2.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimePicker = void 0;
const react_1 = require("@fluentui/react");
const React = require("react");
const Components_1 = require("../../Components");
const Utilities_1 = require("../../Utilities");
require("./TimePicker.less");
class TimePicker extends React.Component {
constructor() {
super(...arguments);
this.onChange = (newValue) => {
var _a;
(_a = this.props) === null || _a === void 0 ? void 0 : _a.onChange(newValue);
};
this.clearDate = () => {
this.onChange(null);
};
}
render() {
if (!this.props)
return null;
const { dynamicProps, operativeProps } = this.props;
const clearButtonClassName = Utilities_1.combineClasses('q-clear-button', operativeProps.clearButtonClassName);
return (React.createElement(React.Fragment, null,
React.createElement(Components_1.LabelRenderer, { label: this.props.label, required: !!this.props.renderRequiredIndicator }),
React.createElement(react_1.DatePicker, { "data-automationid": "time-input", placeholder: operativeProps.placeholder, onSelectDate: this.onChange, textField: {
onRenderSuffix: () => React.createElement(Components_1.ClearButton, { onClick: this.clearDate, className: clearButtonClassName }),
inputClassName: operativeProps.inputClassName,
errorMessage: Components_1.materializeErrorMessage(this.props.errorMessage),
disabled: dynamicProps.isDisabled
}, showGoToToday: !!operativeProps.showGoToToday, formatDate: operativeProps.formatDate, firstDayOfWeek: !!operativeProps.startWeekOnSunday ? react_1.DayOfWeek.Sunday : react_1.DayOfWeek.Monday, isMonthPickerVisible: !!operativeProps.showMonthPicker, highlightSelectedMonth: !!operativeProps.showMonthPicker, value: this.props.value })));
}
}
exports.TimePicker = TimePicker;