@ucloud-fe/react-components 1.3.26 → 1.4.1
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/CHANGELOG.md +19 -0
- package/dist/icon.min.js +1 -1
- package/dist/main.min.js +4 -4
- package/lib/components/AutoComplete/AutoComplete.js +7 -4
- package/lib/components/Badge/Bubble.d.ts +2 -0
- package/lib/components/Box/Box.d.ts +1 -0
- package/lib/components/Calendar/Calendar.d.ts +6 -1
- package/lib/components/Calendar/Calendar.js +12 -4
- package/lib/components/Calendar/Cell.d.ts +8 -0
- package/lib/components/Calendar/Cell.js +55 -0
- package/lib/components/Calendar/HeaderButton.d.ts +8 -0
- package/lib/components/Calendar/HeaderButton.js +75 -0
- package/lib/components/Calendar/HeaderSwitcher.d.ts +2 -1
- package/lib/components/Calendar/Month.js +10 -4
- package/lib/components/Calendar/TwoSide.d.ts +4 -0
- package/lib/components/Calendar/TwoSide.js +155 -0
- package/lib/components/Calendar/index.d.ts +3 -0
- package/lib/components/Calendar/index.js +9 -0
- package/lib/components/Calendar/locale/en_US.js +2 -1
- package/lib/components/Calendar/locale/zh_CN.d.ts +1 -0
- package/lib/components/Calendar/locale/zh_CN.js +3 -2
- package/lib/components/Calendar/style/index.d.ts +13 -0
- package/lib/components/Calendar/style/index.js +29 -7
- package/lib/components/Calendar/utils.d.ts +1 -1
- package/lib/components/Calendar/utils.js +5 -5
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +5 -7
- package/lib/components/DatePicker/Footer.d.ts +5 -2
- package/lib/components/DatePicker/Footer.js +31 -55
- package/lib/components/DatePicker/Month.js +4 -6
- package/lib/components/DatePicker/Range.d.ts +2 -2
- package/lib/components/DatePicker/Range.js +179 -71
- package/lib/components/DatePicker/locale/en_US.js +2 -1
- package/lib/components/DatePicker/locale/zh_CN.d.ts +1 -0
- package/lib/components/DatePicker/locale/zh_CN.js +2 -1
- package/lib/components/DatePicker/style/index.d.ts +24 -5
- package/lib/components/DatePicker/style/index.js +102 -34
- package/lib/components/DatePicker/usePicker.js +90 -31
- package/lib/components/DatePicker/useRangePicker.d.ts +16 -0
- package/lib/components/DatePicker/{RangePicker.js → useRangePicker.js} +44 -80
- package/lib/components/DatePicker/utils.d.ts +1 -1
- package/lib/components/Form/ControllerContext.d.ts +1 -1
- package/lib/components/Input/Input.js +4 -2
- package/lib/components/Input/Search.js +1 -1
- package/lib/components/Input/style/index.d.ts +2 -1
- package/lib/components/Input/style/index.js +6 -4
- package/lib/components/Loading/Loading.d.ts +1 -0
- package/lib/components/NumberInput/NumberInput.d.ts +12 -0
- package/lib/components/NumberInput/NumberInput.js +1 -1
- package/lib/components/Pagination/Options.js +1 -1
- package/lib/components/Popover/Popover.d.ts +17 -13
- package/lib/components/Popover/Popover.js +1 -3
- package/lib/components/Popover/style/index.d.ts +1 -0
- package/lib/components/Popover/style/index.js +1 -1
- package/lib/components/Select/style/index.d.ts +6 -6
- package/lib/components/SvgIcon/SvgIcon.d.ts +1 -0
- package/lib/components/SvgIcon/SvgIcon.js +6 -0
- package/lib/components/SvgIcon/SvgIconWrap.d.ts +1 -0
- package/lib/components/SvgIcon/icons/DoubleArrowLeft.d.ts +3 -0
- package/lib/components/SvgIcon/icons/DoubleArrowLeft.js +27 -0
- package/lib/components/SvgIcon/icons/DoubleArrowRight.d.ts +3 -0
- package/lib/components/SvgIcon/icons/DoubleArrowRight.js +26 -0
- package/lib/components/Switch/style/index.js +2 -2
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tabs/style/index.d.ts +1 -1
- package/lib/components/Tag/Group.d.ts +1 -0
- package/lib/components/Tag/Icon.d.ts +1 -0
- package/lib/components/Tag/Tag.d.ts +1 -0
- package/lib/components/Textarea/Textarea.d.ts +1 -0
- package/lib/components/ThemeProvider/ThemeProvider.d.ts +6 -0
- package/lib/components/ThemeProvider/dark.js +6 -249
- package/lib/components/ThemeProvider/designTokens.d.ts +267 -258
- package/lib/components/ThemeProvider/designTokens.js +460 -185
- package/lib/components/ThemeProvider/designTokensDark.d.ts +267 -0
- package/lib/components/ThemeProvider/designTokensDark.js +540 -0
- package/lib/components/ThemeProvider/theme.d.ts +1 -1
- package/lib/components/ThemeProvider/theme.js +3 -3
- package/lib/components/TimePicker/TimePicker.d.ts +1 -1
- package/lib/components/TimePicker/TimePicker.js +11 -13
- package/lib/components/TimePicker/style/index.d.ts +3 -1
- package/lib/components/TimePicker/style/index.js +11 -21
- package/lib/hooks/usePopoverConfig.d.ts +4 -4
- package/lib/libs/dom-align/adjustForViewport.js +55 -0
- package/lib/libs/dom-align/align/align.js +244 -0
- package/lib/libs/dom-align/align/alignElement.js +34 -0
- package/lib/libs/dom-align/align/alignPoint.js +67 -0
- package/lib/libs/dom-align/getAlignOffset.js +38 -0
- package/lib/libs/dom-align/getElFuturePos.js +23 -0
- package/lib/libs/dom-align/getOffsetParent.js +63 -0
- package/lib/libs/dom-align/getRegion.js +38 -0
- package/lib/libs/dom-align/getVisibleRectForElement.js +118 -0
- package/lib/libs/dom-align/index.js +27 -0
- package/lib/libs/dom-align/isAncestorFixed.js +34 -0
- package/lib/libs/dom-align/propertyUtils.js +138 -0
- package/lib/libs/dom-align/utils.js +657 -0
- package/lib/libs/rc-align/index.d.ts +4 -0
- package/lib/libs/rc-align/index.js +15 -3
- package/lib/libs/rc-table/Table.d.ts +5 -0
- package/lib/libs/rc-table/TableCell.d.ts +1 -0
- package/lib/libs/rc-trigger/index.js +14 -0
- package/lib/libs/rc-trigger/src/LazyRenderBox.js +82 -0
- package/lib/libs/rc-trigger/src/Popup.js +383 -0
- package/lib/libs/rc-trigger/src/PopupInner.js +85 -0
- package/lib/libs/rc-trigger/src/index.js +867 -0
- package/lib/libs/rc-trigger/src/mock.js +33 -0
- package/lib/libs/rc-trigger/src/utils.js +48 -0
- package/lib/utils/KeyCode.d.ts +15 -0
- package/lib/{interfaces → utils}/KeyCode.js +0 -0
- package/package.json +4 -6
- package/lib/components/DatePicker/RangePicker.d.ts +0 -17
- package/lib/interfaces/KeyCode.d.ts +0 -15
- package/lib/style/color.js +0 -23
|
@@ -29,10 +29,14 @@ var _useUncontrolled3 = _interopRequireDefault(require("../../hooks/useUncontrol
|
|
|
29
29
|
|
|
30
30
|
var _usePopoverConfig = _interopRequireDefault(require("../../hooks/usePopoverConfig"));
|
|
31
31
|
|
|
32
|
+
var _KeyCode = _interopRequireDefault(require("../../utils/KeyCode"));
|
|
33
|
+
|
|
32
34
|
var _zh_CN = _interopRequireDefault(require("./locale/zh_CN"));
|
|
33
35
|
|
|
34
36
|
var _utils = require("./utils");
|
|
35
37
|
|
|
38
|
+
var _style = require("./style");
|
|
39
|
+
|
|
36
40
|
var _excluded = ["value", "defaultValue", "onChange", "rules", "disabled", "nullable", "display", "size", "popoverProps", "getCalendarContainer", "zIndex", "format", "locale", "status", "placeholder", "shortcuts", "type"];
|
|
37
41
|
|
|
38
42
|
var _this = void 0;
|
|
@@ -91,6 +95,17 @@ var getValidCurrentDate = function getValidCurrentDate(value, d, currentValue) {
|
|
|
91
95
|
});
|
|
92
96
|
}.bind(void 0);
|
|
93
97
|
|
|
98
|
+
var trigger = [];
|
|
99
|
+
var align = {
|
|
100
|
+
points: ['tl', 'bl'],
|
|
101
|
+
overflow: {
|
|
102
|
+
adjustX: 0,
|
|
103
|
+
adjustY: 1
|
|
104
|
+
},
|
|
105
|
+
offset: [0, 10],
|
|
106
|
+
targetOffset: [0, 0]
|
|
107
|
+
};
|
|
108
|
+
|
|
94
109
|
var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
95
110
|
var _this2 = this;
|
|
96
111
|
|
|
@@ -143,6 +158,7 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
|
143
158
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
144
159
|
return new Date();
|
|
145
160
|
}.bind(this), []);
|
|
161
|
+
var clickConfirm = !(timeMode !== null && timeMode !== void 0 && timeMode.length);
|
|
146
162
|
|
|
147
163
|
var _useUncontrolled = (0, _useUncontrolled3.default)(_value, defaultValue, _onChange),
|
|
148
164
|
_useUncontrolled2 = (0, _slicedToArray2.default)(_useUncontrolled, 2),
|
|
@@ -187,15 +203,10 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
|
187
203
|
visible = _useState12[0],
|
|
188
204
|
setVisible = _useState12[1];
|
|
189
205
|
|
|
190
|
-
var _useState13 = (0, _react.useState)(false),
|
|
191
|
-
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
192
|
-
active = _useState14[0],
|
|
193
|
-
setActive = _useState14[1];
|
|
194
|
-
|
|
195
206
|
var locale = (0, _useLocale.default)(_zh_CN.default, 'DatePicker', _locale);
|
|
196
207
|
(0, _react.useEffect)(function () {
|
|
197
208
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
198
|
-
if (
|
|
209
|
+
if (visible) return;
|
|
199
210
|
|
|
200
211
|
if (!value) {
|
|
201
212
|
if (nullable) {
|
|
@@ -206,7 +217,7 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
|
206
217
|
} else {
|
|
207
218
|
setInputValue(formatDate((0, _moment.default)(+value), format));
|
|
208
219
|
}
|
|
209
|
-
}.bind(this), [
|
|
220
|
+
}.bind(this), [visible, d, format, nullable, value]);
|
|
210
221
|
var error = (0, _react.useMemo)(function () {
|
|
211
222
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
212
223
|
var currentValue;
|
|
@@ -243,42 +254,79 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
|
243
254
|
|
|
244
255
|
setUseInputValue(true);
|
|
245
256
|
}.bind(this), [allFormat, calValue, visible]);
|
|
257
|
+
var clear = (0, _react.useCallback)(function () {
|
|
258
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
259
|
+
setInputValue('');
|
|
260
|
+
setCalValue(null);
|
|
261
|
+
}.bind(this), []);
|
|
262
|
+
var handleConfirm = (0, _react.useCallback)(function (v) {
|
|
263
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
264
|
+
var currentValue = v !== undefined ? v : calValue;
|
|
265
|
+
|
|
266
|
+
if (!currentValue) {
|
|
267
|
+
if (!nullable) return;
|
|
268
|
+
} else if ((0, _utils.isDateDisabled)(+currentValue, value, rules)) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
onChange && onChange(currentValue ? (0, _moment.default)(+currentValue) : null);
|
|
273
|
+
setVisible(false);
|
|
274
|
+
}.bind(this), [calValue, nullable, onChange, rules, value]);
|
|
275
|
+
var handleInputClear = (0, _react.useCallback)(function () {
|
|
276
|
+
var _this3 = this;
|
|
277
|
+
|
|
278
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
279
|
+
setTimeout(function () {
|
|
280
|
+
(0, _newArrowCheck2.default)(this, _this3);
|
|
281
|
+
handleInputChange({
|
|
282
|
+
target: {
|
|
283
|
+
value: ''
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}.bind(this), 0);
|
|
287
|
+
}.bind(this), [handleInputChange]);
|
|
246
288
|
var handleCalendarChange = (0, _react.useCallback)(function (v) {
|
|
247
289
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
248
290
|
v = (0, _utils.getValidDate)(v, rules);
|
|
249
291
|
setCalValue((0, _moment.default)(+v));
|
|
250
292
|
setInputValue(formatDate((0, _moment.default)(+v), format));
|
|
251
293
|
setUseInputValue(false);
|
|
252
|
-
|
|
294
|
+
|
|
295
|
+
if (clickConfirm) {
|
|
296
|
+
onChange && onChange((0, _moment.default)(+v));
|
|
297
|
+
setVisible(false);
|
|
298
|
+
}
|
|
299
|
+
}.bind(this), [clickConfirm, format, onChange, rules]);
|
|
253
300
|
var handleInputFocus = (0, _react.useCallback)(function () {
|
|
254
|
-
var
|
|
301
|
+
var _this4 = this;
|
|
255
302
|
|
|
256
303
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
257
304
|
setCalValue(value == null ? null : value);
|
|
258
305
|
setCalCurrentValue(function (currentValue) {
|
|
259
|
-
(0, _newArrowCheck2.default)(this,
|
|
306
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
260
307
|
return getValidCurrentDate(value, d, currentValue);
|
|
261
308
|
}.bind(this));
|
|
262
309
|
setUseInputValue(true);
|
|
263
|
-
|
|
310
|
+
setVisible(true);
|
|
264
311
|
}.bind(this), [d, value]);
|
|
265
312
|
var handleInputBlur = (0, _react.useCallback)(function () {
|
|
266
313
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
267
|
-
|
|
314
|
+
setVisible(false);
|
|
268
315
|
}.bind(this), []);
|
|
269
|
-
var
|
|
316
|
+
var handleInputClick = (0, _react.useCallback)(function () {
|
|
317
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
318
|
+
setVisible(true);
|
|
319
|
+
}.bind(this), []);
|
|
320
|
+
var handleInputMouseDown = handleInputClick;
|
|
321
|
+
var handleInputDown = (0, _react.useCallback)(function (e) {
|
|
270
322
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
271
|
-
var currentValue = v != null ? v : calValue;
|
|
272
323
|
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
324
|
+
if (e.keyCode === _KeyCode.default.ENTER) {
|
|
325
|
+
handleConfirm();
|
|
326
|
+
e.preventDefault();
|
|
327
|
+
e.stopPropagation();
|
|
277
328
|
}
|
|
278
|
-
|
|
279
|
-
onChange && onChange(currentValue ? (0, _moment.default)(+currentValue) : null);
|
|
280
|
-
setVisible(false);
|
|
281
|
-
}.bind(this), [calValue, nullable, onChange, rules, value]);
|
|
329
|
+
}.bind(this), [handleConfirm]);
|
|
282
330
|
var handleShortcut = (0, _react.useCallback)(function (v) {
|
|
283
331
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
284
332
|
handleCalendarChange(v);
|
|
@@ -292,14 +340,23 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
|
292
340
|
var inputProps = {
|
|
293
341
|
value: inputValue,
|
|
294
342
|
onChange: handleInputChange,
|
|
295
|
-
onBlur: handleInputBlur,
|
|
296
343
|
onFocus: handleInputFocus,
|
|
344
|
+
onBlur: handleInputBlur,
|
|
345
|
+
onKeyDown: handleInputDown,
|
|
346
|
+
onClick: handleInputClick,
|
|
347
|
+
onMouseDown: handleInputMouseDown,
|
|
297
348
|
disabled: disabled,
|
|
298
349
|
size: size,
|
|
299
350
|
status: status,
|
|
300
|
-
placeholder: placeholder === undefined ? locale.placeholder : placeholder
|
|
351
|
+
placeholder: placeholder === undefined ? locale.placeholder : placeholder,
|
|
352
|
+
clearable: nullable,
|
|
353
|
+
onClear: handleInputClear
|
|
301
354
|
};
|
|
302
|
-
|
|
355
|
+
|
|
356
|
+
var containerProps = _objectSpread(_objectSpread({}, rest), {}, {
|
|
357
|
+
disabled: disabled,
|
|
358
|
+
status: status
|
|
359
|
+
});
|
|
303
360
|
|
|
304
361
|
var _popoverProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
305
362
|
zIndex: zIndex,
|
|
@@ -307,11 +364,10 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
|
307
364
|
}, popoverConfigProps), popoverProps), getCalendarContainer ? {
|
|
308
365
|
getPopupContainer: getCalendarContainer
|
|
309
366
|
} : {}), {}, {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
hideAction: ['blur'],
|
|
367
|
+
popupClassName: _style.datePickerPopupCls,
|
|
368
|
+
trigger: trigger,
|
|
313
369
|
visible: visible,
|
|
314
|
-
|
|
370
|
+
align: align
|
|
315
371
|
});
|
|
316
372
|
|
|
317
373
|
var popupProps = {
|
|
@@ -338,11 +394,14 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode) {
|
|
|
338
394
|
confirmAble: error === true,
|
|
339
395
|
onConfirm: handleConfirm,
|
|
340
396
|
locale: _locale,
|
|
341
|
-
shortcuts: shortcuts
|
|
397
|
+
shortcuts: shortcuts,
|
|
398
|
+
showConfirm: !clickConfirm
|
|
342
399
|
};
|
|
343
400
|
return [inputProps, containerProps, _popoverProps, popupProps, calendarProps, timeProps, footerProps, {
|
|
344
401
|
error: typeof error === 'string' ? error : null,
|
|
345
|
-
active:
|
|
402
|
+
active: visible
|
|
403
|
+
}, {
|
|
404
|
+
clear: clear
|
|
346
405
|
}];
|
|
347
406
|
}.bind(void 0);
|
|
348
407
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode, MutableRefObject } from 'react';
|
|
2
|
+
import { DatePickerProps } from './DatePicker';
|
|
3
|
+
export declare type RangeActionRef = {
|
|
4
|
+
clear: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare type RangePickerRef = {
|
|
7
|
+
focus: () => void;
|
|
8
|
+
clear: () => void;
|
|
9
|
+
} | undefined;
|
|
10
|
+
declare const useRangePicker: ({ prefix, type, suffix, actionRef, ...pickProps }: DatePickerProps & {
|
|
11
|
+
prefix?: boolean | undefined;
|
|
12
|
+
type?: "date" | "month" | undefined;
|
|
13
|
+
suffix?: ReactNode;
|
|
14
|
+
actionRef: MutableRefObject<RangeActionRef | undefined>;
|
|
15
|
+
}) => any[];
|
|
16
|
+
export default useRangePicker;
|
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
13
|
|
|
16
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -21,31 +19,17 @@ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/new
|
|
|
21
19
|
|
|
22
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
21
|
|
|
24
|
-
var _Popover = _interopRequireDefault(require("../../components/Popover"));
|
|
25
|
-
|
|
26
|
-
var _Input = _interopRequireDefault(require("../../components/Input"));
|
|
27
|
-
|
|
28
|
-
var _Calendar = _interopRequireDefault(require("../../components/Calendar"));
|
|
29
|
-
|
|
30
|
-
var _Notice = _interopRequireDefault(require("../../components/Notice"));
|
|
31
|
-
|
|
32
|
-
var _Time = _interopRequireDefault(require("../../components/TimePicker/Time"));
|
|
33
|
-
|
|
34
22
|
var _SvgIcon = _interopRequireDefault(require("../../components/SvgIcon"));
|
|
35
23
|
|
|
36
|
-
var
|
|
24
|
+
var _Time = _interopRequireDefault(require("../../components/TimePicker/Time"));
|
|
37
25
|
|
|
38
26
|
var _DatePicker = require("./DatePicker");
|
|
39
27
|
|
|
40
28
|
var _Month = require("./Month");
|
|
41
29
|
|
|
42
|
-
var _style = require("./style");
|
|
43
|
-
|
|
44
30
|
var _usePicker3 = _interopRequireDefault(require("./usePicker"));
|
|
45
31
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
var _excluded = ["prefix", "onActiveChange", "type", "readonly", "tip", "error", "footerTip"];
|
|
32
|
+
var _excluded = ["prefix", "type", "suffix", "actionRef"];
|
|
49
33
|
|
|
50
34
|
var _this = void 0;
|
|
51
35
|
|
|
@@ -57,89 +41,69 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
57
41
|
|
|
58
42
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
59
43
|
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
var inputCustomStyle = {
|
|
45
|
+
border: 'none',
|
|
46
|
+
boxShadow: 'none',
|
|
47
|
+
background: 'none'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var useRangePicker = function useRangePicker(_ref) {
|
|
51
|
+
var _timeProps$mode,
|
|
52
|
+
_this2 = this;
|
|
63
53
|
|
|
64
54
|
(0, _newArrowCheck2.default)(this, _this);
|
|
65
55
|
var prefix = _ref.prefix,
|
|
66
|
-
onActiveChange = _ref.onActiveChange,
|
|
67
56
|
_ref$type = _ref.type,
|
|
68
57
|
type = _ref$type === void 0 ? 'date' : _ref$type,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
error = _ref.error,
|
|
72
|
-
footerTip = _ref.footerTip,
|
|
58
|
+
suffix = _ref.suffix,
|
|
59
|
+
actionRef = _ref.actionRef,
|
|
73
60
|
pickProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
74
61
|
var isMonth = type === 'month';
|
|
75
62
|
|
|
76
63
|
var _usePicker = (0, _usePicker3.default)(_objectSpread({}, pickProps), isMonth ? _Month.displayToFormatAndTimeMode : _DatePicker.displayToFormatAndTimeMode, type),
|
|
77
|
-
_usePicker2 = (0, _slicedToArray2.default)(_usePicker,
|
|
64
|
+
_usePicker2 = (0, _slicedToArray2.default)(_usePicker, 9),
|
|
78
65
|
inputProps = _usePicker2[0],
|
|
79
66
|
popoverProps = _usePicker2[2],
|
|
80
67
|
popupProps = _usePicker2[3],
|
|
81
68
|
calendarProps = _usePicker2[4],
|
|
82
69
|
timeProps = _usePicker2[5],
|
|
83
70
|
footerProps = _usePicker2[6],
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
active = _usePicker2$.active;
|
|
87
|
-
|
|
88
|
-
var inputRef = /*#__PURE__*/(0, _react.createRef)();
|
|
89
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
90
|
-
var _this3 = this;
|
|
71
|
+
status = _usePicker2[7],
|
|
72
|
+
actions = _usePicker2[8];
|
|
91
73
|
|
|
74
|
+
var hasTime = !!((_timeProps$mode = timeProps.mode) !== null && _timeProps$mode !== void 0 && _timeProps$mode.length);
|
|
75
|
+
(0, _react.useImperativeHandle)(actionRef, function () {
|
|
92
76
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
93
77
|
return {
|
|
94
|
-
|
|
95
|
-
var _inputRef$current;
|
|
96
|
-
|
|
97
|
-
(0, _newArrowCheck2.default)(this, _this3);
|
|
98
|
-
return inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
99
|
-
}.bind(this)
|
|
78
|
+
clear: actions.clear
|
|
100
79
|
};
|
|
101
|
-
}.bind(this), [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}.bind(this), [active, onActiveChange]);
|
|
106
|
-
var popoverConfigProps = (0, _usePopoverConfig.default)();
|
|
107
|
-
var hasTime = !!((_timeProps$mode = timeProps.mode) !== null && _timeProps$mode !== void 0 && _timeProps$mode.length);
|
|
108
|
-
var CalendarComp = isMonth ? _Calendar.default.Month : _Calendar.default;
|
|
109
|
-
return readonly ? /*#__PURE__*/_react.default.createElement("span", {
|
|
110
|
-
className: _style.readonlyInputCls
|
|
111
|
-
}, inputProps.value) : /*#__PURE__*/_react.default.createElement(_style.RangeInputWrap, {
|
|
112
|
-
isMonth: isMonth,
|
|
113
|
-
hasTime: hasTime,
|
|
114
|
-
hasPrefix: prefix
|
|
115
|
-
}, /*#__PURE__*/_react.default.createElement(_Popover.default, (0, _extends2.default)({
|
|
116
|
-
popup: /*#__PURE__*/_react.default.createElement(_style.SPopup, popupProps, /*#__PURE__*/_react.default.createElement(CalendarComp, (0, _extends2.default)({}, calendarProps, {
|
|
117
|
-
sidebar: isMonth ? null : hasTime ? /*#__PURE__*/_react.default.createElement(_Time.default, timeProps) : null
|
|
118
|
-
})), pickerError && /*#__PURE__*/_react.default.createElement(_Notice.default, {
|
|
119
|
-
styleType: "error",
|
|
120
|
-
closable: false
|
|
121
|
-
}, pickerError), error && /*#__PURE__*/_react.default.createElement(_Notice.default, {
|
|
122
|
-
styleType: "error",
|
|
123
|
-
closable: false
|
|
124
|
-
}, error), tip && /*#__PURE__*/_react.default.createElement(_Notice.default, {
|
|
125
|
-
closable: false
|
|
126
|
-
}, tip), /*#__PURE__*/_react.default.createElement(_Footer.default, (0, _extends2.default)({}, footerProps, {
|
|
127
|
-
tip: footerTip
|
|
128
|
-
})))
|
|
129
|
-
}, popoverConfigProps, popoverProps), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, inputProps, {
|
|
130
|
-
customStyle: {
|
|
131
|
-
border: 'none',
|
|
132
|
-
boxShadow: 'none',
|
|
133
|
-
background: 'none'
|
|
134
|
-
},
|
|
135
|
-
ref: inputRef,
|
|
80
|
+
}.bind(this), [actions.clear]);
|
|
81
|
+
return [// inputProps
|
|
82
|
+
_objectSpread(_objectSpread({}, inputProps), {}, {
|
|
83
|
+
customStyle: inputCustomStyle,
|
|
136
84
|
block: true,
|
|
137
85
|
prefix: prefix ? /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
138
86
|
type: "calendar"
|
|
139
|
-
}) : null
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
87
|
+
}) : null,
|
|
88
|
+
suffix: suffix
|
|
89
|
+
}), // inputWrapProps
|
|
90
|
+
{
|
|
91
|
+
isMonth: isMonth,
|
|
92
|
+
hasTime: hasTime,
|
|
93
|
+
hasPrefix: prefix,
|
|
94
|
+
hasSuffix: !!suffix,
|
|
95
|
+
disabled: inputProps.disabled,
|
|
96
|
+
status: inputProps.status,
|
|
97
|
+
clearable: inputProps.clearable
|
|
98
|
+
}, // calendarProps
|
|
99
|
+
_objectSpread(_objectSpread({}, calendarProps), {}, {
|
|
100
|
+
sidebar: isMonth ? null : hasTime ? /*#__PURE__*/_react.default.createElement(_Time.default, timeProps) : null
|
|
101
|
+
}), footerProps, status, popoverProps, // popupProps
|
|
102
|
+
popupProps, {
|
|
103
|
+
hasTime: hasTime,
|
|
104
|
+
isMonth: isMonth
|
|
105
|
+
}];
|
|
106
|
+
}.bind(void 0);
|
|
144
107
|
|
|
108
|
+
var _default = useRangePicker;
|
|
145
109
|
exports.default = _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Moment } from 'moment';
|
|
2
|
-
import { TDate } from '@z-r/calendar
|
|
2
|
+
import { TDate } from '@z-r/calendar';
|
|
3
3
|
import { isDateDisabled, getValidDate } from '../../components/Calendar/utils';
|
|
4
4
|
declare type Range = [TDate | void | null, TDate | void | null];
|
|
5
5
|
declare type Precision = 'second' | 'minute' | 'hour' | 'date' | 'month' | 'year';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const ControllerContext: React.Context<{
|
|
3
|
-
status?: "
|
|
3
|
+
status?: "loading" | "default" | "success" | "warning" | "error" | undefined;
|
|
4
4
|
}>;
|
|
5
5
|
export default ControllerContext;
|
|
@@ -198,14 +198,16 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
198
198
|
onMouseDown: handleWrapMouseDown
|
|
199
199
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
200
200
|
className: _style.inputWrapCls
|
|
201
|
-
}, renderPrefix, /*#__PURE__*/_react.default.createElement("
|
|
201
|
+
}, renderPrefix, /*#__PURE__*/_react.default.createElement("span", {
|
|
202
|
+
className: _style.inputBlockWrapCls
|
|
203
|
+
}, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, rest, {
|
|
202
204
|
value: value,
|
|
203
205
|
onChange: onChange,
|
|
204
206
|
ref: inputRef,
|
|
205
207
|
onFocus: handleFocus,
|
|
206
208
|
onBlur: handleBlur,
|
|
207
209
|
disabled: disabled
|
|
208
|
-
})), renderClear, renderSuffix));
|
|
210
|
+
})), renderClear), renderSuffix));
|
|
209
211
|
}.bind(void 0));
|
|
210
212
|
|
|
211
213
|
var _default = /*#__PURE__*/_react.default.memo(Input);
|
|
@@ -17,7 +17,7 @@ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/new
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
-
var _KeyCode = _interopRequireDefault(require("../../
|
|
20
|
+
var _KeyCode = _interopRequireDefault(require("../../utils/KeyCode"));
|
|
21
21
|
|
|
22
22
|
var _noop = _interopRequireDefault(require("../../utils/noop"));
|
|
23
23
|
|
|
@@ -9,8 +9,9 @@ export declare const inputWrapCls: string;
|
|
|
9
9
|
export declare const inputPrefixCls: string;
|
|
10
10
|
export declare const inputSuffixCls: string;
|
|
11
11
|
export declare const clearCls: string;
|
|
12
|
+
export declare const inputBlockWrapCls: string;
|
|
12
13
|
export declare const SearchIcon: import("@emotion/styled-base").StyledComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<SvgIcon>, Pick<Pick<any, string | number | symbol> & import("react").RefAttributes<SvgIcon>, string | number | symbol>, object>;
|
|
13
|
-
export declare const SWrap: import("react").ForwardRefExoticComponent<Pick<InputProps, "
|
|
14
|
+
export declare const SWrap: import("react").ForwardRefExoticComponent<Pick<InputProps, "customStyle" | "disabled" | "status"> & Required<Pick<InputProps, "size">> & {
|
|
14
15
|
focused: boolean;
|
|
15
16
|
empty: boolean;
|
|
16
17
|
} & import("react").HTMLAttributes<HTMLSpanElement> & {
|