@ucloud-fe/react-components 1.2.8 → 1.2.9

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.
@@ -1,5 +1,5 @@
1
- import React, { ReactNode, HTMLAttributes } from 'react';
2
- declare type InputProps = HTMLAttributes<HTMLDivElement>;
1
+ import React, { ReactNode } from 'react';
2
+ import { InputProps } from '../../components/Input';
3
3
  interface Item {
4
4
  value: string;
5
5
  label?: ReactNode;
@@ -31,8 +31,10 @@ interface AutoCompleteProps {
31
31
  onFocus?: () => void;
32
32
  /** 失焦回调 */
33
33
  onBlur?: () => void;
34
+ /** 状态 */
35
+ status: InputProps['status'];
34
36
  /** @ignore */
35
37
  placeholder?: InputProps['placeholder'];
36
38
  }
37
- declare const _default: React.MemoExoticComponent<({ value: _value, defaultValue, onChange: _onChange, options, disabled, loading, prefix, block, handleSearch, popoverProps, onFocus, onBlur, style, className, placeholder }: AutoCompleteProps & Omit<InputProps, keyof AutoCompleteProps>) => JSX.Element>;
39
+ declare const _default: React.MemoExoticComponent<({ value: _value, defaultValue, onChange: _onChange, options, disabled, loading, prefix, block, handleSearch, popoverProps, onFocus, onBlur, style, className, status, placeholder }: AutoCompleteProps & Omit<InputProps, keyof AutoCompleteProps>) => JSX.Element>;
38
40
  export default _default;
@@ -61,6 +61,7 @@ var AutoComplete = function AutoComplete(_ref) {
61
61
  onBlur = _ref.onBlur,
62
62
  style = _ref.style,
63
63
  className = _ref.className,
64
+ status = _ref.status,
64
65
  placeholder = _ref.placeholder;
65
66
 
66
67
  var _useUncontrolled = (0, _useUncontrolled3.default)(_value, defaultValue, _onChange),
@@ -149,7 +150,8 @@ var AutoComplete = function AutoComplete(_ref) {
149
150
  }),
150
151
  className: _style.inputCls,
151
152
  block: true,
152
- placeholder: placeholder
153
+ placeholder: placeholder,
154
+ status: status
153
155
  })));
154
156
  }.bind(void 0);
155
157
 
@@ -1,5 +1,5 @@
1
1
  import React, { InputHTMLAttributes, ReactNode } from 'react';
