UNPKG

chowa

Version:

UI component library based on React

43 lines (42 loc) 2.79 kB
/** * @license chowa v1.1.3 * * Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn). * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const moment = require("moment"); const i18n_1 = require("../../i18n"); const utils_1 = require("../../utils"); const calendar_mode_1 = require("../calendar-mode"); const button_1 = require("../../button"); const MinCalendarFooter = (props) => { const { switchable, defaultMode, mode, updateMode, updateDate, updateTime, onClear, onConfirm, disabled, updateable, clearable, determinable } = props; if (!switchable && !updateable && !determinable && !clearable) { return null; } return (React.createElement("div", { className: utils_1.preClass('min-calendar-footer') }, React.createElement("div", { className: utils_1.preClass('min-calendar-footer-left') }, switchable && defaultMode === calendar_mode_1.DAY_MODE && React.createElement(button_1.default, { size: 'small', onClick: updateMode.bind(this, mode === calendar_mode_1.DAY_MODE ? calendar_mode_1.TIME_MODE : calendar_mode_1.DAY_MODE), text: true, tabIndex: -1 }, mode === calendar_mode_1.TIME_MODE ? React.createElement(i18n_1.I18nReceiver, { module: 'Calendar' }, (i18n) => i18n.date) : React.createElement(i18n_1.I18nReceiver, { module: 'Calendar' }, (i18n) => i18n.time)), updateable && React.createElement(button_1.default, { size: 'small', onClick: mode === calendar_mode_1.TIME_MODE ? updateTime.bind(this, moment()) : updateDate.bind(this, moment()), text: true, tabIndex: -1 }, mode === calendar_mode_1.TIME_MODE ? React.createElement(i18n_1.I18nReceiver, { module: 'Calendar' }, (i18n) => i18n.now) : React.createElement(i18n_1.I18nReceiver, { module: 'Calendar' }, (i18n) => i18n.today))), React.createElement("div", { className: utils_1.preClass('min-calendar-footer-right') }, clearable && React.createElement(button_1.default, { size: 'small', disabled: disabled, onClick: onClear, tabIndex: -1 }, React.createElement(i18n_1.I18nReceiver, { module: 'Common' }, (i18n) => i18n.clear)), determinable && React.createElement(button_1.default, { size: 'small', type: 'primary', disabled: disabled, onClick: onConfirm, tabIndex: -1 }, React.createElement(i18n_1.I18nReceiver, { module: 'Common' }, (i18n) => i18n.confirm))))); }; exports.default = MinCalendarFooter;