@titaui/pc 1.11.4-0 → 1.11.4-11
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 +7 -0
- package/lib/components/avatar/text-avatar/index.js +32 -7
- 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 +11 -11
- 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/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/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/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/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/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-flow/child-node/index.css +67 -21
- 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 +42 -18
- 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 +265 -0
- package/lib/components/survey-model/instance.js +86 -0
- package/lib/components/survey-model/request-api.js +80 -0
- 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 +24 -0
- package/lib/components/time-picker/time-picker-selector.js +8 -12
- package/lib/components/time-picker/time-picker.js +136 -108
- 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", "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,128 +50,140 @@ 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$timeFormat = props.timeFormat,
|
|
55
|
+
timeFormat = _props$timeFormat === void 0 ? 'hh:mm' : _props$timeFormat,
|
|
56
|
+
_props$hourStep = props.hourStep,
|
|
52
57
|
hourStep = _props$hourStep === void 0 ? 1 : _props$hourStep,
|
|
53
58
|
_props$minuteStep = props.minuteStep,
|
|
54
59
|
minuteStep = _props$minuteStep === void 0 ? 1 : _props$minuteStep,
|
|
55
60
|
onChange = props.onChange,
|
|
56
61
|
_props$value = props.value,
|
|
57
|
-
value = _props$value === void 0 ?
|
|
62
|
+
value = _props$value === void 0 ? '00:00' : _props$value,
|
|
58
63
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
59
64
|
|
|
60
|
-
var _useState = (0, _react.useState)(
|
|
65
|
+
var _useState = (0, _react.useState)(''),
|
|
61
66
|
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
timeSetingtType = _useState2[0],
|
|
68
|
+
setTimeSettingType = _useState2[1];
|
|
64
69
|
|
|
65
|
-
var _useState3 = (0, _react.useState)(
|
|
70
|
+
var _useState3 = (0, _react.useState)(false),
|
|
66
71
|
_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];
|
|
72
|
+
visible = _useState4[0],
|
|
73
|
+
setVisible = _useState4[1];
|
|
79
74
|
|
|
80
|
-
var hourRef = (0, _react.useRef)(
|
|
75
|
+
var hourRef = (0, _react.useRef)((0, _moment["default"])(value || '00:00', timeFormat).format('HH'));
|
|
81
76
|
var hInputRef = (0, _react.useRef)();
|
|
82
77
|
var mInputRef = (0, _react.useRef)();
|
|
83
|
-
var minuteRef = (0, _react.useRef)(
|
|
78
|
+
var minuteRef = (0, _react.useRef)((0, _moment["default"])(value || '00:00', timeFormat).format('mm'));
|
|
84
79
|
var triggerRef = (0, _react.useRef)();
|
|
80
|
+
var timerRef = (0, _react.useRef)();
|
|
85
81
|
var hours = (0, _utils.getHours)(hourStep);
|
|
86
82
|
var minutes = (0, _utils.getMinutes)(minuteStep);
|
|
87
83
|
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
var onTimeChange = function onTimeChange() {
|
|
85
|
+
onChange === null || onChange === void 0 ? void 0 : onChange("".concat(hourRef.current, ":").concat(minuteRef.current));
|
|
86
|
+
};
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
var onInputClick = function onInputClick(type) {
|
|
89
|
+
clearTimeout(timerRef.current);
|
|
90
|
+
timerRef.current = setTimeout(function () {
|
|
91
|
+
if (type === 'hour') {
|
|
92
|
+
var _hInputRef$current;
|
|
93
|
+
|
|
94
|
+
(_hInputRef$current = hInputRef.current) === null || _hInputRef$current === void 0 ? void 0 : _hInputRef$current.focus();
|
|
95
|
+
} else {
|
|
96
|
+
var _mInputRef$current;
|
|
97
|
+
|
|
98
|
+
(_mInputRef$current = mInputRef.current) === null || _mInputRef$current === void 0 ? void 0 : _mInputRef$current.focus();
|
|
94
99
|
}
|
|
95
100
|
|
|
96
|
-
|
|
101
|
+
setTimeSettingType(function () {
|
|
102
|
+
return type;
|
|
103
|
+
});
|
|
104
|
+
}, 0);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
var onFocusHandler = function onFocusHandler(type) {
|
|
108
|
+
setTimeSettingType(function () {
|
|
109
|
+
return type;
|
|
97
110
|
});
|
|
111
|
+
};
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
var onHourInputBlur = function onHourInputBlur() {
|
|
114
|
+
// setHour((prevHour) => {
|
|
115
|
+
// const prevHour = hourRef.current;
|
|
116
|
+
// let nextHour = (Array(2).join("0") + prevHour).slice(-2);
|
|
117
|
+
// if (Number(prevHour) > Number(hours[hours.length - 1])) {
|
|
118
|
+
// nextHour = `0${prevHour.slice(0, 1)}`;
|
|
119
|
+
// }
|
|
120
|
+
// hourRef.current = nextHour;
|
|
121
|
+
// });
|
|
122
|
+
// if (timeSetType === "hour" && hInputRef.current) {
|
|
123
|
+
// hInputRef.current.focus();
|
|
124
|
+
// }
|
|
125
|
+
// onTimeChange();
|
|
126
|
+
setTimeSettingType('');
|
|
102
127
|
};
|
|
103
128
|
|
|
104
129
|
var onHourInputChange = function onHourInputChange(e) {
|
|
105
130
|
var v = e.target.value;
|
|
106
131
|
|
|
107
132
|
if (!Number.isNaN(Number(v))) {
|
|
108
|
-
setHour(v);
|
|
133
|
+
// setHour(v);
|
|
134
|
+
hourRef.current = v;
|
|
109
135
|
setTimeout(function () {
|
|
110
136
|
if (hInputRef.current) {
|
|
111
137
|
hInputRef.current.blur();
|
|
112
138
|
}
|
|
113
139
|
}, 1000);
|
|
140
|
+
onTimeChange();
|
|
114
141
|
}
|
|
115
142
|
};
|
|
116
143
|
|
|
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
144
|
var onMinuteInputBlur = function onMinuteInputBlur() {
|
|
127
|
-
setMinute(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
// setMinute((prevMinute) => {
|
|
146
|
+
// let nextMinute = minuteRef.current;
|
|
147
|
+
// minutes.forEach((m, i) => {
|
|
148
|
+
// const mNum = Number(m);
|
|
149
|
+
// const nextMinuteNum = Number(nextMinute);
|
|
150
|
+
// if (mNum === nextMinuteNum) {
|
|
151
|
+
// nextMinute = m;
|
|
152
|
+
// } else if (
|
|
153
|
+
// mNum < nextMinuteNum
|
|
154
|
+
// && Number(minutes[i + 1]) > nextMinuteNum
|
|
155
|
+
// ) {
|
|
156
|
+
// nextMinute = m;
|
|
157
|
+
// } else if (nextMinuteNum > Number(minutes[minutes.length - 1])) {
|
|
158
|
+
// nextMinute = "00";
|
|
159
|
+
// }
|
|
160
|
+
// });
|
|
161
|
+
// minuteRef.current = nextMinute;
|
|
162
|
+
// });
|
|
163
|
+
// if (timeSetType === "minute" && mInputRef.current) {
|
|
164
|
+
// mInputRef.current.focus();
|
|
165
|
+
// }
|
|
166
|
+
// onTimeChange();
|
|
167
|
+
setTimeSettingType('');
|
|
147
168
|
};
|
|
148
169
|
|
|
149
170
|
var onMinuteInputChange = function onMinuteInputChange(e) {
|
|
150
171
|
var v = e.target.value;
|
|
151
172
|
|
|
152
173
|
if (!Number.isNaN(Number(v))) {
|
|
153
|
-
setMinute(v);
|
|
174
|
+
// setMinute(v);
|
|
175
|
+
minuteRef.current = v;
|
|
154
176
|
setTimeout(function () {
|
|
155
177
|
if (mInputRef.current) {
|
|
156
178
|
mInputRef.current.blur();
|
|
157
179
|
}
|
|
158
180
|
}, 1000);
|
|
181
|
+
onTimeChange();
|
|
159
182
|
}
|
|
160
183
|
};
|
|
161
184
|
|
|
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
185
|
var setTimeOnKeyboardDirectionChange = function setTimeOnKeyboardDirectionChange(keyCode, type, currTime) {
|
|
172
|
-
var datas = JSON.parse(JSON.stringify(type ===
|
|
186
|
+
var datas = JSON.parse(JSON.stringify(type === 'hour' ? hours : minutes));
|
|
173
187
|
var currentTimeIndex;
|
|
174
188
|
datas.forEach(function (item, index) {
|
|
175
189
|
if (item === currTime) {
|
|
@@ -179,31 +193,31 @@ var TimePicker = function TimePicker(props) {
|
|
|
179
193
|
var nextData = datas[nextIndex];
|
|
180
194
|
|
|
181
195
|
if (!nextData || nextData && nextData > currTime) {
|
|
182
|
-
currentTimeIndex = keyCode ===
|
|
196
|
+
currentTimeIndex = keyCode === _utils.KEYCODE.directionUp || !nextData ? index : nextIndex;
|
|
183
197
|
}
|
|
184
198
|
}
|
|
185
199
|
});
|
|
186
200
|
|
|
187
|
-
if (keyCode ===
|
|
201
|
+
if (keyCode === _utils.KEYCODE.directionUp) {
|
|
188
202
|
// 方向键:↑
|
|
189
203
|
var nextIndex = currentTimeIndex + 1 === datas.length ? 0 : currentTimeIndex + 1;
|
|
190
204
|
var nextValue = datas[nextIndex];
|
|
191
205
|
|
|
192
206
|
if (currentTimeIndex > -1 && !!nextValue) {
|
|
193
|
-
if (type ===
|
|
194
|
-
|
|
207
|
+
if (type === 'minute' && nextValue === datas[0]) {
|
|
208
|
+
hourRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'hour', hourRef.current);
|
|
195
209
|
}
|
|
196
210
|
|
|
197
211
|
return nextValue;
|
|
198
212
|
}
|
|
199
|
-
} else if (keyCode ===
|
|
213
|
+
} else if (keyCode === _utils.KEYCODE.directionDown) {
|
|
200
214
|
// 方向键:↓
|
|
201
215
|
var prevIndex = currentTimeIndex - 1 < 0 ? datas.length - 1 : currentTimeIndex - 1;
|
|
202
216
|
var prevValue = datas[prevIndex];
|
|
203
217
|
|
|
204
218
|
if (currentTimeIndex > -1 && !!prevValue) {
|
|
205
|
-
if (type ===
|
|
206
|
-
|
|
219
|
+
if (type === 'minute' && prevValue === datas[datas.length - 1]) {
|
|
220
|
+
hourRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'hour', hourRef.current);
|
|
207
221
|
}
|
|
208
222
|
|
|
209
223
|
return prevValue;
|
|
@@ -214,65 +228,76 @@ var TimePicker = function TimePicker(props) {
|
|
|
214
228
|
};
|
|
215
229
|
|
|
216
230
|
var handleKeyDown = function handleKeyDown(e) {
|
|
217
|
-
|
|
218
|
-
|
|
231
|
+
var keyCode = e.keyCode;
|
|
232
|
+
|
|
233
|
+
if ([_utils.KEYCODE.directionLeft, _utils.KEYCODE.directionRight].includes(keyCode)) {
|
|
234
|
+
setTimeSettingType(_utils.TargetMapByKeyCode[keyCode]);
|
|
219
235
|
}
|
|
220
236
|
|
|
221
|
-
if (
|
|
237
|
+
if ([_utils.KEYCODE.directionUp, _utils.KEYCODE.directionDown].indexOf(keyCode) === -1) return;
|
|
222
238
|
|
|
223
|
-
switch (
|
|
224
|
-
case
|
|
225
|
-
|
|
239
|
+
switch (timeSetingtType) {
|
|
240
|
+
case 'hour':
|
|
241
|
+
hourRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'hour', hourRef.current);
|
|
226
242
|
break;
|
|
227
243
|
|
|
228
|
-
case
|
|
229
|
-
|
|
244
|
+
case 'minute':
|
|
245
|
+
minuteRef.current = setTimeOnKeyboardDirectionChange(keyCode, 'minute', minuteRef.current);
|
|
230
246
|
break;
|
|
231
247
|
|
|
232
248
|
default:
|
|
233
249
|
break;
|
|
234
250
|
}
|
|
251
|
+
|
|
252
|
+
onTimeChange();
|
|
235
253
|
};
|
|
236
254
|
|
|
237
255
|
(0, _react.useEffect)(function () {
|
|
238
|
-
document.addEventListener(
|
|
256
|
+
timeSetingtType && document.addEventListener('keydown', handleKeyDown);
|
|
239
257
|
return function () {
|
|
240
|
-
document.removeEventListener(
|
|
258
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
241
259
|
};
|
|
242
|
-
}, [
|
|
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]);
|
|
260
|
+
}, [timeSetingtType]);
|
|
248
261
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
249
262
|
className: _utils.TimePickerClass
|
|
250
263
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
251
|
-
className: "".concat(_utils.TimePickerClass, "-trigger"),
|
|
264
|
+
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-trigger"), _defineProperty({}, "".concat(_utils.TimePickerClass, "-trigger--disabled"), disabled)),
|
|
252
265
|
ref: triggerRef
|
|
253
266
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
254
|
-
className: "".concat(_utils.TimePickerClass, "-inputs")
|
|
267
|
+
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-inputs"), _defineProperty({}, "".concat(_utils.TimePickerClass, "-inputs--placeholder"), !value))
|
|
255
268
|
}, /*#__PURE__*/_react["default"].createElement(_timerPickerInput["default"], {
|
|
256
269
|
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-input"), {
|
|
257
|
-
active:
|
|
270
|
+
active: timeSetingtType === 'hour'
|
|
258
271
|
}),
|
|
272
|
+
disabled: disabled,
|
|
259
273
|
maxLength: 2,
|
|
260
274
|
onBlur: onHourInputBlur,
|
|
261
275
|
onChange: onHourInputChange,
|
|
262
|
-
onClick:
|
|
276
|
+
onClick: function onClick() {
|
|
277
|
+
return onInputClick('hour');
|
|
278
|
+
},
|
|
279
|
+
onFocus: function onFocus() {
|
|
280
|
+
return onFocusHandler('hour');
|
|
281
|
+
},
|
|
263
282
|
ref: hInputRef,
|
|
264
|
-
value:
|
|
283
|
+
value: hourRef.current
|
|
265
284
|
}), /*#__PURE__*/_react["default"].createElement("span", null, ":"), /*#__PURE__*/_react["default"].createElement(_timerPickerInput["default"], {
|
|
266
285
|
className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-input"), {
|
|
267
|
-
active:
|
|
286
|
+
active: timeSetingtType === 'minute'
|
|
268
287
|
}),
|
|
288
|
+
disabled: disabled,
|
|
269
289
|
maxLength: 2,
|
|
270
290
|
onBlur: onMinuteInputBlur,
|
|
271
291
|
onChange: onMinuteInputChange,
|
|
272
|
-
onClick:
|
|
292
|
+
onClick: function onClick() {
|
|
293
|
+
return onInputClick('minute');
|
|
294
|
+
},
|
|
295
|
+
onFocus: function onFocus() {
|
|
296
|
+
return onFocusHandler('minute');
|
|
297
|
+
},
|
|
273
298
|
ref: mInputRef,
|
|
274
|
-
value:
|
|
275
|
-
})), /*#__PURE__*/_react["default"].createElement(_timePickerSelector["default"], _extends({
|
|
299
|
+
value: minuteRef.current
|
|
300
|
+
})), !disabled && /*#__PURE__*/_react["default"].createElement(_timePickerSelector["default"], _extends({
|
|
276
301
|
popupAlign: {
|
|
277
302
|
offset: [12, 8],
|
|
278
303
|
overflow: {
|
|
@@ -286,17 +311,20 @@ var TimePicker = function TimePicker(props) {
|
|
|
286
311
|
minutes: minutes
|
|
287
312
|
},
|
|
288
313
|
timeSetting: {
|
|
289
|
-
hour:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
314
|
+
hour: hourRef.current,
|
|
315
|
+
minute: minuteRef.current,
|
|
316
|
+
setTime: function setTime(time) {
|
|
317
|
+
hourRef.current = (0, _moment["default"])(time, 'HH:mm').format('HH');
|
|
318
|
+
minuteRef.current = (0, _moment["default"])(time, 'HH:mm').format('mm');
|
|
319
|
+
onChange(time);
|
|
320
|
+
}
|
|
293
321
|
},
|
|
294
322
|
visibleSetting: {
|
|
295
323
|
visible: visible,
|
|
296
324
|
setVisible: setVisible
|
|
297
325
|
}
|
|
298
326
|
}, restProps), /*#__PURE__*/_react["default"].createElement("span", {
|
|
299
|
-
className: "".concat(_utils.TimePickerClass, "-icon tu-icon-
|
|
327
|
+
className: "".concat(_utils.TimePickerClass, "-icon tu-icon-caret-down"),
|
|
300
328
|
onClick: function onClick() {
|
|
301
329
|
setVisible(true);
|
|
302
330
|
}
|
|
@@ -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 = {}));
|