2
- import { Size } from '../../type';
2
+ import { Override, Size } from '../../type';
3
3
  export interface InputProps {
4
4
  /**
5
5
  * @deprecated 使用 suffix 替换
@@ -15,7 +15,7 @@ export interface InputProps {
15
15
  /** 尺寸 */
16
16
  size?: Size;
17
17
  /** 状态 */
18
- status?: 'error';
18
+ status?: 'default' | 'error';
19
19
  /** 展示变更为块占位 */
20
20
  block?: boolean;
21
21
  /** 点击 clear 按钮回调 */
@@ -37,5 +37,6 @@ export declare type InputRef = {
37
37
  /** input 元素 */
38
38
  input?: HTMLInputElement | null;
39
39
  };
40
+ export declare type FullInputProps = InputProps & Override<InputHTMLAttributes<HTMLInputElement>, InputProps>;
40
41
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<InputProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof InputProps> & React.RefAttributes<InputRef>>>;
41
42
  export default _default;
@@ -188,7 +188,7 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
188
188
  focused: focused,
189
189
  style: style,
190
190
  disabled: disabled,
191
- status: status || _status,
191
+ status: _status || status,
192
192
  customStyle: customStyle,
193
193
  empty: !value
194
194
  }, /*#__PURE__*/_react.default.createElement("span", {
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import NumberInput from '../../components/NumberInput';
3
3
  import Textarea from '../../components/Textarea';
4
+ import { FullInputProps as InputProps } from './Input';
4
5
  declare const ExportClassInput: import("react").ComponentClass<import("./Input").InputProps & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, keyof import("./Input").InputProps> & import("react").RefAttributes<import("./Input").InputRef>, any> & {
5
6
  Search: import("react").ComponentClass<import("./Search").SearchProps & import("./Input").InputProps & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, keyof import("./Input").InputProps> & import("react").RefAttributes<import("./Input").InputRef>, any>;
6
7
  Number: typeof NumberInput;
7
8
  Textarea: typeof Textarea;
8
9
  Sizes: ["sm", "md", "lg"];
9
10
  };
11
+ export type { InputProps };
10
12
  export default ExportClassInput;
@@ -285,7 +285,8 @@ var Popup = function Popup(_ref2) {
285
285
 
286
286
  return /*#__PURE__*/_react.default.createElement(_style.MenuWrap, null, search && /*#__PURE__*/_react.default.createElement(_style.SelectSearchInput, {
287
287
  onChange: handleSearchInput,
288
- value: searchValue
288
+ value: searchValue,
289
+ status: "default"
289
290
  }), children || options ? /*#__PURE__*/_react.default.createElement(_style.BlockMenu, {
290
291
  onChange: handleChange,
291
292
  customStyle: newCustomStyle,
@@ -57,6 +57,7 @@ var SearchInput = /*#__PURE__*/function (_Component) {
57
57
  (0, _newArrowCheck2.default)(this, _this);
58
58
  var handleSearch = _ref.handleSearch;
59
59
  return /*#__PURE__*/_react.default.createElement(_Input.default.Search, (0, _extends2.default)({
60
+ status: "default",
60
61
  onSearch: handleSearch
61
62
  }, rest));
62
63
  }.bind(this));
@@ -328,7 +328,8 @@ var Transfer = (_dec = (0, _uncontrolled.default)({
328
328
  block: true,
329
329
  onSearch: onSearch,
330
330
  onChange: onSearch,
331
- disabled: disabled
331
+ disabled: disabled,
332
+ status: "default"
332
333
  })), _this2.renderContent({
333
334
  part: part,
334
335
  dataSource: partDataSource,
@@ -66,6 +66,7 @@ var groupDataSource = function groupDataSource(dataSource) {
66
66
  var group = {};
67
67
  var allKeys = [];
68
68
  var allDisabledKeys = [];
69
+ if (!dataSource) dataSource = [];
69
70
 
70
71
  var _groupData2 = function _groupData(children, disabled) {
71
72
  var _this3 = this;
@@ -122,10 +123,10 @@ var keysToMap = function keysToMap() {
122
123
  return result;
123
124
  };
124
125
 
125
- var defaultSearchHandle = function defaultSearchHandle(searchValue, dataSource) {
126
+ var defaultSearchHandle = function defaultSearchHandle(searchValue) {
126
127
  var _this5 = this;
127
128
 
128
- (0, _newArrowCheck2.default)(this, _this);
129
+ var dataSource = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
129
130
  if (!searchValue) return {
130
131
  dataSource: dataSource,
131
132
  count: null
@@ -185,15 +186,14 @@ var defaultSearchHandle = function defaultSearchHandle(searchValue, dataSource)
185
186
  count: count,
186
187
  openKeys: Object.keys(finalExpandedKeyMap)
187
188
  };
188
- }.bind(void 0);
189
+ };
189
190
 
190
191
  var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
191
192
  var _this7 = this;
192
193
 
193
194
  (0, _newArrowCheck2.default)(this, _this);
194
195
 
195
- var _ref$dataSource = _ref.dataSource,
196
- dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource,
196
+ var dataSource = _ref.dataSource,
197
197
  _ref$disabled = _ref.disabled,
198
198
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
199
199
  _ref$multiple = _ref.multiple,
@@ -70,7 +70,8 @@ var Search = function Search(_ref) {
70
70
  prefix: prefix,
71
71
  onChange: handleChange,
72
72
  clearable: true,
73
- block: true
73
+ block: true,
74
+ status: "default"
74
75
  }), loading ? /*#__PURE__*/_react.default.createElement(_Loading.default, {
75
76
  loading: loading,
76
77
  className: _style.loadingCls
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucloud-fe/react-components",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "title": "UCloud react components",
5
5
  "description": "UCloud react components",
6
6
  "keywords": [