@ucloud-fe/react-components 1.4.0 → 1.4.3
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 +18 -0
- package/dist/main.min.js +2 -2
- package/lib/components/Calendar/style/index.js +5 -5
- package/lib/components/DatePicker/Footer.d.ts +2 -1
- package/lib/components/DatePicker/Footer.js +3 -3
- package/lib/components/DatePicker/Range.js +24 -2
- package/lib/components/DatePicker/style/index.d.ts +6 -6
- package/lib/components/DatePicker/style/index.js +18 -33
- package/lib/components/DatePicker/usePicker.js +9 -14
- package/lib/components/Input/Input.d.ts +4 -1
- package/lib/components/Input/Input.js +11 -5
- package/lib/components/Input/style/index.js +7 -3
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ declare type Mode = 'date' | 'month';
|
|
|
10
10
|
export declare const TipIcon: React.NamedExoticComponent<object>;
|
|
11
11
|
interface FooterProps {
|
|
12
12
|
mode: Mode;
|
|
13
|
+
confirmAble: boolean;
|
|
13
14
|
onConfirm: () => void;
|
|
14
15
|
shortcuts?: TShortcut[] | null;
|
|
15
16
|
onShortcut: (d: TDate) => void;
|
|
@@ -18,5 +19,5 @@ interface FooterProps {
|
|
|
18
19
|
locale?: typeof LOCALE;
|
|
19
20
|
showConfirm?: boolean;
|
|
20
21
|
}
|
|
21
|
-
declare const _default: React.MemoExoticComponent<({ isError, onConfirm, shortcuts, onShortcut, tip, showConfirm, locale: _locale }: FooterProps) => JSX.Element | null>;
|
|
22
|
+
declare const _default: React.MemoExoticComponent<({ isError, confirmAble, onConfirm, shortcuts, onShortcut, tip, showConfirm, locale: _locale }: FooterProps) => JSX.Element | null>;
|
|
22
23
|
export default _default;
|
|
@@ -42,13 +42,12 @@ var TipIcon = /*#__PURE__*/_react.default.memo(function TipIcon() {
|
|
|
42
42
|
|
|
43
43
|
exports.TipIcon = TipIcon;
|
|
44
44
|
|
|
45
|
-
// deprecated shortcuts for UX
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
45
|
var Footer = function Footer(_ref) {
|
|
48
46
|
var _this2 = this;
|
|
49
47
|
|
|
50
48
|
(0, _newArrowCheck2.default)(this, _this);
|
|
51
49
|
var isError = _ref.isError,
|
|
50
|
+
confirmAble = _ref.confirmAble,
|
|
52
51
|
onConfirm = _ref.onConfirm,
|
|
53
52
|
shortcuts = _ref.shortcuts,
|
|
54
53
|
onShortcut = _ref.onShortcut,
|
|
@@ -71,13 +70,14 @@ var Footer = function Footer(_ref) {
|
|
|
71
70
|
}, /*#__PURE__*/_react.default.createElement(TipIcon, null), /*#__PURE__*/_react.default.createElement("span", null, tip)) : /*#__PURE__*/_react.default.createElement("span", null), showConfirm && /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
72
71
|
styleType: "primary",
|
|
73
72
|
size: "sm",
|
|
74
|
-
disabled:
|
|
73
|
+
disabled: !confirmAble,
|
|
75
74
|
onClick: handleConfirm
|
|
76
75
|
}, locale.confirm));
|
|
77
76
|
}.bind(void 0);
|
|
78
77
|
|
|
79
78
|
Footer.propTypes = {
|
|
80
79
|
mode: _propTypes.default.oneOf(['date', 'month']).isRequired,
|
|
80
|
+
confirmAble: _propTypes.default.bool.isRequired,
|
|
81
81
|
onConfirm: _propTypes.default.func.isRequired,
|
|
82
82
|
shortcuts: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.shape({
|
|
83
83
|
handle: _propTypes.default.func.isRequired,
|
|
@@ -214,6 +214,13 @@ var Range = function Range(_ref2) {
|
|
|
214
214
|
shortcutsS = _ref6[0],
|
|
215
215
|
shortcutsE = _ref6[1];
|
|
216
216
|
|
|
217
|
+
var startRangeInputRef = (0, _react.useRef)(null);
|
|
218
|
+
|
|
219
|
+
var _useState7 = (0, _react.useState)(200),
|
|
220
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
221
|
+
startRangeInputWidth = _useState8[0],
|
|
222
|
+
setStartRangeInputWidth = _useState8[1];
|
|
223
|
+
|
|
217
224
|
(0, _useDidMount.default)(function () {
|
|
218
225
|
(0, _newArrowCheck2.default)(this, _this3);
|
|
219
226
|
|
|
@@ -401,6 +408,15 @@ var Range = function Range(_ref2) {
|
|
|
401
408
|
}.bind(this));
|
|
402
409
|
}
|
|
403
410
|
}.bind(this), [activeE, activeS]);
|
|
411
|
+
(0, _react.useEffect)(function () {
|
|
412
|
+
(0, _newArrowCheck2.default)(this, _this3);
|
|
413
|
+
|
|
414
|
+
if (activeE) {
|
|
415
|
+
var _startRangeInputRef$c;
|
|
416
|
+
|
|
417
|
+
setStartRangeInputWidth(((_startRangeInputRef$c = startRangeInputRef.current) === null || _startRangeInputRef$c === void 0 ? void 0 : _startRangeInputRef$c.offsetWidth) || 200);
|
|
418
|
+
}
|
|
419
|
+
}.bind(this), [activeE]);
|
|
404
420
|
var CalendarComp = isMonth ? _Calendar.default.Month : hasTime ? _Calendar.default : _Calendar.TwoSide;
|
|
405
421
|
return /*#__PURE__*/_react.default.createElement(_style.RangeContainer, (0, _extends2.default)({}, rest, {
|
|
406
422
|
disabled: disabled
|
|
@@ -417,7 +433,11 @@ var Range = function Range(_ref2) {
|
|
|
417
433
|
visible: activeS || activeE,
|
|
418
434
|
popup: /*#__PURE__*/_react.default.createElement(_style.SPopup, (0, _extends2.default)({}, popupProps, {
|
|
419
435
|
endInputHighlight: activeE
|
|
420
|
-
}
|
|
436
|
+
}), /*#__PURE__*/_react.default.createElement(_style.Arrow, {
|
|
437
|
+
style: {
|
|
438
|
+
left: activeE ? startRangeInputWidth + 'px' : '20px'
|
|
439
|
+
}
|
|
440
|
+
}), /*#__PURE__*/_react.default.createElement(_style.RangeCalendarWrap, {
|
|
421
441
|
visible: activeS
|
|
422
442
|
}, /*#__PURE__*/_react.default.createElement(CalendarComp, (0, _extends2.default)({}, calendarPropsS, {
|
|
423
443
|
rangeValue: [calendarPropsS.value, cacheValue === null || cacheValue === void 0 ? void 0 : cacheValue[1]],
|
|
@@ -443,7 +463,9 @@ var Range = function Range(_ref2) {
|
|
|
443
463
|
status: status || contextStatus
|
|
444
464
|
}, readonly ? /*#__PURE__*/_react.default.createElement("span", {
|
|
445
465
|
className: _style.readonlyInputCls
|
|
446
|
-
}, inputPropsS.value) : /*#__PURE__*/_react.default.createElement(_style.RangeInputWrap,
|
|
466
|
+
}, inputPropsS.value) : /*#__PURE__*/_react.default.createElement(_style.RangeInputWrap, (0, _extends2.default)({}, inputWrapPropsS, {
|
|
467
|
+
ref: startRangeInputRef
|
|
468
|
+
}), /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({}, inputPropsS, {
|
|
447
469
|
ref: inputRefS
|
|
448
470
|
}))), readonly ? /*#__PURE__*/_react.default.createElement("span", {
|
|
449
471
|
className: _style.readonlyInputCls
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { InputProps } from '../../../components/Input';
|
|
3
|
-
import {
|
|
3
|
+
import { Size } from '../../../style';
|
|
4
4
|
export declare const prefixCls: string;
|
|
5
5
|
export declare const dateSeparatorCls: string;
|
|
6
6
|
export declare const shortcutCls: string;
|
|
@@ -17,7 +17,7 @@ export declare const PickerContainer: import("react").ForwardRefExoticComponent<
|
|
|
17
17
|
hasTime?: boolean | undefined;
|
|
18
18
|
status?: InputProps['status'];
|
|
19
19
|
} & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
20
|
-
theme?: Theme | undefined;
|
|
20
|
+
theme?: import("../../../style").Theme | undefined;
|
|
21
21
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
22
|
export declare const SPopup: import("react").ForwardRefExoticComponent<{
|
|
23
23
|
endInputHighlight: boolean;
|
|
@@ -27,7 +27,7 @@ export declare const SPopup: import("react").ForwardRefExoticComponent<{
|
|
|
27
27
|
hasSuffix?: boolean | undefined;
|
|
28
28
|
clearable?: boolean | undefined;
|
|
29
29
|
} & import("react").HTMLAttributes<HTMLElement> & {
|
|
30
|
-
theme?: Theme | undefined;
|
|
30
|
+
theme?: import("../../../style").Theme | undefined;
|
|
31
31
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
32
32
|
export declare const SRangeInputWrap: import("react").ForwardRefExoticComponent<{
|
|
33
33
|
size: Size;
|
|
@@ -36,12 +36,12 @@ export declare const SRangeInputWrap: import("react").ForwardRefExoticComponent<
|
|
|
36
36
|
readonly?: boolean | undefined;
|
|
37
37
|
status?: string | undefined;
|
|
38
38
|
} & import("react").HTMLAttributes<HTMLElement> & {
|
|
39
|
-
theme?: Theme | undefined;
|
|
39
|
+
theme?: import("../../../style").Theme | undefined;
|
|
40
40
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
41
41
|
export declare const RangeContainer: import("react").ForwardRefExoticComponent<{
|
|
42
42
|
disabled?: boolean | undefined;
|
|
43
43
|
} & import("react").HTMLAttributes<HTMLElement> & {
|
|
44
|
-
theme?: Theme | undefined;
|
|
44
|
+
theme?: import("../../../style").Theme | undefined;
|
|
45
45
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
46
46
|
export declare const RangeInputWrap: import("react").ForwardRefExoticComponent<{
|
|
47
47
|
isMonth?: boolean | undefined;
|
|
@@ -53,7 +53,7 @@ export declare const RangeInputWrap: import("react").ForwardRefExoticComponent<{
|
|
|
53
53
|
status?: InputProps['status'];
|
|
54
54
|
isEnd?: boolean | undefined;
|
|
55
55
|
} & import("react").HTMLAttributes<HTMLElement> & {
|
|
56
|
-
theme?: Theme | undefined;
|
|
56
|
+
theme?: import("../../../style").Theme | undefined;
|
|
57
57
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
58
58
|
export declare const RangeSelect: import("@emotion/styled-base").StyledComponent<import("../../Select/Select").SelectProps & Omit<import("react").HTMLAttributes<HTMLDivElement>, keyof import("../../Select/Select").SelectProps>, Pick<import("../../Select/Select").SelectProps & Omit<import("react").HTMLAttributes<HTMLDivElement>, keyof import("../../Select/Select").SelectProps>, "className" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | keyof import("../../Select/Select").SelectProps>, object>;
|
|
59
59
|
export declare const Arrow: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, Pick<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, keyof import("react").HTMLAttributes<HTMLSpanElement>>, object>;
|