@titaui/pc 1.11.27-beta.8 → 1.11.29
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/components/avatar/name-avatar/index.css +0 -1
- package/lib/components/avatar/name-avatar/index.js +13 -22
- package/lib/components/avatar/text-avatar/index.css +7 -0
- package/lib/components/avatar/text-avatar/index.js +32 -7
- package/lib/components/button/icon-btn/index.js +17 -8
- package/lib/components/button/rect-btn/index.css +11 -45
- package/lib/components/button/rect-btn/index.js +13 -19
- package/lib/components/change-okr-modal/Item.js +14 -14
- package/lib/components/change-okr-modal/index.js +1 -2
- package/lib/components/create-okr-modal/index.js +1 -3
- package/lib/components/create-okr-modal/request-api.js +1 -1
- package/lib/components/dialog-confirm/index.css +2 -2
- package/lib/components/drawer/headerAction.js +1 -5
- package/lib/components/drawer/headerDrop.js +4 -42
- package/lib/components/drawer/index.css +0 -33
- package/lib/components/drawer/index.js +3 -26
- package/lib/components/drop-selector/index.js +25 -10
- package/lib/components/dynamic/advertise/components/next-btn/index.css +27 -0
- package/lib/components/dynamic/advertise/components/next-btn/index.js +32 -0
- package/lib/components/dynamic/advertise/components/pre-btn/index.css +26 -0
- package/lib/components/dynamic/advertise/components/pre-btn/index.js +32 -0
- package/lib/components/dynamic/advertise/index.css +21 -0
- package/lib/components/dynamic/advertise/index.js +126 -0
- package/lib/components/dynamic/advertise/interface.js +5 -0
- package/lib/components/dynamic/advertise/util.js +28 -0
- package/lib/components/dynamic/components/dynamic-search-input/index.css +81 -0
- package/lib/components/dynamic/components/dynamic-search-input/index.js +203 -0
- package/lib/components/dynamic/components/first-level-tabs/index.css +101 -0
- package/lib/components/dynamic/components/first-level-tabs/index.js +131 -0
- package/lib/components/dynamic/constant.js +33 -32
- package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/dynamic-footer.js +9 -9
- package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-interview/img/wifi.svg +24 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/index.css +51 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/index.js +50 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview/interview-content.js +65 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/img/wifi.svg +24 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.css +61 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.js +61 -0
- package/lib/components/dynamic/dynamic-item/dynamic-interview-share/interview-content.js +69 -0
- package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +5 -5
- package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.js +6 -6
- package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +10 -10
- package/lib/components/dynamic/dynamic-item/dynamic-reply/index.js +13 -13
- package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +9 -9
- package/lib/components/dynamic/dynamic-item/index.js +50 -32
- package/lib/components/dynamic/dynamic-like-ranking/image/like-ranking.svg +23 -0
- package/lib/components/dynamic/dynamic-like-ranking/image/ranking-1.png +0 -0
- package/lib/components/dynamic/dynamic-like-ranking/image/ranking-2.png +0 -0
- package/lib/components/dynamic/dynamic-like-ranking/image/ranking-3.png +0 -0
- package/lib/components/dynamic/dynamic-like-ranking/image/ranking-empty.png +0 -0
- package/lib/components/dynamic/dynamic-like-ranking/index.css +146 -0
- package/lib/components/dynamic/dynamic-like-ranking/index.js +180 -0
- package/lib/components/dynamic/dynamic-like-ranking/item.js +105 -0
- package/lib/components/dynamic/dynamic-like-ranking/mock.js +84 -0
- package/lib/components/dynamic/dynamic-liking/image/like-dynamic.svg +30 -0
- package/lib/components/dynamic/dynamic-liking/index.css +81 -0
- package/lib/{pages/new-okr-list/header/operate-record.js → components/dynamic/dynamic-liking/index.js} +39 -91
- package/lib/components/dynamic/dynamic-liking/item.js +75 -0
- package/lib/components/dynamic/dynamic-liking/mock.js +83 -0
- package/lib/components/dynamic/dynamic-list/index.js +7 -15
- package/lib/components/dynamic/dynamic-topping/image/quotation-mark.svg +16 -0
- package/lib/components/dynamic/dynamic-topping/image/top-icon.svg +30 -0
- package/lib/components/dynamic/dynamic-topping/index.css +141 -0
- package/lib/components/dynamic/dynamic-topping/index.js +82 -0
- package/lib/components/dynamic/dynamic-topping/interface.js +5 -0
- package/lib/components/dynamic/dynamic-topping/item.js +153 -0
- package/lib/components/dynamic/dynamic-topping/request-api.js +36 -0
- package/lib/components/dynamic/dynamic.css +173 -0
- package/lib/components/dynamic/dynamic.js +428 -0
- package/lib/components/dynamic/export-module/index.js +37 -0
- package/lib/components/dynamic/img/dynamic-top.svg +14 -0
- package/lib/components/dynamic/index.js +12 -9
- package/lib/components/dynamic/my-team/img/add-subordinate.png +0 -0
- package/lib/components/dynamic/my-team/img/line.png +0 -0
- package/lib/components/dynamic/my-team/img/team.png +0 -0
- package/lib/components/dynamic/my-team/index.css +184 -0
- package/lib/components/dynamic/my-team/index.js +263 -0
- package/lib/components/dynamic/my-team/request-api.js +52 -0
- package/lib/components/dynamic/my-team/util.js +20 -0
- package/lib/components/dynamic/new-ui.css +192 -0
- package/lib/components/dynamic/online-broadcast/components/broadcast-item/index.css +58 -0
- package/lib/components/dynamic/online-broadcast/components/broadcast-item/index.js +68 -0
- package/lib/components/dynamic/online-broadcast/data.js +77 -0
- package/lib/components/dynamic/online-broadcast/img/broadcast.svg +14 -0
- package/lib/components/dynamic/online-broadcast/img/new.png +0 -0
- package/lib/components/dynamic/online-broadcast/img/preview.png +0 -0
- package/lib/components/dynamic/online-broadcast/index.css +46 -0
- package/lib/components/dynamic/online-broadcast/index.js +61 -0
- package/lib/components/dynamic/online-broadcast/interfact.js +5 -0
- package/lib/components/dynamic/quick-operation/components/create-announcement/index.css +25 -0
- package/lib/components/dynamic/quick-operation/components/create-announcement/index.js +39 -0
- package/lib/components/dynamic/quick-operation/components/create-okr/index.css +25 -0
- package/lib/components/dynamic/quick-operation/components/create-okr/index.js +39 -0
- package/lib/components/dynamic/quick-operation/components/create-share/index.css +25 -0
- package/lib/components/dynamic/quick-operation/components/create-share/index.js +39 -0
- package/lib/components/dynamic/quick-operation/components/create-task/index.css +25 -0
- package/lib/components/dynamic/quick-operation/components/create-task/index.js +44 -0
- package/lib/components/dynamic/quick-operation/img/new-announcement.png +0 -0
- package/lib/components/dynamic/quick-operation/img/new-okr.png +0 -0
- package/lib/components/dynamic/quick-operation/img/new-share.png +0 -0
- package/lib/components/dynamic/quick-operation/img/new-task.png +0 -0
- package/lib/components/dynamic/quick-operation/index.css +51 -0
- package/lib/components/dynamic/quick-operation/index.js +120 -0
- package/lib/components/dynamic/request-api.js +68 -7
- package/lib/components/e-priority/index.js +8 -8
- package/lib/components/eReport/eReportShare/index.js +11 -11
- package/lib/components/form/form-fields/date/index.css +24 -0
- package/lib/components/form/form-fields/date/index.js +102 -0
- package/lib/components/form/form-fields/input/index.js +10 -10
- package/lib/components/form/form-fields/user/index.css +23 -3
- package/lib/components/form/form-fields/user/index.js +18 -8
- package/lib/components/form/form-fields/user/user-input.js +15 -6
- package/lib/components/form/index.js +10 -3
- package/lib/components/grid-layout/sub-employee-okr/person-okr.js +5 -5
- package/lib/components/icon-button-list/index.js +3 -3
- package/lib/components/img-viewer/index.css +3 -3
- package/lib/components/img-viewer/index.js +11 -11
- package/lib/components/menus/components/menu-tree/images/interview-menu/my-interview.svg +16 -0
- package/lib/components/menus/components/menu-tree/images/interview-menu/template.svg +16 -0
- package/lib/components/menus/components/menu-tree/images/interview-menu/todo.svg +16 -0
- package/lib/components/menus/components/menu-tree/index.css +4 -2
- package/lib/components/menus/components/menu-tree/tree-node/index.css +85 -1
- package/lib/components/menus/export-modules/interview-menus/constant.js +30 -0
- package/lib/components/menus/export-modules/interview-menus/handle-highlight.js +63 -0
- package/lib/components/menus/export-modules/interview-menus/index.css +7 -0
- package/lib/components/menus/export-modules/interview-menus/index.js +128 -0
- package/lib/components/menus/index.js +11 -5
- package/lib/components/nav-top/components/menu/index.js +14 -14
- package/lib/components/nav-top/components/user-message/components/inform/inform-item.js +25 -19
- package/lib/components/nav-top/components/user-message/components/remind/remind-item.js +48 -10
- package/lib/components/nav-top/components/user-message/constant.js +1 -0
- package/lib/components/nav-top/components/user-message/hrMessage.js +22 -19
- package/lib/components/nav-top/components/user-message/index.js +23 -20
- package/lib/components/nav-top/index.js +4 -8
- package/lib/components/nav-top/request.apis.js +3 -1
- package/lib/components/okr-detail/base-info/other-infos/date-cycle/index.js +4 -20
- package/lib/components/okr-detail/base-info/other-infos/principal/index.js +1 -9
- package/lib/components/okr-detail/components/header/index.js +3 -10
- package/lib/components/okr-detail/components/header/o-name.js +3 -10
- package/lib/components/okr-detail/components/o-classify.js +1 -5
- package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-priority-dropdown.js +7 -7
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +10 -14
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/range-picker-pop.js +10 -0
- package/lib/components/okr-detail/detail-header/actions.js +23 -23
- package/lib/components/okr-detail/detail-header/delete-confirm/delete-confirm.js +43 -98
- package/lib/components/okr-detail/detail-header/delete-confirm/style.js +38 -0
- package/lib/components/okr-detail/detail-header/index.css +0 -11
- package/lib/components/okr-detail/detail-header/index.js +234 -228
- package/lib/components/okr-detail/index.js +21 -40
- package/lib/components/okr-detail/okr-list/index.js +8 -11
- package/lib/components/okr-detail/request-apis.js +4 -10
- package/lib/components/okr-flow/child-node/index.css +6 -6
- package/lib/components/okr-flow/child-node/work-node.js +21 -21
- package/lib/components/okr-flow/export-modal/index.js +33 -19
- package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +14 -14
- package/lib/components/okr-flow/okr-map/index.js +5 -5
- package/lib/components/okr-flow/request-apis.js +4 -4
- package/lib/components/okr-flow/root-node/index.js +25 -24
- package/lib/components/okr-flow/utils/index.js +5 -5
- package/lib/components/okr-flow/utils/tree-handler.js +17 -17
- package/lib/components/okr-period-selector/index.js +5 -9
- package/lib/components/okr-period-selector/select-cycle.js +19 -23
- package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +30 -30
- package/lib/components/operation-records/index.js +1 -1
- package/lib/components/operation-records/style.js +1 -1
- package/lib/components/pagination/index.css +3 -3
- package/lib/components/pagination/select.css +58 -23
- package/lib/components/period-selector/index.css +3 -3
- package/lib/components/period-selector/index.js +11 -11
- package/lib/components/picker/components/panels/date-panel/date-body.js +118 -0
- package/lib/components/picker/components/panels/date-panel/date-head.js +87 -0
- package/lib/components/picker/components/panels/date-panel/index.css +14 -0
- package/lib/components/picker/components/panels/date-panel/index.js +49 -0
- package/lib/components/picker/components/panels/month-panel/index.css +27 -0
- package/lib/components/picker/components/panels/month-panel/index.js +63 -0
- package/lib/components/picker/components/panels/month-panel/month-body.js +89 -0
- package/lib/components/picker/components/panels/month-panel/month-head.js +47 -0
- package/lib/components/picker/components/panels/panel-body/index.js +53 -0
- package/lib/components/picker/components/panels/panel-head/index.js +48 -0
- package/lib/components/picker/components/panels/year-panel/index.css +23 -0
- package/lib/components/picker/components/panels/year-panel/index.js +65 -0
- package/lib/components/picker/components/panels/year-panel/year-body.js +92 -0
- package/lib/components/picker/components/panels/year-panel/year-head.js +35 -0
- package/lib/components/picker/components/picker-trigger/index.css +57 -0
- package/lib/components/picker/components/picker-trigger/index.js +94 -0
- package/lib/components/picker/context.js +15 -0
- package/lib/components/picker/index.css +121 -0
- package/lib/components/picker/index.js +13 -0
- package/lib/components/picker/picker-panels.js +182 -0
- package/lib/components/picker/picker.js +132 -0
- package/lib/components/picker/type.js +5 -0
- package/lib/components/picker/utils.js +28 -0
- package/lib/components/popup/index.js +4 -4
- package/lib/components/publish-dynamic-modal/publish-dynamic-modal.js +10 -16
- package/lib/components/radio/index.css +9 -9
- package/lib/components/scrollbar/scroll-mask/index.js +1 -1
- package/lib/components/superset-charts/utils/axios.js +5 -5
- package/lib/components/survey-model/index.css +18 -18
- package/lib/components/survey-model/instance.js +1 -1
- package/lib/components/task-relation-modal/request-api.js +1 -2
- package/lib/components/task-tree/helper.js +61 -0
- package/lib/components/task-tree/images/P1.svg +15 -0
- package/lib/components/task-tree/images/P2.svg +15 -0
- package/lib/components/task-tree/images/P3.svg +15 -0
- package/lib/components/task-tree/images/P4.svg +15 -0
- package/lib/components/task-tree/images/P5.svg +15 -0
- package/lib/components/task-tree/images/arrow.svg +9 -0
- package/lib/components/task-tree/images/empty-131.png +0 -0
- package/lib/components/task-tree/images/followed.svg +33 -0
- package/lib/components/task-tree/images/nice.svg +108 -0
- package/lib/components/task-tree/images/struc12.png +0 -0
- package/lib/components/task-tree/images/struc2.png +0 -0
- package/lib/components/task-tree/images/xialat-s.svg +13 -0
- package/lib/components/task-tree/index.js +22 -0
- package/lib/components/task-tree/mock.js +944 -0
- package/lib/components/task-tree/precls.js +8 -0
- package/lib/components/task-tree/request-apis.js +88 -0
- package/lib/components/task-tree/task-item-node/constant.js +45 -0
- package/lib/components/task-tree/task-item-node/e-empty.js +29 -0
- package/lib/components/task-tree/task-item-node/e-project.js +212 -0
- package/lib/components/task-tree/task-item-node/e-status-dropdown.js +94 -0
- package/lib/components/task-tree/task-item-node/e-task.js +426 -0
- package/lib/components/task-tree/task-item-node/get-process-color.js +62 -0
- package/lib/components/task-tree/task-item-node/index.css +289 -0
- package/lib/components/task-tree/task-item-node/task-node-render.js +43 -0
- package/lib/components/task-tree/task-tree.css +16 -0
- package/lib/components/task-tree/task-tree.js +49 -0
- package/lib/components/time-picker/index.css +123 -0
- package/lib/components/time-picker/index.js +13 -0
- package/lib/components/time-picker/time-picker-selector.js +138 -0
- package/lib/components/time-picker/time-picker.js +336 -0
- package/lib/components/time-picker/timer-picker-input.js +96 -0
- package/lib/components/time-picker/utils.js +52 -0
- package/lib/components/toast/index.js +3 -5
- package/lib/components/user-selector/select-tree/tree-nodes/tree-person-node/index.css +1 -0
- package/lib/components-v1/radio/radio.js +3 -3
- package/lib/components-v1/radio/style/index.css +8 -8
- package/lib/index.js +0 -40
- package/lib/pages/aha2021/index.js +5 -1
- package/lib/pages/new-okr-list/header/index.css +0 -45
- package/lib/pages/new-okr-list/header/index.js +16 -38
- package/lib/pages/new-okr-list/index.js +1 -3
- package/lib/pages/new-okr-list/list/index.js +2 -19
- package/lib/pages/new-okr-list/request-api.js +2 -8
- package/lib/pages/okr-map/export-modules/okr-map/header/index.js +24 -24
- package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +31 -31
- package/lib/pages/okr-map/export-modules/share-okr-page/header/index.css +2 -2
- package/lib/pages/okr-map/export-modules/share-okr-page/header/index.js +11 -11
- package/lib/pages/okr-map/export-modules/share-okr-page/share-okr-map.js +8 -8
- package/lib/pages/okr-map/number-select/index.js +2 -2
- package/lib/pages/okr-map/unsupport-ie/index.js +5 -3
- package/lib/utils/auth.js +6 -6
- package/lib/utils/bs-global.js +12 -12
- package/lib/utils/format-time.js +1 -8
- package/lib/utils/hooks.js +72 -0
- package/lib/utils/open-data.js +27 -31
- package/package.json +6 -3
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -223
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -31
- package/.prettierrc.js +0 -90
- package/.vscode/settings.json +0 -5
- package/lib/components/okr-detail/detail-header/constant.js +0 -53
- package/lib/components/okr-detail/detail-header/delete-confirm/index.css +0 -55
- package/lib/components/okr-detail/helper.js +0 -108
- package/lib/components/textarea/index.css +0 -142
- package/lib/components/textarea/index.js +0 -259
- package/lib/pages/new-okr-list/header/common.js +0 -52
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
15
|
+
|
|
16
|
+
var _utils = require("../../../utils");
|
|
17
|
+
|
|
18
|
+
var _context = _interopRequireDefault(require("../../../context"));
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
|
|
28
|
+
var YEAR_ROW_NUM = 4;
|
|
29
|
+
var YEAR_COL_NUM = 3;
|
|
30
|
+
|
|
31
|
+
var YearPanelBody = function YearPanelBody(props) {
|
|
32
|
+
var _props$viewDate = props.viewDate,
|
|
33
|
+
viewDate = _props$viewDate === void 0 ? (0, _moment["default"])() : _props$viewDate,
|
|
34
|
+
onSelect = props.onSelect,
|
|
35
|
+
startYear = props.startYear,
|
|
36
|
+
endYear = props.endYear;
|
|
37
|
+
|
|
38
|
+
var _useContext = (0, _react.useContext)(_context["default"]),
|
|
39
|
+
value = _useContext.value,
|
|
40
|
+
mode = _useContext.mode;
|
|
41
|
+
|
|
42
|
+
var getCells = function getCells(baseYear) {
|
|
43
|
+
var cols = [];
|
|
44
|
+
|
|
45
|
+
var _loop = function _loop(col) {
|
|
46
|
+
var _classNames;
|
|
47
|
+
|
|
48
|
+
var year = baseYear + col;
|
|
49
|
+
cols.push( /*#__PURE__*/_react["default"].createElement("td", {
|
|
50
|
+
className: (0, _classnames["default"])(_utils.PickerCellClass, (_classNames = {}, _defineProperty(_classNames, "".concat(_utils.PickerCellClass, "--this-year"), year === (0, _moment["default"])().year()), _defineProperty(_classNames, "".concat(_utils.PickerCellClass, "--in-view"), year >= startYear && year <= endYear), _defineProperty(_classNames, "".concat(_utils.PickerCellClass, "--selected"), year === (0, _moment["default"])(value).year() && mode === "year"), _classNames)),
|
|
51
|
+
key: year
|
|
52
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
53
|
+
className: (0, _classnames["default"])("".concat(_utils.PickerCellClass, "__inner")),
|
|
54
|
+
title: year,
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
if (onSelect) {
|
|
57
|
+
onSelect((0, _moment["default"])(viewDate).year(year), "year");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, year)));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
for (var col = 0; col < YEAR_COL_NUM; col += 1) {
|
|
64
|
+
_loop(col);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return cols;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var getRows = function getRows() {
|
|
71
|
+
var baseYear = startYear - (YEAR_COL_NUM * YEAR_ROW_NUM - _utils.YEAR_DECADE_COUNT) / 2;
|
|
72
|
+
var rows = [];
|
|
73
|
+
|
|
74
|
+
for (var row = 0; row < YEAR_ROW_NUM; row += 1) {
|
|
75
|
+
rows.push( /*#__PURE__*/_react["default"].createElement("tr", {
|
|
76
|
+
key: row
|
|
77
|
+
}, getCells(baseYear)));
|
|
78
|
+
baseYear += YEAR_COL_NUM;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return rows;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
85
|
+
className: (0, _classnames["default"])(_utils.PickerBodyClass)
|
|
86
|
+
}, /*#__PURE__*/_react["default"].createElement("table", {
|
|
87
|
+
className: (0, _classnames["default"])("".concat(_utils.PickerClass, "-content"))
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement("tbody", null, getRows())));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
var _default = YearPanelBody;
|
|
92
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
|
|
12
|
+
var _utils = require("../../../utils");
|
|
13
|
+
|
|
14
|
+
var _panelHead = _interopRequireDefault(require("../panel-head"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
var YearPanelHead = function YearPanelHead(props) {
|
|
21
|
+
var onPrevDecadeYear = props.onPrevDecadeYear,
|
|
22
|
+
onNextDecadeYear = props.onNextDecadeYear,
|
|
23
|
+
startYear = props.startYear,
|
|
24
|
+
endYear = props.endYear;
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(_panelHead["default"], _extends({}, props, {
|
|
26
|
+
onPrev: onPrevDecadeYear,
|
|
27
|
+
onNext: onNextDecadeYear
|
|
28
|
+
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
29
|
+
className: (0, _classnames["default"])("".concat(_utils.PickerHeadClass, "-btn__year"), "".concat(_utils.PickerHeadClass, "-btn--readonly")),
|
|
30
|
+
type: "button"
|
|
31
|
+
}, "".concat(startYear, " - ").concat(endYear)));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var _default = YearPanelHead;
|
|
35
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.tita-ui__picker-trigger {
|
|
2
|
+
width: 120px;
|
|
3
|
+
max-width: 254px;
|
|
4
|
+
height: 32px;
|
|
5
|
+
padding: 7px 12px;
|
|
6
|
+
border: 1px solid #e9ecf0;
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
transition: all 0.3s ease;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tita-ui__picker-trigger:hover {
|
|
16
|
+
border-color: #2879ff;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.tita-ui__picker-trigger__input {
|
|
20
|
+
flex: 1;
|
|
21
|
+
margin-right: 12px;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
line-height: 18px;
|
|
24
|
+
font-weight: normal;
|
|
25
|
+
color: #3f4755;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tita-ui__picker-trigger__input--placeholder {
|
|
29
|
+
color: #bfc7d5;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tita-ui__picker-trigger__operation {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.tita-ui__picker-trigger__operation .tu-icon-caret-down {
|
|
38
|
+
font-size: 16px;
|
|
39
|
+
color: #3f4755;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.tita-ui__picker-trigger__operation .tu-icon-caret-down::before {
|
|
43
|
+
transform: scale(0.5);
|
|
44
|
+
display: inline-block;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.tita-ui__picker-trigger--disabled {
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.tita-ui__picker-trigger--disabled:hover {
|
|
52
|
+
border-color: #e9ecf0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tita-ui__picker-trigger--disabled .tita-ui__picker-trigger__input {
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
|
|
16
|
+
var _context = _interopRequireDefault(require("../../context"));
|
|
17
|
+
|
|
18
|
+
require("./index.css");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
|
|
28
|
+
var PickerTrigger = function PickerTrigger(props) {
|
|
29
|
+
var children = props.children,
|
|
30
|
+
viewDate = props.viewDate,
|
|
31
|
+
_props$disabled = props.disabled,
|
|
32
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
33
|
+
_props$allowClear = props.allowClear,
|
|
34
|
+
allowClear = _props$allowClear === void 0 ? false : _props$allowClear,
|
|
35
|
+
placeholder = props.placeholder,
|
|
36
|
+
_onClick = props.onClick;
|
|
37
|
+
|
|
38
|
+
var _useContext = (0, _react.useContext)(_context["default"]),
|
|
39
|
+
mode = _useContext.mode,
|
|
40
|
+
format = _useContext.format,
|
|
41
|
+
value = _useContext.value;
|
|
42
|
+
|
|
43
|
+
var currFormat = format;
|
|
44
|
+
|
|
45
|
+
switch (mode) {
|
|
46
|
+
case 'date':
|
|
47
|
+
currFormat = 'YYYY/MM/DD';
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 'month':
|
|
51
|
+
currFormat = 'YYYY/MM';
|
|
52
|
+
break;
|
|
53
|
+
|
|
54
|
+
case 'year':
|
|
55
|
+
currFormat = 'YYYY';
|
|
56
|
+
break;
|
|
57
|
+
|
|
58
|
+
default:
|
|
59
|
+
currFormat = format;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
/*#__PURE__*/
|
|
65
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
66
|
+
_react["default"].createElement(_react["default"].Fragment, null, children ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
67
|
+
onClick: function onClick() {
|
|
68
|
+
return !disabled && _onClick();
|
|
69
|
+
}
|
|
70
|
+
}, children) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
71
|
+
className: (0, _classnames["default"])(_utils.PickerTriggerClass, _defineProperty({}, "".concat(_utils.PickerTriggerClass, "--disabled"), disabled)),
|
|
72
|
+
onClick: function onClick() {
|
|
73
|
+
return !disabled && _onClick();
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
76
|
+
className: (0, _classnames["default"])("".concat(_utils.PickerTriggerClass, "__input"), _defineProperty({}, "".concat(_utils.PickerTriggerClass, "__input--placeholder"), !value && placeholder))
|
|
77
|
+
}, value ? viewDate.format(currFormat) : placeholder), /*#__PURE__*/_react["default"].createElement("div", {
|
|
78
|
+
className: (0, _classnames["default"])("".concat(_utils.PickerTriggerClass, "__operation"))
|
|
79
|
+
}, !disabled && /*#__PURE__*/_react["default"].createElement("span", {
|
|
80
|
+
className: "tu-icon-caret-down"
|
|
81
|
+
}), allowClear && !disabled && /*#__PURE__*/_react["default"].createElement("span", {
|
|
82
|
+
className: "tu-icon-circle"
|
|
83
|
+
}))))
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
PickerTrigger.defaultProps = {
|
|
88
|
+
children: null,
|
|
89
|
+
disabled: false,
|
|
90
|
+
allowClear: false,
|
|
91
|
+
placeholder: '请选择'
|
|
92
|
+
};
|
|
93
|
+
var _default = PickerTrigger;
|
|
94
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var PickerContext = /*#__PURE__*/_react["default"].createContext({});
|
|
13
|
+
|
|
14
|
+
var _default = PickerContext;
|
|
15
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
.tita-ui__picker {
|
|
2
|
+
width: 276px;
|
|
3
|
+
max-height: 282px;
|
|
4
|
+
padding: 15px 18px 16px;
|
|
5
|
+
border-radius: 16px;
|
|
6
|
+
box-shadow: 0px 8px 24px 0px rgba(127, 145, 180, 0.16);
|
|
7
|
+
background-color: #ffffff;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.tita-ui__picker-unit {
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
color: #141c28;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tita-ui__picker-cell {
|
|
18
|
+
width: 24px;
|
|
19
|
+
height: 24px;
|
|
20
|
+
padding: 4px 6px;
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
line-height: 18px;
|
|
23
|
+
color: #6f7886;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.tita-ui__picker-cell--in-view .tita-ui__picker-cell__inner {
|
|
27
|
+
color: #141c28;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.tita-ui__picker-cell--tody .tita-ui__picker-cell__inner, .tita-ui__picker-cell:hover .tita-ui__picker-cell__inner {
|
|
31
|
+
background-color: #f0f4fa;
|
|
32
|
+
color: #2879ff;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.tita-ui__picker-cell--selected .tita-ui__picker-cell__inner {
|
|
36
|
+
background-color: #2879ff;
|
|
37
|
+
color: #ffffff;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tita-ui__picker-cell__inner {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
line-height: 18px;
|
|
45
|
+
border-radius: 8px;
|
|
46
|
+
transition: all 0.3s ease;
|
|
47
|
+
color: #a4acb9;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
white-space: nowrap;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tita-ui__picker-content thead th:first-child,
|
|
56
|
+
.tita-ui__picker-content tbody tr:first-child,
|
|
57
|
+
.tita-ui__picker-content tbody tr td:first-child {
|
|
58
|
+
padding-left: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.tita-ui__picker-content thead th:last-child,
|
|
62
|
+
.tita-ui__picker-content tbody tr:last-child,
|
|
63
|
+
.tita-ui__picker-content tbody tr td:last-child {
|
|
64
|
+
padding-right: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.tita-ui__picker-content thead th:last-child td,
|
|
68
|
+
.tita-ui__picker-content tbody tr:last-child td,
|
|
69
|
+
.tita-ui__picker-content tbody tr td:last-child td {
|
|
70
|
+
padding-bottom: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.tita-ui__picker-head {
|
|
74
|
+
background-color: #ffffff;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
position: relative;
|
|
78
|
+
z-index: 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.tita-ui__picker-head__view {
|
|
82
|
+
flex: 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.tita-ui__picker-head-btn__prev, .tita-ui__picker-head-btn__next, .tita-ui__picker-head-btn__year, .tita-ui__picker-head-btn__month {
|
|
86
|
+
min-width: 24px;
|
|
87
|
+
height: 24px;
|
|
88
|
+
border-radius: 8px;
|
|
89
|
+
transition: all 0.3s ease;
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
border: none;
|
|
92
|
+
color: #141c28;
|
|
93
|
+
display: inline-block;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tita-ui__picker-head-btn__prev:hover, .tita-ui__picker-head-btn__next:hover, .tita-ui__picker-head-btn__year:hover, .tita-ui__picker-head-btn__month:hover {
|
|
97
|
+
background-color: #f0f4fa;
|
|
98
|
+
color: #2879ff;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.tita-ui__picker-head-btn__prev, .tita-ui__picker-head-btn__next {
|
|
102
|
+
padding: 0;
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
line-height: 18px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.tita-ui__picker-head-btn__year, .tita-ui__picker-head-btn__month {
|
|
108
|
+
padding: 1px 2px;
|
|
109
|
+
font-size: 14px;
|
|
110
|
+
font-weight: 600;
|
|
111
|
+
line-height: 22px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tita-ui__picker-head-btn--readonly {
|
|
115
|
+
cursor: text;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.tita-ui__picker-head-btn--readonly:hover {
|
|
119
|
+
background-color: #ffffff;
|
|
120
|
+
color: #141c28;
|
|
121
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _picker = _interopRequireDefault(require("./picker"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _picker["default"];
|
|
13
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
13
|
+
|
|
14
|
+
var _datePanel = _interopRequireDefault(require("./components/panels/date-panel"));
|
|
15
|
+
|
|
16
|
+
var _monthPanel = _interopRequireDefault(require("./components/panels/month-panel"));
|
|
17
|
+
|
|
18
|
+
var _yearPanel = _interopRequireDefault(require("./components/panels/year-panel"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("./utils");
|
|
21
|
+
|
|
22
|
+
require("./index.css");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
|
+
|
|
32
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
33
|
+
|
|
34
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
+
|
|
36
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37
|
+
|
|
38
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
39
|
+
|
|
40
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
+
|
|
42
|
+
var PickerPanels = function PickerPanels(props) {
|
|
43
|
+
var _props$mode = props.mode,
|
|
44
|
+
mode = _props$mode === void 0 ? "date" : _props$mode,
|
|
45
|
+
onChange = props.onChange,
|
|
46
|
+
onClose = props.onClose,
|
|
47
|
+
_props$value = props.value,
|
|
48
|
+
value = _props$value === void 0 ? (0, _moment["default"])() : _props$value;
|
|
49
|
+
|
|
50
|
+
var _useState = (0, _react.useState)(mode),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
pickerMode = _useState2[0],
|
|
53
|
+
setPickerMode = _useState2[1];
|
|
54
|
+
|
|
55
|
+
var _useState3 = (0, _react.useState)(value ? (0, _moment["default"])(value) : (0, _moment["default"])()),
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
viewDate = _useState4[0],
|
|
58
|
+
setViewDate = _useState4[1];
|
|
59
|
+
|
|
60
|
+
var onViewDateChange = function onViewDateChange(date) {
|
|
61
|
+
setViewDate(function () {
|
|
62
|
+
return date;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var onPanelChange = function onPanelChange(viewDate, type) {
|
|
67
|
+
setPickerMode(function () {
|
|
68
|
+
return type;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var onCloseHandler = function onCloseHandler() {
|
|
73
|
+
if (pickerMode === mode) {
|
|
74
|
+
if (onClose) {
|
|
75
|
+
onClose();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var onDateSelect = function onDateSelect(date) {
|
|
81
|
+
if (onChange) {
|
|
82
|
+
onChange(date);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onCloseHandler();
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var onMonthSelect = function onMonthSelect(date) {
|
|
89
|
+
setViewDate(function () {
|
|
90
|
+
return date;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (mode !== "month") {
|
|
94
|
+
onPanelChange(date, "date");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (onChange) {
|
|
98
|
+
onChange(date);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
onCloseHandler();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var onYearSelect = function onYearSelect(date) {
|
|
105
|
+
setViewDate(function () {
|
|
106
|
+
return date;
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (mode !== "year") {
|
|
110
|
+
onPanelChange(date, "month");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (onChange) {
|
|
114
|
+
onChange(date);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
onCloseHandler();
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var onSelectChange = function onSelectChange(date, type) {
|
|
121
|
+
switch (type) {
|
|
122
|
+
case "date":
|
|
123
|
+
onDateSelect(date);
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case "month":
|
|
127
|
+
onMonthSelect(date);
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
case "year":
|
|
131
|
+
onYearSelect(date);
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
default:
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
var panel;
|
|
140
|
+
|
|
141
|
+
switch (pickerMode) {
|
|
142
|
+
case "date":
|
|
143
|
+
panel = /*#__PURE__*/_react["default"].createElement(_datePanel["default"], {
|
|
144
|
+
viewDate: viewDate,
|
|
145
|
+
onSelect: onSelectChange,
|
|
146
|
+
onViewDateChange: onViewDateChange,
|
|
147
|
+
onPanelChange: onPanelChange
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
|
|
151
|
+
case "month":
|
|
152
|
+
panel = /*#__PURE__*/_react["default"].createElement(_monthPanel["default"], {
|
|
153
|
+
viewDate: viewDate,
|
|
154
|
+
onSelect: onSelectChange,
|
|
155
|
+
onViewDateChange: onViewDateChange,
|
|
156
|
+
onPanelChange: onPanelChange
|
|
157
|
+
});
|
|
158
|
+
break;
|
|
159
|
+
|
|
160
|
+
case "year":
|
|
161
|
+
panel = /*#__PURE__*/_react["default"].createElement(_yearPanel["default"], {
|
|
162
|
+
viewDate: viewDate,
|
|
163
|
+
onSelect: onSelectChange,
|
|
164
|
+
onViewDateChange: onViewDateChange
|
|
165
|
+
});
|
|
166
|
+
break;
|
|
167
|
+
|
|
168
|
+
default:
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
173
|
+
className: _utils.PickerClass
|
|
174
|
+
}, panel);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
PickerPanels.defaultProps = {
|
|
178
|
+
mode: "date",
|
|
179
|
+
value: (0, _moment["default"])()
|
|
180
|
+
};
|
|
181
|
+
var _default = PickerPanels;
|
|
182
|
+
exports["default"] = _default;
|