rsuite 5.53.2 → 5.55.0
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/AutoComplete/styles/index.css +0 -2
- package/CHANGELOG.md +36 -0
- package/Cascader/styles/index.css +0 -2
- package/CheckPicker/styles/index.css +0 -2
- package/CheckTree/styles/index.css +0 -2
- package/CheckTreePicker/styles/index.css +0 -2
- package/DatePicker/styles/index.css +0 -2
- package/DateRangePicker/styles/index.css +0 -2
- package/FormGroup/styles/index.css +3 -0
- package/FormGroup/styles/index.less +2 -0
- package/InlineEdit/package.json +7 -0
- package/InlineEdit/styles/index.css +112 -0
- package/InlineEdit/styles/index.less +48 -0
- package/InputGroup/styles/index.css +0 -2
- package/InputGroup/styles/index.less +0 -2
- package/InputNumber/styles/index.css +0 -2
- package/InputPicker/styles/index.css +0 -2
- package/MultiCascader/styles/index.css +0 -2
- package/Pagination/styles/index.css +3 -2
- package/Pagination/styles/pagination-group.less +4 -0
- package/SelectPicker/styles/index.css +0 -2
- package/TagInput/styles/index.css +1 -4
- package/TagPicker/styles/index.css +1 -4
- package/TagPicker/styles/index.less +1 -2
- package/cjs/Calendar/CalendarContainer.d.ts +4 -0
- package/cjs/Calendar/CalendarContainer.js +3 -1
- package/cjs/Calendar/TableCell.js +3 -2
- package/cjs/Calendar/types.d.ts +1 -0
- package/cjs/Cascader/DropdownMenu.js +3 -1
- package/cjs/Cascader/TreeView.js +3 -1
- package/cjs/DOMHelper/index.d.ts +23 -32
- package/cjs/DatePicker/DatePicker.d.ts +6 -0
- package/cjs/DatePicker/DatePicker.js +4 -3
- package/cjs/DateRangePicker/DateRangePicker.js +8 -2
- package/cjs/InlineEdit/EditableControls.d.ts +8 -0
- package/cjs/InlineEdit/EditableControls.js +34 -0
- package/cjs/InlineEdit/InlineEdit.d.ts +56 -0
- package/cjs/InlineEdit/InlineEdit.js +98 -0
- package/cjs/InlineEdit/index.d.ts +3 -0
- package/cjs/InlineEdit/index.js +9 -0
- package/cjs/InlineEdit/renderChildren.d.ts +12 -0
- package/cjs/InlineEdit/renderChildren.js +40 -0
- package/cjs/InlineEdit/useEditState.d.ts +22 -0
- package/cjs/InlineEdit/useEditState.js +82 -0
- package/cjs/InlineEdit/useFocusEvent.d.ts +14 -0
- package/cjs/InlineEdit/useFocusEvent.js +61 -0
- package/cjs/Input/Input.js +6 -3
- package/cjs/InputNumber/InputNumber.d.ts +36 -11
- package/cjs/InputNumber/InputNumber.js +47 -28
- package/cjs/InputPicker/InputPicker.js +6 -5
- package/cjs/Pagination/LimitPicker.d.ts +15 -0
- package/cjs/Pagination/LimitPicker.js +51 -0
- package/cjs/Pagination/Pagination.js +7 -8
- package/cjs/Pagination/PaginationButton.js +3 -18
- package/cjs/Pagination/PaginationGroup.d.ts +35 -7
- package/cjs/Pagination/PaginationGroup.js +77 -98
- package/cjs/RangeSlider/RangeSlider.js +14 -11
- package/cjs/Slider/Handle.js +19 -62
- package/cjs/Slider/ProgressBar.js +2 -1
- package/cjs/Slider/Slider.d.ts +2 -0
- package/cjs/Slider/Slider.js +18 -12
- package/cjs/Slider/useDrag.d.ts +16 -0
- package/cjs/Slider/useDrag.js +88 -0
- package/cjs/Slider/utils.d.ts +6 -2
- package/cjs/Slider/utils.js +15 -1
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +3 -1
- package/cjs/internals/Overlay/positionUtils.d.ts +1 -6
- package/cjs/internals/Picker/Listbox.d.ts +5 -1
- package/cjs/internals/Picker/Listbox.js +6 -5
- package/cjs/internals/Picker/hooks/usePickerRef.js +2 -0
- package/cjs/internals/Picker/types.d.ts +2 -0
- package/cjs/internals/symbols.d.ts +2 -0
- package/cjs/internals/symbols.js +9 -0
- package/cjs/locales/cs_CZ.d.ts +120 -0
- package/cjs/locales/cs_CZ.js +88 -0
- package/cjs/locales/index.d.ts +1 -0
- package/cjs/locales/index.js +4 -2
- package/cjs/utils/getDataGroupBy.d.ts +0 -1
- package/cjs/utils/getDataGroupBy.js +3 -5
- package/dist/rsuite-no-reset-rtl.css +94 -4
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +94 -4
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +94 -4
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +94 -4
- package/dist/rsuite.js +171 -61
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Calendar/CalendarContainer.d.ts +4 -0
- package/esm/Calendar/CalendarContainer.js +3 -1
- package/esm/Calendar/TableCell.js +5 -4
- package/esm/Calendar/types.d.ts +1 -0
- package/esm/Cascader/DropdownMenu.js +3 -1
- package/esm/Cascader/TreeView.js +3 -1
- package/esm/DOMHelper/index.d.ts +23 -32
- package/esm/DatePicker/DatePicker.d.ts +6 -0
- package/esm/DatePicker/DatePicker.js +4 -3
- package/esm/DateRangePicker/DateRangePicker.js +8 -2
- package/esm/InlineEdit/EditableControls.d.ts +8 -0
- package/esm/InlineEdit/EditableControls.js +28 -0
- package/esm/InlineEdit/InlineEdit.d.ts +56 -0
- package/esm/InlineEdit/InlineEdit.js +92 -0
- package/esm/InlineEdit/index.d.ts +3 -0
- package/esm/InlineEdit/index.js +3 -0
- package/esm/InlineEdit/renderChildren.d.ts +12 -0
- package/esm/InlineEdit/renderChildren.js +34 -0
- package/esm/InlineEdit/useEditState.d.ts +22 -0
- package/esm/InlineEdit/useEditState.js +76 -0
- package/esm/InlineEdit/useFocusEvent.d.ts +14 -0
- package/esm/InlineEdit/useFocusEvent.js +56 -0
- package/esm/Input/Input.js +6 -3
- package/esm/InputNumber/InputNumber.d.ts +36 -11
- package/esm/InputNumber/InputNumber.js +49 -30
- package/esm/InputPicker/InputPicker.js +6 -5
- package/esm/Pagination/LimitPicker.d.ts +15 -0
- package/esm/Pagination/LimitPicker.js +44 -0
- package/esm/Pagination/Pagination.js +7 -7
- package/esm/Pagination/PaginationButton.js +4 -18
- package/esm/Pagination/PaginationGroup.d.ts +35 -7
- package/esm/Pagination/PaginationGroup.js +79 -98
- package/esm/RangeSlider/RangeSlider.js +15 -12
- package/esm/Slider/Handle.js +19 -61
- package/esm/Slider/ProgressBar.js +2 -1
- package/esm/Slider/Slider.d.ts +2 -0
- package/esm/Slider/Slider.js +20 -14
- package/esm/Slider/useDrag.d.ts +16 -0
- package/esm/Slider/useDrag.js +82 -0
- package/esm/Slider/utils.d.ts +6 -2
- package/esm/Slider/utils.js +15 -3
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/esm/internals/Overlay/positionUtils.d.ts +1 -6
- package/esm/internals/Picker/Listbox.d.ts +5 -1
- package/esm/internals/Picker/Listbox.js +7 -6
- package/esm/internals/Picker/hooks/usePickerRef.js +2 -0
- package/esm/internals/Picker/types.d.ts +2 -0
- package/esm/internals/symbols.d.ts +2 -0
- package/esm/internals/symbols.js +3 -0
- package/esm/locales/cs_CZ.d.ts +120 -0
- package/esm/locales/cs_CZ.js +82 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +2 -1
- package/esm/utils/getDataGroupBy.d.ts +0 -1
- package/esm/utils/getDataGroupBy.js +2 -3
- package/locales/cs_CZ/package.json +7 -0
- package/package.json +2 -2
- package/styles/color-modes/dark.less +3 -0
- package/styles/color-modes/high-contrast.less +3 -0
- package/styles/color-modes/light.less +3 -0
- package/styles/index.less +1 -0
package/cjs/DOMHelper/index.d.ts
CHANGED
|
@@ -11,43 +11,34 @@ declare const DOMHelper: {
|
|
|
11
11
|
off: typeof helpers.off;
|
|
12
12
|
WheelHandler: typeof helpers.WheelHandler;
|
|
13
13
|
DOMMouseMoveTracker: typeof helpers.DOMMouseMoveTracker;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
PointerMoveTracker: typeof helpers.PointerMoveTracker;
|
|
15
|
+
addClass: typeof helpers.addClass;
|
|
16
|
+
removeClass: typeof helpers.removeClass;
|
|
17
|
+
hasClass: typeof helpers.hasClass;
|
|
18
|
+
toggleClass: typeof helpers.toggleClass;
|
|
19
|
+
cancelAnimationFramePolyfill: typeof cancelAnimationFrame;
|
|
19
20
|
requestAnimationFramePolyfill: typeof requestAnimationFrame | ((callback: (t: number) => void) => NodeJS.Timeout);
|
|
20
21
|
getAnimationEnd: typeof helpers.getAnimationEnd;
|
|
21
|
-
ownerDocument:
|
|
22
|
-
ownerWindow:
|
|
23
|
-
getWindow:
|
|
24
|
-
getContainer:
|
|
22
|
+
ownerDocument: typeof helpers.ownerDocument;
|
|
23
|
+
ownerWindow: typeof helpers.ownerWindow;
|
|
24
|
+
getWindow: typeof helpers.getWindow;
|
|
25
|
+
getContainer: typeof helpers.getContainer;
|
|
25
26
|
canUseDOM: boolean;
|
|
26
27
|
contains: (context: Element, node: Node & ParentNode) => boolean;
|
|
27
|
-
scrollTop:
|
|
28
|
-
scrollLeft:
|
|
29
|
-
getOffset:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
getPosition: (node: Element, offsetParent?: Element | undefined, calcMargin?: boolean | undefined) => DOMRect | {
|
|
38
|
-
top: number;
|
|
39
|
-
left: number;
|
|
40
|
-
height: number;
|
|
41
|
-
width: number;
|
|
42
|
-
} | null;
|
|
43
|
-
isOverflowing: (container: Element) => boolean;
|
|
44
|
-
getScrollbarSize: (recalc?: boolean | undefined) => number | void;
|
|
45
|
-
getHeight: (node: Element | Window, client?: Element | undefined) => number;
|
|
46
|
-
getWidth: (node: Element | Window, client?: Element | undefined) => number;
|
|
28
|
+
scrollTop: typeof helpers.scrollTop;
|
|
29
|
+
scrollLeft: typeof helpers.scrollLeft;
|
|
30
|
+
getOffset: typeof helpers.getOffset;
|
|
31
|
+
nodeName: typeof helpers.nodeName;
|
|
32
|
+
getOffsetParent: typeof helpers.getOffsetParent;
|
|
33
|
+
getPosition: typeof helpers.getPosition;
|
|
34
|
+
isOverflowing: typeof helpers.isOverflowing;
|
|
35
|
+
getScrollbarSize: typeof helpers.getScrollbarSize;
|
|
36
|
+
getHeight: typeof helpers.getHeight;
|
|
37
|
+
getWidth: typeof helpers.getWidth;
|
|
47
38
|
isFocusable: typeof helpers.isFocusable;
|
|
48
|
-
getStyle:
|
|
49
|
-
removeStyle:
|
|
50
|
-
addStyle:
|
|
39
|
+
getStyle: typeof helpers.getStyle;
|
|
40
|
+
removeStyle: typeof helpers.removeStyle;
|
|
41
|
+
addStyle: typeof helpers.addStyle;
|
|
51
42
|
translateDOMPositionXY: (style: CSSStyleDeclaration, x?: number | undefined, y?: number | undefined) => CSSStyleDeclaration;
|
|
52
43
|
};
|
|
53
44
|
export default DOMHelper;
|
|
@@ -117,6 +117,12 @@ export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, Form
|
|
|
117
117
|
* @deprecated
|
|
118
118
|
*/
|
|
119
119
|
renderValue?: (value: Date, format: string) => string;
|
|
120
|
+
/**
|
|
121
|
+
* Custom rendering calendar cell content.
|
|
122
|
+
*
|
|
123
|
+
* @version 5.54.0
|
|
124
|
+
*/
|
|
125
|
+
renderCell?: (date: Date) => React.ReactNode;
|
|
120
126
|
}
|
|
121
127
|
/**
|
|
122
128
|
* A date picker allows users to select a date from a calendar.
|
|
@@ -101,7 +101,8 @@ var DatePicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
101
101
|
onToggleMonthDropdown = props.onToggleMonthDropdown,
|
|
102
102
|
onToggleTimeDropdown = props.onToggleTimeDropdown,
|
|
103
103
|
onShortcutClick = props.onShortcutClick,
|
|
104
|
-
|
|
104
|
+
renderCell = props.renderCell,
|
|
105
|
+
restProps = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "className", "classPrefix", "calendarDefaultDate", "cleanable", "editable", "defaultValue", "disabled", "readOnly", "plaintext", "format", "id", "isoWeek", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "appearance", "placement", "oneTap", "placeholder", "ranges", "value", "showMeridian", "showWeekNumbers", "style", "size", "caretAs", "disabledDate", "disabledHours", "disabledMinutes", "disabledSeconds", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "onChange", "onChangeCalendarDate", "onClean", "onClose", "onEntered", "onExited", "onNextMonth", "onOk", "onOpen", "onPrevMonth", "onSelect", "onToggleMonthDropdown", "onToggleTimeDropdown", "onShortcutClick", "renderCell"]);
|
|
105
106
|
var id = (0, _utils.useUniqueId)('rs-', idProp);
|
|
106
107
|
var _usePickerRef = (0, _Picker.usePickerRef)(ref),
|
|
107
108
|
trigger = _usePickerRef.trigger,
|
|
@@ -443,7 +444,7 @@ var DatePicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
443
444
|
locale: locale,
|
|
444
445
|
disabledShortcut: disabledToolbarHandle,
|
|
445
446
|
onShortcutClick: handleShortcutPageDate
|
|
446
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
447
|
+
}), /*#__PURE__*/_react.default.createElement(_Stack.default.Item, null, /*#__PURE__*/_react.default.createElement(_CalendarContainer.default, (0, _extends2.default)({}, calendarProps, {
|
|
447
448
|
targetId: id,
|
|
448
449
|
locale: locale,
|
|
449
450
|
showWeekNumbers: showWeekNumbers,
|
|
@@ -457,6 +458,7 @@ var DatePicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
457
458
|
format: formatStr,
|
|
458
459
|
isoWeek: isoWeek,
|
|
459
460
|
calendarDate: calendarDate,
|
|
461
|
+
renderCellOnPicker: renderCell,
|
|
460
462
|
onMoveForward: handleMoveForward,
|
|
461
463
|
onMoveBackward: handleMoveBackward,
|
|
462
464
|
onSelect: handleSelect,
|
|
@@ -582,7 +584,6 @@ DatePicker.propTypes = (0, _extends2.default)({}, _Picker.pickerPropTypes, {
|
|
|
582
584
|
onToggleMonthDropdown: _propTypes.default.func,
|
|
583
585
|
onToggleTimeDropdown: _propTypes.default.func,
|
|
584
586
|
oneTap: _propTypes.default.bool,
|
|
585
|
-
panelContainerRef: _propTypes.default.any,
|
|
586
587
|
ranges: _propTypes.default.array,
|
|
587
588
|
showMeridian: _propTypes.default.bool,
|
|
588
589
|
showWeekNumbers: _propTypes.default.bool,
|
|
@@ -172,7 +172,7 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
172
172
|
var nextValue = dateRange;
|
|
173
173
|
|
|
174
174
|
// The time should remain the same when the dates in the date range are changed.
|
|
175
|
-
if ((0, _dateUtils.shouldRenderTime)(formatStr) && dateRange !== null && dateRange !== void 0 && dateRange.length && eventName !== 'changeTime') {
|
|
175
|
+
if ((0, _dateUtils.shouldRenderTime)(formatStr) && dateRange !== null && dateRange !== void 0 && dateRange.length && eventName !== 'changeTime' && eventName !== 'shortcutSelection') {
|
|
176
176
|
var _startDate = (0, _dateUtils.copyTime)({
|
|
177
177
|
from: getCalendarDatetime('start'),
|
|
178
178
|
to: dateRange[0]
|
|
@@ -447,7 +447,8 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
447
447
|
}
|
|
448
448
|
var value = range.value;
|
|
449
449
|
setCalendarDateRange({
|
|
450
|
-
dateRange: value
|
|
450
|
+
dateRange: value,
|
|
451
|
+
eventName: 'shortcutSelection'
|
|
451
452
|
});
|
|
452
453
|
if (closeOverlay) {
|
|
453
454
|
setDateRange(event, value, closeOverlay);
|
|
@@ -674,6 +675,11 @@ var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, re
|
|
|
674
675
|
if (!value) {
|
|
675
676
|
return false;
|
|
676
677
|
}
|
|
678
|
+
|
|
679
|
+
// If the value is an empty array, it is not an error value.
|
|
680
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
681
|
+
return false;
|
|
682
|
+
}
|
|
677
683
|
var startDate = value[0],
|
|
678
684
|
endDate = value[1];
|
|
679
685
|
if (!(0, _dateUtils.isValid)(startDate) || !(0, _dateUtils.isValid)(endDate)) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StackProps } from '../Stack';
|
|
3
|
+
interface EditableControlsProps extends StackProps {
|
|
4
|
+
onSave: () => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const EditableControls: React.ForwardRefExoticComponent<EditableControlsProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default EditableControls;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _Check = _interopRequireDefault(require("@rsuite/icons/Check"));
|
|
11
|
+
var _Close = _interopRequireDefault(require("@rsuite/icons/Close"));
|
|
12
|
+
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
13
|
+
var _Stack = _interopRequireDefault(require("../Stack"));
|
|
14
|
+
var EditableControls = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
15
|
+
var onSave = props.onSave,
|
|
16
|
+
onCancel = props.onCancel,
|
|
17
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["onSave", "onCancel"]);
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_Stack.default, (0, _extends2.default)({
|
|
19
|
+
ref: ref,
|
|
20
|
+
spacing: 6
|
|
21
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
22
|
+
size: "sm",
|
|
23
|
+
icon: /*#__PURE__*/_react.default.createElement(_Check.default, null),
|
|
24
|
+
"aria-label": "Save",
|
|
25
|
+
onClick: onSave
|
|
26
|
+
}), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
27
|
+
size: "sm",
|
|
28
|
+
icon: /*#__PURE__*/_react.default.createElement(_Close.default, null),
|
|
29
|
+
"aria-label": "Cancel",
|
|
30
|
+
onClick: onCancel
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
var _default = EditableControls;
|
|
34
|
+
exports.default = _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WithAsProps, RsRefForwardingComponent } from '../@types/common';
|
|
3
|
+
import { type ChildrenProps } from './renderChildren';
|
|
4
|
+
export interface InlineEditProps extends WithAsProps {
|
|
5
|
+
/**
|
|
6
|
+
* If true, the InlineEdit will be disabled.
|
|
7
|
+
*/
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The initial value of the InlineEdit when it is not controlled.
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: any;
|
|
13
|
+
/**
|
|
14
|
+
* The value of the InlineEdit.
|
|
15
|
+
*/
|
|
16
|
+
value?: any;
|
|
17
|
+
/**
|
|
18
|
+
* show the control buttons when editing.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
showControls?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The placeholder of the InlineEdit.
|
|
24
|
+
*/
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The size of the InlineEdit.
|
|
28
|
+
*/
|
|
29
|
+
size?: 'lg' | 'md' | 'sm' | 'xs';
|
|
30
|
+
/**
|
|
31
|
+
* The state of the InlineEdit when it is blurred.
|
|
32
|
+
*/
|
|
33
|
+
stateOnBlur?: 'save' | 'cancel';
|
|
34
|
+
/**
|
|
35
|
+
* The callback function that is called when the value of the InlineEdit is changed.
|
|
36
|
+
*/
|
|
37
|
+
onChange?: (value: any, event: React.ChangeEvent) => void;
|
|
38
|
+
/**
|
|
39
|
+
* The callback function that is called when the InlineEdit is canceled.
|
|
40
|
+
*/
|
|
41
|
+
onCancel?: (event?: React.SyntheticEvent) => void;
|
|
42
|
+
/**
|
|
43
|
+
* The callback function that is called when the InlineEdit is saved.
|
|
44
|
+
*/
|
|
45
|
+
onSave?: (event?: React.SyntheticEvent) => void;
|
|
46
|
+
/**
|
|
47
|
+
* The callback function that is called when the InlineEdit is clicked.
|
|
48
|
+
*/
|
|
49
|
+
onEdit?: (event: React.SyntheticEvent) => void;
|
|
50
|
+
/**
|
|
51
|
+
* The render function of the InlineEdit.
|
|
52
|
+
*/
|
|
53
|
+
children?: ((props: ChildrenProps, ref: React.Ref<any>) => React.ReactElement) | React.ReactElement;
|
|
54
|
+
}
|
|
55
|
+
declare const InlineEdit: RsRefForwardingComponent<'div', InlineEditProps>;
|
|
56
|
+
export default InlineEdit;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
var _propTypes2 = require("../internals/propTypes");
|
|
13
|
+
var _EditableControls = _interopRequireDefault(require("./EditableControls"));
|
|
14
|
+
var _useFocusEvent2 = _interopRequireDefault(require("./useFocusEvent"));
|
|
15
|
+
var _useEditState2 = _interopRequireDefault(require("./useEditState"));
|
|
16
|
+
var _renderChildren = require("./renderChildren");
|
|
17
|
+
var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
18
|
+
var _props$as = props.as,
|
|
19
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
20
|
+
_props$children = props.children,
|
|
21
|
+
children = _props$children === void 0 ? _renderChildren.defaultRenderInput : _props$children,
|
|
22
|
+
_props$classPrefix = props.classPrefix,
|
|
23
|
+
classPrefix = _props$classPrefix === void 0 ? 'inline-edit' : _props$classPrefix,
|
|
24
|
+
className = props.className,
|
|
25
|
+
disabled = props.disabled,
|
|
26
|
+
size = props.size,
|
|
27
|
+
_props$showControls = props.showControls,
|
|
28
|
+
showControls = _props$showControls === void 0 ? true : _props$showControls,
|
|
29
|
+
_props$stateOnBlur = props.stateOnBlur,
|
|
30
|
+
stateOnBlur = _props$stateOnBlur === void 0 ? 'save' : _props$stateOnBlur,
|
|
31
|
+
placeholder = props.placeholder,
|
|
32
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "children", "classPrefix", "className", "disabled", "size", "showControls", "stateOnBlur", "placeholder"]);
|
|
33
|
+
var _useClassNames = (0, _utils.useClassNames)(classPrefix),
|
|
34
|
+
withClassPrefix = _useClassNames.withClassPrefix,
|
|
35
|
+
merge = _useClassNames.merge,
|
|
36
|
+
prefix = _useClassNames.prefix;
|
|
37
|
+
var _useEditState = (0, _useEditState2.default)((0, _extends2.default)({}, rest, {
|
|
38
|
+
disabled: disabled
|
|
39
|
+
})),
|
|
40
|
+
value = _useEditState.value,
|
|
41
|
+
isEditing = _useEditState.isEditing,
|
|
42
|
+
onSave = _useEditState.onSave,
|
|
43
|
+
onCancel = _useEditState.onCancel,
|
|
44
|
+
onChange = _useEditState.onChange,
|
|
45
|
+
onKeyDown = _useEditState.onKeyDown,
|
|
46
|
+
onClick = _useEditState.onClick,
|
|
47
|
+
htmlProps = _useEditState.htmlProps;
|
|
48
|
+
var _useFocusEvent = (0, _useFocusEvent2.default)({
|
|
49
|
+
isEditing: isEditing,
|
|
50
|
+
stateOnBlur: stateOnBlur,
|
|
51
|
+
onSave: onSave,
|
|
52
|
+
onCancel: onCancel
|
|
53
|
+
}),
|
|
54
|
+
target = _useFocusEvent.target,
|
|
55
|
+
root = _useFocusEvent.root,
|
|
56
|
+
onBlur = _useFocusEvent.onBlur;
|
|
57
|
+
var childrenProps = {
|
|
58
|
+
size: size,
|
|
59
|
+
value: value,
|
|
60
|
+
disabled: disabled,
|
|
61
|
+
placeholder: placeholder,
|
|
62
|
+
plaintext: !isEditing,
|
|
63
|
+
onChange: onChange,
|
|
64
|
+
onBlur: onBlur
|
|
65
|
+
};
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
|
|
67
|
+
ref: (0, _utils.mergeRefs)(root, ref),
|
|
68
|
+
tabIndex: 0,
|
|
69
|
+
className: merge(className, withClassPrefix(size, {
|
|
70
|
+
disabled: disabled
|
|
71
|
+
})),
|
|
72
|
+
onClick: onClick,
|
|
73
|
+
onKeyDown: onKeyDown
|
|
74
|
+
}, htmlProps), (0, _renderChildren.renderChildren)(children, childrenProps, target), showControls && isEditing && /*#__PURE__*/_react.default.createElement(_EditableControls.default, {
|
|
75
|
+
className: prefix('controls'),
|
|
76
|
+
onSave: onSave,
|
|
77
|
+
onCancel: onCancel
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
InlineEdit.displayName = 'InlineEdit';
|
|
81
|
+
InlineEdit.propTypes = {
|
|
82
|
+
children: _propTypes.default.any,
|
|
83
|
+
classPrefix: _propTypes.default.string,
|
|
84
|
+
className: _propTypes.default.string,
|
|
85
|
+
disabled: _propTypes.default.bool,
|
|
86
|
+
defaultValue: _propTypes.default.any,
|
|
87
|
+
value: _propTypes.default.any,
|
|
88
|
+
showControls: _propTypes.default.bool,
|
|
89
|
+
placeholder: _propTypes.default.string,
|
|
90
|
+
size: (0, _propTypes2.oneOf)(['lg', 'md', 'sm', 'xs']),
|
|
91
|
+
stateOnBlur: (0, _propTypes2.oneOf)(['save', 'cancel']),
|
|
92
|
+
onChange: _propTypes.default.func,
|
|
93
|
+
onCancel: _propTypes.default.func,
|
|
94
|
+
onSave: _propTypes.default.func,
|
|
95
|
+
onEdit: _propTypes.default.func
|
|
96
|
+
};
|
|
97
|
+
var _default = InlineEdit;
|
|
98
|
+
exports.default = _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _InlineEdit = _interopRequireDefault(require("./InlineEdit"));
|
|
8
|
+
var _default = _InlineEdit.default;
|
|
9
|
+
exports.default = _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ChildrenProps {
|
|
3
|
+
size?: 'lg' | 'md' | 'sm' | 'xs';
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
plaintext?: boolean;
|
|
7
|
+
value: any;
|
|
8
|
+
onChange: (value: any, event: React.SyntheticEvent) => void;
|
|
9
|
+
onBlur?: (event: React.SyntheticEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function defaultRenderInput(props: ChildrenProps, ref: React.Ref<any>): JSX.Element;
|
|
12
|
+
export declare function renderChildren(children: ((props: ChildrenProps, ref: React.Ref<any>) => React.ReactElement) | React.ReactElement, props: ChildrenProps, ref: React.Ref<any>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.defaultRenderInput = defaultRenderInput;
|
|
7
|
+
exports.renderChildren = renderChildren;
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _Input = _interopRequireDefault(require("../Input"));
|
|
12
|
+
function defaultRenderInput(props, ref) {
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
|
|
14
|
+
ref: ref
|
|
15
|
+
}, props));
|
|
16
|
+
}
|
|
17
|
+
var pickers = ['DatePicker', 'DateRangePicker', 'InputPicker', 'TagPicker', 'Cascader', 'MultiCascader', 'SelectPicker', 'CheckPicker', 'CheckTreePicker', 'TreePicker'];
|
|
18
|
+
function getDisplayName(Component) {
|
|
19
|
+
var _Component$type;
|
|
20
|
+
if (typeof (Component === null || Component === void 0 ? void 0 : Component.type) === 'string') {
|
|
21
|
+
return Component === null || Component === void 0 ? void 0 : Component.type;
|
|
22
|
+
}
|
|
23
|
+
return (Component === null || Component === void 0 ? void 0 : (_Component$type = Component.type) === null || _Component$type === void 0 ? void 0 : _Component$type.displayName) || '';
|
|
24
|
+
}
|
|
25
|
+
function renderChildren(children, props, ref) {
|
|
26
|
+
if (typeof children === 'function') {
|
|
27
|
+
return children(props, ref);
|
|
28
|
+
}
|
|
29
|
+
if (pickers.includes(getDisplayName(children))) {
|
|
30
|
+
var onBlur = props.onBlur,
|
|
31
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["onBlur"]); // if the children is a picker, we should pass the onBlur to the onClose
|
|
32
|
+
return /*#__PURE__*/_react.default.cloneElement(children, (0, _extends2.default)({}, rest, {
|
|
33
|
+
onClose: onBlur,
|
|
34
|
+
ref: ref
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
return /*#__PURE__*/_react.default.cloneElement(children, (0, _extends2.default)({}, props, {
|
|
38
|
+
ref: ref
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface EditStateProps {
|
|
3
|
+
value?: any;
|
|
4
|
+
defaultValue?: any;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onChange?: (value: any, event: React.ChangeEvent) => void;
|
|
7
|
+
onEdit?: (event: React.SyntheticEvent) => void;
|
|
8
|
+
onCancel?: (event?: React.MouseEvent) => void;
|
|
9
|
+
onSave?: (event?: React.MouseEvent) => void;
|
|
10
|
+
onClick?: (event: React.SyntheticEvent) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const useEditState: (props: EditStateProps) => {
|
|
13
|
+
isEditing: boolean;
|
|
14
|
+
value: any;
|
|
15
|
+
onClick: (...args: any[]) => any;
|
|
16
|
+
onChange: (...args: any[]) => any;
|
|
17
|
+
onCancel: (...args: any[]) => any;
|
|
18
|
+
onSave: (...args: any[]) => any;
|
|
19
|
+
onKeyDown: (...args: any[]) => any;
|
|
20
|
+
htmlProps: {};
|
|
21
|
+
};
|
|
22
|
+
export default useEditState;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var useEditState = function useEditState(props) {
|
|
11
|
+
var valueProp = props.value,
|
|
12
|
+
defaultValue = props.defaultValue,
|
|
13
|
+
disabled = props.disabled,
|
|
14
|
+
onChange = props.onChange,
|
|
15
|
+
onEdit = props.onEdit,
|
|
16
|
+
onCancel = props.onCancel,
|
|
17
|
+
onSave = props.onSave,
|
|
18
|
+
onClick = props.onClick,
|
|
19
|
+
htmlProps = (0, _objectWithoutPropertiesLoose2.default)(props, ["value", "defaultValue", "disabled", "onChange", "onEdit", "onCancel", "onSave", "onClick"]);
|
|
20
|
+
var _useState = (0, _react.useState)(false),
|
|
21
|
+
isEditing = _useState[0],
|
|
22
|
+
setIsEditing = _useState[1];
|
|
23
|
+
var _useControlled = (0, _utils.useControlled)(valueProp, defaultValue),
|
|
24
|
+
value = _useControlled[0],
|
|
25
|
+
setValue = _useControlled[1]; // When editing, the value is not updated, and the original value is restored when canceling
|
|
26
|
+
var _useState2 = (0, _react.useState)(),
|
|
27
|
+
resetValue = _useState2[0],
|
|
28
|
+
setResetValue = _useState2[1];
|
|
29
|
+
var handleClick = (0, _utils.useEventCallback)(function (event) {
|
|
30
|
+
if (disabled) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
34
|
+
onEdit === null || onEdit === void 0 ? void 0 : onEdit(event);
|
|
35
|
+
setIsEditing(true);
|
|
36
|
+
setResetValue(value);
|
|
37
|
+
});
|
|
38
|
+
var handleChange = (0, _utils.useEventCallback)(function (value, event) {
|
|
39
|
+
setValue(value);
|
|
40
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
|
|
41
|
+
});
|
|
42
|
+
var handleCancel = (0, _utils.useEventCallback)(function (event) {
|
|
43
|
+
var _event$stopPropagatio;
|
|
44
|
+
setIsEditing(false);
|
|
45
|
+
setValue(resetValue);
|
|
46
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel(event);
|
|
47
|
+
event === null || event === void 0 ? void 0 : (_event$stopPropagatio = event.stopPropagation) === null || _event$stopPropagatio === void 0 ? void 0 : _event$stopPropagatio.call(event);
|
|
48
|
+
});
|
|
49
|
+
var handleSave = (0, _utils.useEventCallback)(function (event) {
|
|
50
|
+
var _event$stopPropagatio2;
|
|
51
|
+
setIsEditing(false);
|
|
52
|
+
onSave === null || onSave === void 0 ? void 0 : onSave(event);
|
|
53
|
+
event === null || event === void 0 ? void 0 : (_event$stopPropagatio2 = event.stopPropagation) === null || _event$stopPropagatio2 === void 0 ? void 0 : _event$stopPropagatio2.call(event);
|
|
54
|
+
});
|
|
55
|
+
var handleKeyDown = (0, _utils.useEventCallback)(function (event) {
|
|
56
|
+
var _event$target;
|
|
57
|
+
if (isEditing) {
|
|
58
|
+
switch (event.key) {
|
|
59
|
+
case 'Enter':
|
|
60
|
+
if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.tagName) === 'INPUT') {
|
|
61
|
+
handleSave(event);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
case 'Escape':
|
|
65
|
+
handleCancel(event);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
isEditing: isEditing,
|
|
72
|
+
value: value,
|
|
73
|
+
onClick: handleClick,
|
|
74
|
+
onChange: handleChange,
|
|
75
|
+
onCancel: handleCancel,
|
|
76
|
+
onSave: handleSave,
|
|
77
|
+
onKeyDown: handleKeyDown,
|
|
78
|
+
htmlProps: htmlProps
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
var _default = useEditState;
|
|
82
|
+
exports.default = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PickerHandle } from '../internals/Picker/types';
|
|
3
|
+
interface FocusEventProps {
|
|
4
|
+
isEditing: boolean;
|
|
5
|
+
stateOnBlur?: 'save' | 'cancel';
|
|
6
|
+
onSave?: (event?: React.FocusEvent) => void;
|
|
7
|
+
onCancel?: (event?: React.FocusEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const useFocusEvent: ({ isEditing, stateOnBlur, onSave, onCancel }: FocusEventProps) => {
|
|
10
|
+
target: import("react").RefObject<HTMLInputElement | PickerHandle>;
|
|
11
|
+
root: import("react").RefObject<HTMLDivElement>;
|
|
12
|
+
onBlur: (...args: any[]) => any;
|
|
13
|
+
};
|
|
14
|
+
export default useFocusEvent;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _react = require("react");
|
|
7
|
+
var _domLib = require("dom-lib");
|
|
8
|
+
var _utils = require("../utils");
|
|
9
|
+
var _symbols = require("../internals/symbols");
|
|
10
|
+
var useFocusEvent = function useFocusEvent(_ref) {
|
|
11
|
+
var _ref$current;
|
|
12
|
+
var isEditing = _ref.isEditing,
|
|
13
|
+
stateOnBlur = _ref.stateOnBlur,
|
|
14
|
+
onSave = _ref.onSave,
|
|
15
|
+
onCancel = _ref.onCancel;
|
|
16
|
+
var ref = (0, _react.useRef)(null);
|
|
17
|
+
var rootRef = (0, _react.useRef)(null);
|
|
18
|
+
var isPicker = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.type) === _symbols.RSUITE_PICKER_TYPE;
|
|
19
|
+
var focus = function focus() {
|
|
20
|
+
if (isPicker) {
|
|
21
|
+
setTimeout(function () {
|
|
22
|
+
var _ref$current2, _ref$current2$target, _ref$current2$target$;
|
|
23
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$target = _ref$current2.target) === null || _ref$current2$target === void 0 ? void 0 : (_ref$current2$target$ = _ref$current2$target.focus) === null || _ref$current2$target$ === void 0 ? void 0 : _ref$current2$target$.call(_ref$current2$target);
|
|
24
|
+
}, 100);
|
|
25
|
+
} else {
|
|
26
|
+
var _ref$current3, _ref$current3$focus;
|
|
27
|
+
(_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : (_ref$current3$focus = _ref$current3.focus) === null || _ref$current3$focus === void 0 ? void 0 : _ref$current3$focus.call(_ref$current3);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var handleBlur = (0, _utils.useEventCallback)(function (event) {
|
|
31
|
+
if (event) {
|
|
32
|
+
var _event$relatedTarget;
|
|
33
|
+
var relatedTarget = (_event$relatedTarget = event.relatedTarget) !== null && _event$relatedTarget !== void 0 ? _event$relatedTarget : (0, _domLib.ownerDocument)(event.currentTarget).activeElement;
|
|
34
|
+
if (rootRef.current && (0, _domLib.contains)(rootRef.current, relatedTarget)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (stateOnBlur === 'save') {
|
|
39
|
+
onSave === null || onSave === void 0 ? void 0 : onSave(event);
|
|
40
|
+
} else if (stateOnBlur === 'cancel') {
|
|
41
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel(event);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
(0, _utils.useIsomorphicLayoutEffect)(function () {
|
|
45
|
+
if (isEditing) {
|
|
46
|
+
focus();
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
(0, _utils.useUpdateEffect)(function () {
|
|
50
|
+
if (isEditing) {
|
|
51
|
+
focus();
|
|
52
|
+
}
|
|
53
|
+
}, [isEditing]);
|
|
54
|
+
return {
|
|
55
|
+
target: ref,
|
|
56
|
+
root: rootRef,
|
|
57
|
+
onBlur: handleBlur
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
var _default = useFocusEvent;
|
|
61
|
+
exports.default = _default;
|
package/cjs/Input/Input.js
CHANGED
|
@@ -35,13 +35,14 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
35
35
|
size = props.size,
|
|
36
36
|
htmlSize = props.htmlSize,
|
|
37
37
|
plaintext = props.plaintext,
|
|
38
|
+
placeholder = props.placeholder,
|
|
38
39
|
readOnly = props.readOnly,
|
|
39
40
|
onPressEnter = props.onPressEnter,
|
|
40
41
|
onFocus = props.onFocus,
|
|
41
42
|
onBlur = props.onBlur,
|
|
42
43
|
onKeyDown = props.onKeyDown,
|
|
43
44
|
onChange = props.onChange,
|
|
44
|
-
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["className", "classPrefix", "as", "type", "disabled", "value", "defaultValue", "inputRef", "id", "size", "htmlSize", "plaintext", "readOnly", "onPressEnter", "onFocus", "onBlur", "onKeyDown", "onChange"]);
|
|
45
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["className", "classPrefix", "as", "type", "disabled", "value", "defaultValue", "inputRef", "id", "size", "htmlSize", "plaintext", "placeholder", "readOnly", "onPressEnter", "onFocus", "onBlur", "onKeyDown", "onChange"]);
|
|
45
46
|
var handleKeyDown = function handleKeyDown(event) {
|
|
46
47
|
if (event.key === _utils.KEY_VALUES.ENTER) {
|
|
47
48
|
onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(event);
|
|
@@ -66,7 +67,8 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
66
67
|
if (plaintext) {
|
|
67
68
|
return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {
|
|
68
69
|
ref: ref,
|
|
69
|
-
localeKey: "unfilled"
|
|
70
|
+
localeKey: "unfilled",
|
|
71
|
+
placeholder: placeholder
|
|
70
72
|
}, typeof value === 'undefined' ? defaultValue : value);
|
|
71
73
|
}
|
|
72
74
|
var inputable = !disabled && !readOnly;
|
|
@@ -86,7 +88,8 @@ var Input = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
86
88
|
defaultValue: defaultValue,
|
|
87
89
|
disabled: disabled,
|
|
88
90
|
readOnly: readOnly,
|
|
89
|
-
size: htmlSize
|
|
91
|
+
size: htmlSize,
|
|
92
|
+
placeholder: placeholder
|
|
90
93
|
}));
|
|
91
94
|
});
|
|
92
95
|
Input.displayName = 'Input';
|