@titaui/pc 1.11.4-0 → 1.11.4-0.beta-2
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/text-avatar/index.css +9 -2
- package/lib/components/avatar/text-avatar/index.js +34 -9
- package/lib/components/button/rect-btn/index.js +7 -7
- package/lib/components/change-okr-modal/Item.js +15 -15
- package/lib/components/communication/index.js +30 -29
- package/lib/components/drawer/index.js +7 -6
- package/lib/components/dynamic/constant.js +43 -36
- package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/dynamic-footer.js +243 -0
- package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/index.js +6 -2
- 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 +6 -6
- package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.js +7 -7
- package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +11 -11
- package/lib/components/dynamic/dynamic-item/dynamic-reply/index.js +14 -14
- package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +10 -10
- package/lib/components/dynamic/dynamic-item/index.js +70 -41
- package/lib/components/dynamic/dynamic-list/index.js +5 -13
- package/lib/components/e-priority/index.js +18 -12
- package/lib/components/eReport/eReportShare/index.js +12 -12
- package/lib/components/file-list/components/single-file/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 +11 -5
- package/lib/components/icon-button-list/index.css +2 -57
- package/lib/components/icon-button-list/index.js +10 -7
- package/lib/components/img-viewer/index.css +10 -3
- package/lib/components/img-viewer/index.js +57 -18
- package/lib/components/mblog/components/MblogContent.js +5 -2
- package/lib/components/mblog/index.js +31 -30
- 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 +23 -17
- package/lib/components/menus/export-modules/interview-menus/handle-highlight.js +5 -5
- package/lib/components/menus/export-modules/interview-menus/index.css +7 -0
- package/lib/components/menus/export-modules/interview-menus/index.js +5 -4
- package/lib/components/nav-top/components/menu/img/new.svg +30 -0
- package/lib/components/nav-top/components/menu/img/wecome-temp.png +0 -0
- package/lib/components/nav-top/components/menu/index.css +91 -0
- package/lib/components/nav-top/components/menu/index.js +80 -32
- 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/request.apis.js +3 -1
- 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 +3 -2
- 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 +62 -66
- package/lib/components/okr-detail/detail-header/index.css +2 -2
- package/lib/components/okr-detail/detail-header/index.js +205 -194
- package/lib/components/okr-detail/index.js +21 -19
- package/lib/components/okr-detail/okr-list/index.js +5 -3
- package/lib/components/okr-flow/child-node/index.css +68 -22
- package/lib/components/okr-flow/child-node/work-node.js +61 -24
- package/lib/components/okr-flow/empty/index.css +8 -1
- package/lib/components/okr-flow/export-modal/index.js +108 -21
- package/lib/components/okr-flow/export-modules/okr-search-panel/index.css +3 -1
- package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +30 -24
- package/lib/components/okr-flow/images/loading-light.gif +0 -0
- package/lib/components/okr-flow/okr-map/index.js +43 -22
- package/lib/components/okr-flow/request-apis.js +15 -8
- package/lib/components/okr-flow/root-node/index.css +2 -2
- package/lib/components/okr-flow/root-node/index.js +26 -25
- package/lib/components/okr-flow/utils/index.js +45 -29
- package/lib/components/okr-flow/utils/tree-handler.js +29 -18
- package/lib/components/okrcase-library/index.css +6 -4
- package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +36 -30
- package/lib/components/pagination/index.css +3 -3
- package/lib/components/pagination/select.css +58 -23
- package/lib/components/period-selector/index.css +9 -3
- package/lib/components/period-selector/index.js +14 -11
- package/lib/components/picker/components/panels/date-panel/date-body.js +21 -19
- package/lib/components/picker/components/panels/date-panel/date-head.js +29 -8
- package/lib/components/picker/components/panels/month-panel/month-body.js +6 -4
- package/lib/components/picker/components/picker-trigger/index.css +31 -0
- package/lib/components/picker/components/picker-trigger/index.js +24 -15
- package/lib/components/picker/picker-panels.js +1 -1
- package/lib/components/picker/picker.js +12 -13
- package/lib/components/popup/index.js +4 -4
- package/lib/components/radio/index.css +9 -9
- package/lib/components/scroll-container/index.js +423 -0
- package/lib/components/scroll-container/style.css +35 -0
- package/lib/components/scrollbar/scroll-mask/index.js +1 -1
- package/lib/components/superset-charts/components/chart/index.js +1 -1
- package/lib/components/superset-charts/utils/axios.js +5 -13
- package/lib/components/survey-model/contact.js +93 -0
- package/lib/components/survey-model/index.css +141 -0
- package/lib/components/survey-model/index.js +268 -0
- package/lib/components/survey-model/instance.js +86 -0
- package/lib/components/survey-model/request-api.js +80 -0
- package/lib/components/task-relation-modal/index.js +0 -1
- 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 +16 -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 +114 -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 +299 -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 +24 -0
- package/lib/components/time-picker/time-picker-selector.js +8 -12
- package/lib/components/time-picker/time-picker.js +94 -133
- package/lib/components/time-picker/timer-picker-input.js +3 -7
- package/lib/components/time-picker/utils.js +13 -2
- package/lib/components/user-selector/select-tree/tree-nodes/tree-person-node/index.css +1 -0
- package/lib/components/wechat-btn/index.css +14 -0
- package/lib/components/wechat-btn/index.js +338 -0
- package/lib/components-v1/radio/radio.js +3 -3
- package/lib/components-v1/radio/style/index.css +8 -8
- package/lib/index.js +99 -91
- package/lib/pages/okr-map/export-modules/okr-map/header/index.css +7 -2
- package/lib/pages/okr-map/export-modules/okr-map/header/index.js +73 -34
- package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +65 -42
- package/lib/pages/okr-map/export-modules/share-okr-page/header/index.css +26 -14
- package/lib/pages/okr-map/export-modules/share-okr-page/header/index.js +58 -13
- package/lib/pages/okr-map/export-modules/share-okr-page/share-okr-map.js +28 -20
- package/lib/pages/okr-map/number-select/index.css +12 -9
- package/lib/pages/okr-map/number-select/index.js +3 -3
- package/lib/utils/auth.js +65 -8
- package/lib/utils/bs-global.js +18 -6
- package/lib/utils/open-data.js +63 -43
- package/package.json +6 -2
- 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/yarn-error.log +0 -22184
|
@@ -21,7 +21,7 @@ var _utils = require("./utils");
|
|
|
21
21
|
|
|
22
22
|
require("./index.css");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["hourStep", "minuteStep", "onChange", "value"];
|
|
24
|
+
var _excluded = ["disabled", "enableKeyBoard", "timeFormat", "hourStep", "minuteStep", "onChange", "value"];
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
27
|
|
|
@@ -31,6 +31,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
31
|
|
|
32
32
|
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); }
|
|
33
33
|
|
|
34
|
+
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; }
|
|
35
|
+
|
|
34
36
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
37
|
|
|
36
38
|
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."); }
|
|
@@ -48,56 +50,70 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
48
50
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
49
51
|
|
|
50
52
|
var TimePicker = function TimePicker(props) {
|
|
51
|
-
var
|
|
53
|
+
var disabled = props.disabled,
|
|
54
|
+
_props$enableKeyBoard = props.enableKeyBoard,
|
|
55
|
+
enableKeyBoard = _props$enableKeyBoard === void 0 ? true : _props$enableKeyBoard,
|
|
56
|
+
_props$timeFormat = props.timeFormat,
|
|
57
|
+
timeFormat = _props$timeFormat === void 0 ? 'hh:mm' : _props$timeFormat,
|
|
58
|
+
_props$hourStep = props.hourStep,
|
|
52
59
|
hourStep = _props$hourStep === void 0 ? 1 : _props$hourStep,
|
|
53
60
|
_props$minuteStep = props.minuteStep,
|
|
54
61
|
minuteStep = _props$minuteStep === void 0 ? 1 : _props$minuteStep,
|
|
55
62
|
onChange = props.onChange,
|
|
56
63
|
_props$value = props.value,
|
|
57
|
-
value = _props$value === void 0 ?
|
|
64
|
+
value = _props$value === void 0 ? '00:00' : _props$value,
|
|
58
65
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
59
66
|
|
|
60
|
-
var _useState = (0, _react.useState)(
|
|
67
|
+
var _useState = (0, _react.useState)(''),
|
|
61
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
timeSetingtType = _useState2[0],
|
|
70
|
+
setTimeSettingType = _useState2[1];
|
|
64
71
|
|
|
65
|
-
var _useState3 = (0, _react.useState)(
|
|
72
|
+
var _useState3 = (0, _react.useState)(false),
|
|
66
73
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var _useState5 = (0, _react.useState)(),
|
|
71
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
72
|
-
target = _useState6[0],
|
|
73
|
-
setTarget = _useState6[1];
|
|
74
|
-
|
|
75
|
-
var _useState7 = (0, _react.useState)(false),
|
|
76
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
77
|
-
visible = _useState8[0],
|
|
78
|
-
setVisible = _useState8[1];
|
|
74
|
+
visible = _useState4[0],
|
|
75
|
+
setVisible = _useState4[1];
|
|
79
76
|
|
|
80
|
-
var hourRef = (0, _react.useRef)(
|
|
77
|
+
var hourRef = (0, _react.useRef)((0, _moment["default"])(value || '00:00', timeFormat).format('HH'));
|
|
81
78
|
var hInputRef = (0, _react.useRef)();
|
|
82
79
|
var mInputRef = (0, _react.useRef)();
|
|
83
|
-
var minuteRef = (0, _react.useRef)(
|
|
80
|
+
var minuteRef = (0, _react.useRef)((0, _moment["default"])(value || '00:00', timeFormat).format('mm'));
|
|
84
81
|
var triggerRef = (0, _react.useRef)();
|
|
85
82
|
var hours = (0, _utils.getHours)(hourStep);
|
|
86
83
|
var minutes = (0, _utils.getMinutes)(minuteStep);
|
|
87
84
|
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (Number(prevHour) > Number(hours[hours.length - 1])) {
|
|
93
|
-
nextHour = "0".concat(prevHour.slice(0, 1));
|
|
94
|
-
}
|
|
85
|
+
var onTimeChange = function onTimeChange() {
|
|
86
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange("".concat(hourRef.current, ":").concat(minuteRef.current));
|
|
87
|
+
};
|
|
95
88
|
|
|
96
|
-
|
|
89
|
+
var onInputClickHandler = function onInputClickHandler(type) {
|
|
90
|
+
return setTimeSettingType(function () {
|
|
91
|
+
return type;
|
|
97
92
|
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var onKeyDownHandler = function onKeyDownHandler(e) {
|
|
96
|
+
var keyCode = e.keyCode;
|
|
98
97
|
|
|
99
|
-
if (
|
|
100
|
-
|
|
98
|
+
if ([_utils.KEYCODE.directionLeft, _utils.KEYCODE.directionRight].includes(keyCode)) {
|
|
99
|
+
setTimeSettingType(_utils.TargetMapByKeyCode[keyCode]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if ([_utils.KEYCODE.directionUp, _utils.KEYCODE.directionDown].includes(keyCode)) {
|
|
103
|
+
switch (timeSetingtType) {
|
|
104
|
+
case 'hour':
|
|
105
|
+
hourRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'hour', hourRef.current);
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case 'minute':
|
|
109
|
+
minuteRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'minute', minuteRef.current);
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
default:
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
onTimeChange();
|
|
101
117
|
}
|
|
102
118
|
};
|
|
103
119
|
|
|
@@ -105,44 +121,14 @@ var TimePicker = function TimePicker(props) {
|
|
|
105
121
|
var v = e.target.value;
|
|
106
122
|
|
|
107
123
|
if (!Number.isNaN(Number(v))) {
|
|
108
|
-
setHour(v);
|
|
124
|
+
// setHour(v);
|
|
125
|
+
hourRef.current = v;
|
|
109
126
|
setTimeout(function () {
|
|
110
127
|
if (hInputRef.current) {
|
|
111
128
|
hInputRef.current.blur();
|
|
112
129
|
}
|
|
113
130
|
}, 1000);
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
var onHourInputClick = function onHourInputClick() {
|
|
118
|
-
setTarget("hour");
|
|
119
|
-
setTimeout(function () {
|
|
120
|
-
if (hInputRef.current) {
|
|
121
|
-
hInputRef.current.focus();
|
|
122
|
-
}
|
|
123
|
-
}, 0);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
var onMinuteInputBlur = function onMinuteInputBlur() {
|
|
127
|
-
setMinute(function (prevMinute) {
|
|
128
|
-
var nextMinute = prevMinute;
|
|
129
|
-
minutes.forEach(function (m, i) {
|
|
130
|
-
var mNum = Number(m);
|
|
131
|
-
var nextMinuteNum = Number(nextMinute);
|
|
132
|
-
|
|
133
|
-
if (mNum === nextMinuteNum) {
|
|
134
|
-
nextMinute = m;
|
|
135
|
-
} else if (mNum < nextMinuteNum && Number(minutes[i + 1]) > nextMinuteNum) {
|
|
136
|
-
nextMinute = m;
|
|
137
|
-
} else if (nextMinuteNum > Number(minutes[minutes.length - 1])) {
|
|
138
|
-
nextMinute = "00";
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
return nextMinute;
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
if (target === "minute" && mInputRef.current) {
|
|
145
|
-
mInputRef.current.focus();
|
|
131
|
+
onTimeChange();
|
|
146
132
|
}
|
|
147
133
|
};
|
|
148
134
|
|
|
@@ -150,26 +136,19 @@ var TimePicker = function TimePicker(props) {
|
|
|
150
136
|
var v = e.target.value;
|
|
151
137
|
|
|
152
138
|
if (!Number.isNaN(Number(v))) {
|
|
153
|
-
setMinute(v);
|
|
139
|
+
// setMinute(v);
|
|
140
|
+
minuteRef.current = v;
|
|
154
141
|
setTimeout(function () {
|
|
155
142
|
if (mInputRef.current) {
|
|
156
143
|
mInputRef.current.blur();
|
|
157
144
|
}
|
|
158
145
|
}, 1000);
|
|
146
|
+
onTimeChange();
|
|
159
147
|
}
|
|
160
148
|
};
|
|
161
149
|
|
|
162
|
-
var onMinuteInputClick = function onMinuteInputClick() {
|
|
163
|
-
setTarget("minute");
|
|
164
|
-
setTimeout(function () {
|
|
165
|
-
if (mInputRef.current) {
|
|
166
|
-
mInputRef.current.focus();
|
|
167
|
-
}
|
|
168
|
-
}, 0);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
150
|
var setTimeOnKeyboardDirectionChange = function setTimeOnKeyboardDirectionChange(keyCode, type, currTime) {
|
|
172
|
-
var datas = JSON.parse(JSON.stringify(type ===
|
|
151
|
+
var datas = JSON.parse(JSON.stringify(type === 'hour' ? hours : minutes));
|
|
173
152
|
var currentTimeIndex;
|
|
174
153
|
datas.forEach(function (item, index) {
|
|
175
154
|
if (item === currTime) {
|
|
@@ -179,31 +158,31 @@ var TimePicker = function TimePicker(props) {
|
|
|
179
158
|
var nextData = datas[nextIndex];
|
|
180
159
|
|
|
181
160
|
if (!nextData || nextData && nextData > currTime) {
|
|
182
|
-
currentTimeIndex = keyCode ===
|
|
161
|
+
currentTimeIndex = keyCode === _utils.KEYCODE.directionUp || !nextData ? index : nextIndex;
|
|
183
162
|
}
|
|
184
163
|
}
|
|
185
164
|
});
|
|
186
165
|
|
|
187
|
-
if (keyCode ===
|
|
166
|
+
if (keyCode === _utils.KEYCODE.directionUp) {
|
|
188
167
|
// 方向键:↑
|
|
189
168
|
var nextIndex = currentTimeIndex + 1 === datas.length ? 0 : currentTimeIndex + 1;
|
|
190
169
|
var nextValue = datas[nextIndex];
|
|
191
170
|
|
|
192
171
|
if (currentTimeIndex > -1 && !!nextValue) {
|
|
193
|
-
if (type ===
|
|
194
|
-
|
|
172
|
+
if (type === 'minute' && nextValue === datas[0]) {
|
|
173
|
+
hourRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'hour', hourRef.current);
|
|
195
174
|
}
|
|
196
175
|
|
|
197
176
|
return nextValue;
|
|
198
177
|
}
|
|
199
|
-
} else if (keyCode ===
|
|
178
|
+
} else if (keyCode === _utils.KEYCODE.directionDown) {
|
|
200
179
|
// 方向键:↓
|
|
201
180
|
var prevIndex = currentTimeIndex - 1 < 0 ? datas.length - 1 : currentTimeIndex - 1;
|
|
202
181
|
var prevValue = datas[prevIndex];
|
|
203
182
|
|
|
204
183
|
if (currentTimeIndex > -1 && !!prevValue) {
|
|
205
|
-
if (type ===
|
|
206
|
-
|
|
184
|
+
if (type === 'minute' && prevValue === datas[datas.length - 1]) {
|
|
185
|
+
hourRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'hour', hourRef.current);
|
|
207
186
|
}
|
|
208
187
|
|
|
209
188
|
return prevValue;
|
|
@@ -213,66 +192,47 @@ var TimePicker = function TimePicker(props) {
|
|
|
213
192
|
return currTime;
|
|
214
193
|
};
|
|
215
194
|
|
|
216
|
-
var
|
|
217
|
-
|
|
218
|
-
setTarget(_utils.TargetMapByKeyCode[e.keyCode]);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (e.keyCode !== 38 && e.keyCode !== 40) return;
|
|
222
|
-
|
|
223
|
-
switch (target) {
|
|
224
|
-
case "hour":
|
|
225
|
-
setHour(setTimeOnKeyboardDirectionChange(e.keyCode, "hour", hourRef.current));
|
|
226
|
-
break;
|
|
227
|
-
|
|
228
|
-
case "minute":
|
|
229
|
-
setMinute(setTimeOnKeyboardDirectionChange(e.keyCode, "minute", minuteRef.current));
|
|
230
|
-
break;
|
|
231
|
-
|
|
232
|
-
default:
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
195
|
+
var showSelectorPop = function showSelectorPop() {
|
|
196
|
+
return setVisible(true);
|
|
235
197
|
};
|
|
236
198
|
|
|
237
|
-
(0, _react.useEffect)(function () {
|
|
238
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
239
|
-
return function () {
|
|
240
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
241
|
-
};
|
|
242
|
-
}, [target]);
|
|
243
|
-
(0, _react.useEffect)(function () {
|
|
244
|
-
hourRef.current = hour;
|
|
245
|
-
minuteRef.current = minute;
|
|
246
|
-
onChange === null || onChange === void 0 ? void 0 : onChange("".concat(hour, ":").concat(minute));
|
|
247
|
-
}, [hour, minutes]);
|
|
248
199
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
249
200
|
className: _utils.TimePickerClass
|
|
250
201
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
251
|
-
className: "".concat(_utils.TimePickerClass, "-trigger"),
|
|
202
|
+
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-trigger"), _defineProperty({}, "".concat(_utils.TimePickerClass, "-trigger--disabled"), disabled)),
|
|
252
203
|
ref: triggerRef
|
|
253
204
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
254
|
-
className: "".concat(_utils.TimePickerClass, "-inputs")
|
|
255
|
-
|
|
205
|
+
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-inputs"), _defineProperty({}, "".concat(_utils.TimePickerClass, "-inputs--placeholder"), !value)),
|
|
206
|
+
onClick: function onClick() {
|
|
207
|
+
return !enableKeyBoard && showSelectorPop();
|
|
208
|
+
}
|
|
209
|
+
}, /*#__PURE__*/_react["default"].createElement(_timerPickerInput["default"], _extends({
|
|
256
210
|
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-input"), {
|
|
257
|
-
active:
|
|
211
|
+
active: enableKeyBoard && timeSetingtType === 'hour'
|
|
258
212
|
}),
|
|
213
|
+
disabled: disabled,
|
|
259
214
|
maxLength: 2,
|
|
260
|
-
onBlur: onHourInputBlur,
|
|
261
215
|
onChange: onHourInputChange,
|
|
262
|
-
onClick:
|
|
216
|
+
onClick: function onClick() {
|
|
217
|
+
return onInputClickHandler('hour');
|
|
218
|
+
},
|
|
219
|
+
onKeyDown: onKeyDownHandler,
|
|
263
220
|
ref: hInputRef,
|
|
264
|
-
value:
|
|
265
|
-
}), /*#__PURE__*/_react["default"].createElement("span", null, ":"), /*#__PURE__*/_react["default"].createElement(_timerPickerInput["default"], {
|
|
221
|
+
value: hourRef.current
|
|
222
|
+
}, restProps)), /*#__PURE__*/_react["default"].createElement("span", null, ":"), /*#__PURE__*/_react["default"].createElement(_timerPickerInput["default"], {
|
|
266
223
|
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-input"), {
|
|
267
|
-
active:
|
|
224
|
+
active: enableKeyBoard && timeSetingtType === 'minute'
|
|
268
225
|
}),
|
|
226
|
+
disabled: disabled,
|
|
269
227
|
maxLength: 2,
|
|
270
|
-
onBlur: onMinuteInputBlur,
|
|
271
228
|
onChange: onMinuteInputChange,
|
|
272
|
-
onClick:
|
|
229
|
+
onClick: function onClick() {
|
|
230
|
+
return onInputClickHandler('minute');
|
|
231
|
+
},
|
|
232
|
+
onKeyDown: onKeyDownHandler,
|
|
273
233
|
ref: mInputRef,
|
|
274
|
-
value:
|
|
275
|
-
})), /*#__PURE__*/_react["default"].createElement(_timePickerSelector["default"], _extends({
|
|
234
|
+
value: minuteRef.current
|
|
235
|
+
})), !disabled && /*#__PURE__*/_react["default"].createElement(_timePickerSelector["default"], _extends({
|
|
276
236
|
popupAlign: {
|
|
277
237
|
offset: [12, 8],
|
|
278
238
|
overflow: {
|
|
@@ -286,20 +246,21 @@ var TimePicker = function TimePicker(props) {
|
|
|
286
246
|
minutes: minutes
|
|
287
247
|
},
|
|
288
248
|
timeSetting: {
|
|
289
|
-
hour:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
249
|
+
hour: hourRef.current,
|
|
250
|
+
minute: minuteRef.current,
|
|
251
|
+
setTime: function setTime(time) {
|
|
252
|
+
hourRef.current = (0, _moment["default"])(time, 'HH:mm').format('HH');
|
|
253
|
+
minuteRef.current = (0, _moment["default"])(time, 'HH:mm').format('mm');
|
|
254
|
+
onChange(time);
|
|
255
|
+
}
|
|
293
256
|
},
|
|
294
257
|
visibleSetting: {
|
|
295
258
|
visible: visible,
|
|
296
259
|
setVisible: setVisible
|
|
297
260
|
}
|
|
298
261
|
}, restProps), /*#__PURE__*/_react["default"].createElement("span", {
|
|
299
|
-
className: "".concat(_utils.TimePickerClass, "-icon tu-icon-
|
|
300
|
-
onClick:
|
|
301
|
-
setVisible(true);
|
|
302
|
-
}
|
|
262
|
+
className: "".concat(_utils.TimePickerClass, "-icon tu-icon-caret-down"),
|
|
263
|
+
onClick: showSelectorPop
|
|
303
264
|
}))));
|
|
304
265
|
};
|
|
305
266
|
|
|
@@ -32,7 +32,7 @@ var TimePickerInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
|
32
32
|
_props$stopPropagatio = props.stopPropagation,
|
|
33
33
|
stopPropagation = _props$stopPropagatio === void 0 ? true : _props$stopPropagatio,
|
|
34
34
|
_props$type = props.type,
|
|
35
|
-
type = _props$type === void 0 ?
|
|
35
|
+
type = _props$type === void 0 ? 'text' : _props$type,
|
|
36
36
|
value = props.value,
|
|
37
37
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
38
38
|
|
|
@@ -57,11 +57,6 @@ var TimePickerInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
|
57
57
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
var onFocusHandler = function onFocusHandler(e) {
|
|
61
|
-
setSelectionRange(0);
|
|
62
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
60
|
var onChangeHandler = function onChangeHandler(e) {
|
|
66
61
|
return onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
67
62
|
};
|
|
@@ -80,11 +75,12 @@ var TimePickerInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
|
80
75
|
setSelectionRange(changeTimeout);
|
|
81
76
|
}, [value]);
|
|
82
77
|
return /*#__PURE__*/_react["default"].createElement("input", _extends({
|
|
78
|
+
autoFocus: false,
|
|
79
|
+
autoComplete: "off",
|
|
83
80
|
className: className,
|
|
84
81
|
maxLength: maxLength,
|
|
85
82
|
onClick: onClickHandler,
|
|
86
83
|
onChange: onChangeHandler,
|
|
87
|
-
onFocus: onFocusHandler,
|
|
88
84
|
ref: inputRef,
|
|
89
85
|
type: type,
|
|
90
86
|
value: value
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TimePickerClass = exports.TargetMapByKeyCode = void 0;
|
|
6
|
+
exports.TimePickerClass = exports.TargetMapByKeyCode = exports.KEYCODE = void 0;
|
|
7
7
|
exports.getHours = getHours;
|
|
8
8
|
exports.getMinutes = getMinutes;
|
|
9
9
|
var TimePickerClass = "tita-ui__time-picker";
|
|
@@ -38,4 +38,15 @@ function getMinutes() {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return minutes;
|
|
41
|
-
}
|
|
41
|
+
} // eslint-disable-next-line no-shadow
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var KEYCODE;
|
|
45
|
+
exports.KEYCODE = KEYCODE;
|
|
46
|
+
|
|
47
|
+
(function (KEYCODE) {
|
|
48
|
+
KEYCODE[KEYCODE["directionLeft"] = 37] = "directionLeft";
|
|
49
|
+
KEYCODE[KEYCODE["directionUp"] = 38] = "directionUp";
|
|
50
|
+
KEYCODE[KEYCODE["directionRight"] = 39] = "directionRight";
|
|
51
|
+
KEYCODE[KEYCODE["directionDown"] = 40] = "directionDown";
|
|
52
|
+
})(KEYCODE || (exports.KEYCODE = KEYCODE = {}));
|