@douyinfe/semi-ui 2.22.3 → 2.23.0-beta.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.
Files changed (57) hide show
  1. package/dist/css/semi.css +20 -1
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +440 -117
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/cascader/item.d.ts +1 -1
  8. package/lib/cjs/cascader/item.js +12 -6
  9. package/lib/cjs/form/baseForm.d.ts +4 -4
  10. package/lib/cjs/form/errorMessage.d.ts +2 -1
  11. package/lib/cjs/form/hooks/useFormState.d.ts +2 -1
  12. package/lib/cjs/form/interface.d.ts +15 -15
  13. package/lib/cjs/image/image.js +12 -0
  14. package/lib/cjs/image/interface.d.ts +1 -1
  15. package/lib/cjs/image/preview.d.ts +1 -1
  16. package/lib/cjs/image/preview.js +2 -2
  17. package/lib/cjs/image/previewImage.d.ts +1 -1
  18. package/lib/cjs/image/previewImage.js +1 -1
  19. package/lib/cjs/image/previewInner.d.ts +1 -1
  20. package/lib/cjs/image/previewInner.js +13 -5
  21. package/lib/cjs/locale/source/tr_TR.js +2 -2
  22. package/lib/cjs/navigation/Item.d.ts +3 -0
  23. package/lib/cjs/navigation/Item.js +9 -5
  24. package/lib/cjs/table/Body/index.js +2 -2
  25. package/lib/cjs/table/Table.js +3 -2
  26. package/lib/cjs/tagInput/index.d.ts +1 -1
  27. package/lib/cjs/tagInput/index.js +6 -4
  28. package/lib/cjs/tooltip/index.d.ts +8 -0
  29. package/lib/cjs/tooltip/index.js +2 -0
  30. package/lib/cjs/transfer/index.d.ts +1 -0
  31. package/lib/cjs/transfer/index.js +7 -1
  32. package/lib/es/cascader/item.d.ts +1 -1
  33. package/lib/es/cascader/item.js +12 -6
  34. package/lib/es/form/baseForm.d.ts +4 -4
  35. package/lib/es/form/errorMessage.d.ts +2 -1
  36. package/lib/es/form/hooks/useFormState.d.ts +2 -1
  37. package/lib/es/form/interface.d.ts +15 -15
  38. package/lib/es/image/image.js +11 -0
  39. package/lib/es/image/interface.d.ts +1 -1
  40. package/lib/es/image/preview.d.ts +1 -1
  41. package/lib/es/image/preview.js +2 -2
  42. package/lib/es/image/previewImage.d.ts +1 -1
  43. package/lib/es/image/previewImage.js +1 -1
  44. package/lib/es/image/previewInner.d.ts +1 -1
  45. package/lib/es/image/previewInner.js +13 -5
  46. package/lib/es/locale/source/tr_TR.js +2 -2
  47. package/lib/es/navigation/Item.d.ts +3 -0
  48. package/lib/es/navigation/Item.js +9 -5
  49. package/lib/es/table/Body/index.js +3 -3
  50. package/lib/es/table/Table.js +3 -2
  51. package/lib/es/tagInput/index.d.ts +1 -1
  52. package/lib/es/tagInput/index.js +6 -4
  53. package/lib/es/tooltip/index.d.ts +8 -0
  54. package/lib/es/tooltip/index.js +2 -0
  55. package/lib/es/transfer/index.d.ts +1 -0
  56. package/lib/es/transfer/index.js +7 -1
  57. package/package.json +7 -7
@@ -71,7 +71,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
71
71
  selected: boolean;
72
72
  loading: boolean;
73
73
  };
74
- renderIcon: (type: string) => JSX.Element;
74
+ renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
75
75
  highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
76
76
  renderFlattenOption: (data: Data[]) => JSX.Element;
77
77
  renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
@@ -118,27 +118,33 @@ class Item extends _react.PureComponent {
118
118
  return state;
119
119
  };
120
120
 
121
- this.renderIcon = type => {
121
+ this.renderIcon = function (type) {
122
+ let haveMarginLeft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
123
+
124
+ const finalCls = style => {
125
+ return style + (haveMarginLeft ? " ".concat(prefixcls, "-icon-left") : '');
126
+ };
127
+
122
128
  switch (type) {
123
129
  case 'child':
124
130
  return /*#__PURE__*/_react.default.createElement(_semiIcons.IconChevronRight, {
125
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand")
131
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand"))
126
132
  });
127
133
 
128
134
  case 'tick':
129
135
  return /*#__PURE__*/_react.default.createElement(_semiIcons.IconTick, {
130
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active")
136
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active"))
131
137
  });
132
138
 
133
139
  case 'loading':
134
140
  return /*#__PURE__*/_react.default.createElement(_spin.default, {
135
- wrapperClassName: "".concat(prefixcls, "-spin-icon")
141
+ wrapperClassName: finalCls("".concat(prefixcls, "-spin-icon"))
136
142
  });
137
143
 
138
144
  case 'empty':
139
145
  return /*#__PURE__*/_react.default.createElement("span", {
140
146
  "aria-hidden": true,
141
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty")
147
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty"))
142
148
  });
143
149
 
144
150
  default:
@@ -288,7 +294,7 @@ class Item extends _react.PureComponent {
288
294
  indeterminate: halfCheckedKeys.has(item.key),
289
295
  checked: checkedKeys.has(item.key),
290
296
  className: "".concat(prefixcls, "-label-checkbox")
291
- }), /*#__PURE__*/_react.default.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child') : null);
297
+ }), /*#__PURE__*/_react.default.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child', true) : null);
292
298
  })));
293
299
 
294
300
  if (showChildItem) {
@@ -11,7 +11,7 @@ import { BaseFormProps, FormApi } from './interface';
11
11
  interface BaseFormState {
12
12
  formId: string;
13
13
  }
14
- declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
14
+ declare class Form<Values extends Record<string, any> = any> extends BaseComponent<BaseFormProps<Values>, BaseFormState> {
15
15
  static propTypes: {
16
16
  'aria-label': PropTypes.Requireable<string>;
17
17
  onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
@@ -148,11 +148,11 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
148
148
  static InputGroup: typeof FormInputGroup;
149
149
  static Label: typeof Label;
150
150
  static Section: typeof Section;
151
- formApi: FormApi;
152
- constructor(props: BaseFormProps);
151
+ formApi: FormApi<Values>;
152
+ constructor(props: BaseFormProps<Values>);
153
153
  componentDidMount(): void;
154
154
  componentWillUnmount(): void;
155
- get adapter(): BaseFormAdapter<BaseFormProps, BaseFormState>;
155
+ get adapter(): BaseFormAdapter<BaseFormProps<Values>, BaseFormState, Values>;
156
156
  get content(): React.ReactNode;
157
157
  submit(e: React.FormEvent<HTMLFormElement>): void;
158
158
  reset(e: React.FormEvent<HTMLFormElement>): void;
@@ -1,6 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- export declare type ReactFieldError = Array<any> | React.ReactNode;
3
+ import type { BasicFieldError } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
4
+ export declare type ReactFieldError = BasicFieldError | React.ReactNode;
4
5
  export interface ErrorMessageProps {
5
6
  error?: ReactFieldError;
6
7
  className?: string;
@@ -1,2 +1,3 @@
1
- declare function useFormState(): import("@douyinfe/semi-foundation/lib/cjs/form/interface").FormState<any>;
1
+ import { FormState } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
2
+ declare function useFormState<T extends Record<string, any> = any>(): FormState<T>;
2
3
  export default useFormState;
@@ -1,16 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { Subtract } from 'utility-types';
3
3
  import type { RuleItem } from 'async-validator';
4
- import { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
5
- import { BaseFormApi as FormApi, FormState, WithFieldOption } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
6
- import { SelectProps } from '../select/index';
4
+ import type { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
5
+ import type { BaseFormApi as FormApi, FormState, WithFieldOption, AllErrors } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
6
+ import type { SelectProps } from '../select/index';
7
7
  import Option from '../select/option';
8
8
  import OptGroup from '../select/optionGroup';
9
- import { CheckboxProps } from '../checkbox/index';
10
- import { RadioProps } from '../radio/index';
9
+ import type { CheckboxProps } from '../checkbox/index';
10
+ import type { RadioProps } from '../radio/index';
11
11
  import { ReactFieldError as FieldError } from './errorMessage';
12
- import { LabelProps } from './label';
13
- export { FormState, FormApi, WithFieldOption, RuleItem };
12
+ import type { LabelProps } from './label';
13
+ export type { FormState, FormApi, WithFieldOption, RuleItem };
14
14
  export declare type CommonFieldProps = {
15
15
  /** Field is required (except Form. Checkbox within the Group, Form. Radio) */
16
16
  field: string;
@@ -81,19 +81,19 @@ export interface FormFCChild<K extends Record<string, any> = any> {
81
81
  values: K;
82
82
  formApi: FormApi<K>;
83
83
  }
84
- export interface BaseFormProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'children' | 'onChange'> {
84
+ export interface BaseFormProps<Values extends Record<string, any> = any> extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'children' | 'onChange' | 'onSubmit' | 'onReset'> {
85
85
  'aria-label'?: React.AriaAttributes['aria-label'];
86
- onSubmit?: (values: Record<string, any>) => void;
87
- onSubmitFail?: (errors: Record<string, FieldError>, values: any) => void;
86
+ onSubmit?: (values: Values) => void;
87
+ onSubmitFail?: (errors: Record<keyof Values, FieldError>, values: Partial<Values>) => void;
88
88
  onReset?: () => void;
89
- onValueChange?: (values: Record<string, any>, changedValue: Record<string, any>) => void;
90
- onChange?: (formState: FormState) => void;
91
- validateFields?: (values: Record<string, any>) => string | Record<string, any>;
89
+ onValueChange?: (values: Values, changedValue: Partial<Values>) => void;
90
+ onChange?: (formState: FormState<Values>) => void;
91
+ validateFields?: (values: Values) => string | Partial<AllErrors<Values>>;
92
92
  /** Use this if you want to populate the form with initial values. */
93
- initValues?: Record<string, any>;
93
+ initValues?: Values;
94
94
  id?: string;
95
95
  /** getFormApi will be call once when Form mounted, u can save formApi reference in your component */
96
- getFormApi?: (formApi: FormApi) => void;
96
+ getFormApi?: (formApi: FormApi<Values>) => void;
97
97
  style?: React.CSSProperties;
98
98
  className?: string;
99
99
  layout?: 'horizontal' | 'vertical';
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
9
9
 
10
+ var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
11
+
10
12
  var _react = _interopRequireDefault(require("react"));
11
13
 
12
14
  var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
@@ -153,6 +155,16 @@ class Image extends _baseComponent.default {
153
155
  willUpdateStates.loadStatus = "loading";
154
156
  }
155
157
 
158
+ if ((0, _isObject2.default)(props.preview)) {
159
+ const {
160
+ visible
161
+ } = props.preview;
162
+
163
+ if ((0, _isBoolean2.default)(visible)) {
164
+ willUpdateStates.previewVisible = visible;
165
+ }
166
+ }
167
+
156
168
  return willUpdateStates;
157
169
  }
158
170
 
@@ -60,7 +60,7 @@ export interface PreviewProps extends BaseProps {
60
60
  onPrev?: (index: number) => void;
61
61
  onNext?: (index: number) => void;
62
62
  onRatioChange?: (type: RatioType) => void;
63
- onRotateChange?: (angle: number) => void;
63
+ onRotateLeft?: (angle: number) => void;
64
64
  onDownload?: (src: string, index: number) => void;
65
65
  }
66
66
  export interface MenuProps {
@@ -44,8 +44,8 @@ export default class Preview extends BaseComponent<PreviewProps, PreviewState> {
44
44
  onPrev: PropTypes.Requireable<(...args: any[]) => any>;
45
45
  onNext: PropTypes.Requireable<(...args: any[]) => any>;
46
46
  onDownload: PropTypes.Requireable<(...args: any[]) => any>;
47
+ onRotateLeft: PropTypes.Requireable<(...args: any[]) => any>;
47
48
  onRatioChange: PropTypes.Requireable<(...args: any[]) => any>;
48
- onRotateChange: PropTypes.Requireable<(...args: any[]) => any>;
49
49
  };
50
50
  static defaultProps: {
51
51
  src: any[];
@@ -241,8 +241,8 @@ Preview.propTypes = {
241
241
  onPrev: _propTypes.default.func,
242
242
  onNext: _propTypes.default.func,
243
243
  onDownload: _propTypes.default.func,
244
- onRatioChange: _propTypes.default.func,
245
- onRotateChange: _propTypes.default.func
244
+ onRotateLeft: _propTypes.default.func,
245
+ onRatioChange: _propTypes.default.func
246
246
  };
247
247
  Preview.defaultProps = {
248
248
  src: [],
@@ -13,7 +13,7 @@ export default class PreviewImage extends BaseComponent<PreviewImageProps, Previ
13
13
  zoomStep: PropTypes.Requireable<number>;
14
14
  zoom: PropTypes.Requireable<number>;
15
15
  ratio: PropTypes.Requireable<string>;
16
- disableDownload: PropTypes.Requireable<number>;
16
+ disableDownload: PropTypes.Requireable<boolean>;
17
17
  clickZoom: PropTypes.Requireable<number>;
18
18
  setRatio: PropTypes.Requireable<(...args: any[]) => any>;
19
19
  onZoom: PropTypes.Requireable<(...args: any[]) => any>;
@@ -241,7 +241,7 @@ PreviewImage.propTypes = {
241
241
  zoomStep: _propTypes.default.number,
242
242
  zoom: _propTypes.default.number,
243
243
  ratio: _propTypes.default.string,
244
- disableDownload: _propTypes.default.number,
244
+ disableDownload: _propTypes.default.bool,
245
245
  clickZoom: _propTypes.default.number,
246
246
  setRatio: _propTypes.default.func,
247
247
  onZoom: _propTypes.default.func,
@@ -45,7 +45,7 @@ export default class PreviewInner extends BaseComponent<PreviewInnerProps, Previ
45
45
  onNext: PropTypes.Requireable<(...args: any[]) => any>;
46
46
  onDownload: PropTypes.Requireable<(...args: any[]) => any>;
47
47
  onRatioChange: PropTypes.Requireable<(...args: any[]) => any>;
48
- onRotateChange: PropTypes.Requireable<(...args: any[]) => any>;
48
+ onRotateLeft: PropTypes.Requireable<(...args: any[]) => any>;
49
49
  };
50
50
  static defaultProps: {
51
51
  showTooltip: boolean;
@@ -127,11 +127,19 @@ class PreviewInner extends _baseComponent.default {
127
127
  get adapter() {
128
128
  return Object.assign(Object.assign({}, super.adapter), {
129
129
  getIsInGroup: () => this.isInGroup(),
130
- notifyChange: index => {
130
+ notifyChange: (index, direction) => {
131
131
  const {
132
- onChange
132
+ onChange,
133
+ onPrev,
134
+ onNext
133
135
  } = this.props;
134
136
  (0, _isFunction2.default)(onChange) && onChange(index);
137
+
138
+ if (direction === "prev") {
139
+ onPrev && onPrev(index);
140
+ } else {
141
+ onNext && onNext(index);
142
+ }
135
143
  },
136
144
  notifyZoom: (zoom, increase) => {
137
145
  const {
@@ -165,9 +173,9 @@ class PreviewInner extends _baseComponent.default {
165
173
  },
166
174
  notifyRotateChange: angle => {
167
175
  const {
168
- onRotateChange
176
+ onRotateLeft
169
177
  } = this.props;
170
- (0, _isFunction2.default)(onRotateChange) && onRotateChange(angle);
178
+ (0, _isFunction2.default)(onRotateLeft) && onRotateLeft(angle);
171
179
  },
172
180
  notifyDownload: (src, index) => {
173
181
  const {
@@ -427,7 +435,7 @@ PreviewInner.propTypes = {
427
435
  onNext: _propTypes.default.func,
428
436
  onDownload: _propTypes.default.func,
429
437
  onRatioChange: _propTypes.default.func,
430
- onRotateChange: _propTypes.default.func
438
+ onRotateLeft: _propTypes.default.func
431
439
  };
432
440
  PreviewInner.defaultProps = {
433
441
  showTooltip: false,
@@ -88,8 +88,8 @@ const local = {
88
88
  Wed: 'Çar',
89
89
  Thu: 'Perş',
90
90
  Fri: 'Cum',
91
- Sat: 'Oturdu',
92
- Sun: 'Güneş'
91
+ Sat: 'Cmt',
92
+ Sun: 'Paz'
93
93
  },
94
94
  localeFormatToken: {
95
95
  FORMAT_SWITCH_DATE: 'yyyy-MM-dd'
@@ -12,6 +12,7 @@ export interface NavItemProps extends ItemProps, BaseProps {
12
12
  level?: number;
13
13
  link?: string;
14
14
  linkOptions?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
15
+ tabIndex?: number;
15
16
  text?: React.ReactNode;
16
17
  tooltipHideDelay?: number;
17
18
  tooltipShowDelay?: number;
@@ -45,6 +46,7 @@ export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
45
46
  link: PropTypes.Requireable<string>;
46
47
  linkOptions: PropTypes.Requireable<object>;
47
48
  disabled: PropTypes.Requireable<boolean>;
49
+ tabIndex: PropTypes.Requireable<number>;
48
50
  };
49
51
  static defaultProps: {
50
52
  isSubNav: boolean;
@@ -55,6 +57,7 @@ export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
55
57
  onMouseEnter: (...args: any[]) => void;
56
58
  onMouseLeave: (...args: any[]) => void;
57
59
  disabled: boolean;
60
+ tabIndex: number;
58
61
  };
59
62
  foundation: ItemFoundation;
60
63
  context: NavContextType;
@@ -170,7 +170,8 @@ class NavItem extends _baseComponent.default {
170
170
  link,
171
171
  linkOptions,
172
172
  disabled,
173
- level = 0
173
+ level = 0,
174
+ tabIndex
174
175
  } = this.props;
175
176
  const {
176
177
  mode,
@@ -233,7 +234,8 @@ class NavItem extends _baseComponent.default {
233
234
  ["".concat(clsPrefix, "-sub")]: isSubNav,
234
235
  ["".concat(clsPrefix, "-selected")]: selected && !isSubNav,
235
236
  ["".concat(clsPrefix, "-collapsed")]: isCollapsed,
236
- ["".concat(clsPrefix, "-disabled")]: disabled
237
+ ["".concat(clsPrefix, "-disabled")]: disabled,
238
+ ["".concat(clsPrefix, "-has-link")]: typeof link === 'string'
237
239
  });
238
240
  const ariaProps = {
239
241
  'aria-disabled': disabled
@@ -250,7 +252,7 @@ class NavItem extends _baseComponent.default {
250
252
  _react.default.createElement("li", Object.assign({
251
253
  // if role = menuitem, the narration will read all expanded li
252
254
  role: isSubNav ? null : "menuitem",
253
- tabIndex: isSubNav ? -1 : 0
255
+ tabIndex: isSubNav ? -1 : tabIndex
254
256
  }, ariaProps, {
255
257
  style: style,
256
258
  ref: this.setItemRef,
@@ -291,7 +293,8 @@ NavItem.propTypes = {
291
293
  isSubNav: _propTypes.default.bool,
292
294
  link: _propTypes.default.string,
293
295
  linkOptions: _propTypes.default.object,
294
- disabled: _propTypes.default.bool
296
+ disabled: _propTypes.default.bool,
297
+ tabIndex: _propTypes.default.number
295
298
  };
296
299
  NavItem.defaultProps = {
297
300
  isSubNav: false,
@@ -301,5 +304,6 @@ NavItem.defaultProps = {
301
304
  onClick: _noop2.default,
302
305
  onMouseEnter: _noop2.default,
303
306
  onMouseLeave: _noop2.default,
304
- disabled: false
307
+ disabled: false,
308
+ tabIndex: 0
305
309
  };
@@ -269,7 +269,7 @@ class Body extends _baseComponent.default {
269
269
  width: tableWidth
270
270
  },
271
271
  className: tableCls
272
- }, (0, _size2.default)(dataSource) === 0 ? emptySlot : children));
272
+ }, children), (0, _size2.default)(dataSource) === 0 && emptySlot);
273
273
  });
274
274
 
275
275
  this.onItemsRendered = props => {
@@ -308,7 +308,7 @@ class Body extends _baseComponent.default {
308
308
 
309
309
  const listStyle = {
310
310
  width: '100%',
311
- height: (virtualizedData === null || virtualizedData === void 0 ? void 0 : virtualizedData.length) ? y : 0,
311
+ height: (virtualizedData === null || virtualizedData === void 0 ? void 0 : virtualizedData.length) ? y : _constants.numbers.DEFAULT_EMPTYSLOT_HEIGHT,
312
312
  overflowX: 'auto',
313
313
  overflowY: 'auto'
314
314
  };
@@ -678,8 +678,9 @@ class Table extends _baseComponent.default {
678
678
  useFixedHeader,
679
679
  headerRef: this._cacheHeaderRef,
680
680
  bodyRef: this.bodyWrapRef,
681
- includeHeader: !useFixedHeader
682
- })), emptySlot, this.renderFooter(props)];
681
+ includeHeader: !useFixedHeader,
682
+ emptySlot
683
+ })), this.renderFooter(props)];
683
684
  return table;
684
685
  };
685
686
 
@@ -37,7 +37,7 @@ export interface TagInputProps {
37
37
  insetLabel?: React.ReactNode;
38
38
  insetLabelId?: string;
39
39
  prefix?: React.ReactNode;
40
- renderTagItem?: (value: string, index: number) => React.ReactNode;
40
+ renderTagItem?: (value: string, index: number, onClose: () => void) => React.ReactNode;
41
41
  separator?: string | string[] | null;
42
42
  showClear?: boolean;
43
43
  size?: Size;
@@ -152,20 +152,22 @@ class TagInput extends _baseComponent.default {
152
152
  return tagsArray.map((value, index) => {
153
153
  const elementKey = showIconHandler ? value : "".concat(index).concat(value);
154
154
 
155
+ const onClose = () => {
156
+ !disabled && this.handleTagClose(index);
157
+ };
158
+
155
159
  if ((0, _isFunction2.default)(renderTagItem)) {
156
160
  return showIconHandler ? /*#__PURE__*/_react.default.createElement("div", {
157
161
  className: itemWrapperCls,
158
162
  key: elementKey
159
- }, /*#__PURE__*/_react.default.createElement(DragHandle, null), renderTagItem(value, index)) : renderTagItem(value, index);
163
+ }, /*#__PURE__*/_react.default.createElement(DragHandle, null), renderTagItem(value, index, onClose)) : renderTagItem(value, index, onClose);
160
164
  } else {
161
165
  return /*#__PURE__*/_react.default.createElement(_tag.default, {
162
166
  className: tagCls,
163
167
  color: "white",
164
168
  size: size === 'small' ? 'small' : 'large',
165
169
  type: "light",
166
- onClose: () => {
167
- !disabled && this.handleTagClose(index);
168
- },
170
+ onClose: onClose,
169
171
  closable: !disabled,
170
172
  key: elementKey,
171
173
  visible: true,
@@ -37,6 +37,12 @@ export interface TooltipProps extends BaseProps {
37
37
  onVisibleChange?: (visible: boolean) => void;
38
38
  onClickOutSide?: (e: React.MouseEvent) => void;
39
39
  spacing?: number;
40
+ margin?: number | {
41
+ marginLeft: number;
42
+ marginTop: number;
43
+ marginRight: number;
44
+ marginBottom: number;
45
+ };
40
46
  showArrow?: boolean | React.ReactNode;
41
47
  zIndex?: number;
42
48
  rePosKey?: string | number;
@@ -96,6 +102,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
96
102
  onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
97
103
  onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
98
104
  spacing: PropTypes.Requireable<number>;
105
+ margin: PropTypes.Requireable<NonNullable<number | object>>;
99
106
  showArrow: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
100
107
  zIndex: PropTypes.Requireable<number>;
101
108
  rePosKey: PropTypes.Requireable<NonNullable<string | number>>;
@@ -134,6 +141,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
134
141
  onVisibleChange: (...args: any[]) => void;
135
142
  onClickOutSide: (...args: any[]) => void;
136
143
  spacing: 8;
144
+ margin: 0;
137
145
  showArrow: boolean;
138
146
  wrapWhenSpecial: boolean;
139
147
  zIndex: 1060;
@@ -728,6 +728,7 @@ Tooltip.propTypes = {
728
728
  onVisibleChange: _propTypes.default.func,
729
729
  onClickOutSide: _propTypes.default.func,
730
730
  spacing: _propTypes.default.number,
731
+ margin: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.object]),
731
732
  showArrow: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.node]),
732
733
  zIndex: _propTypes.default.number,
733
734
  rePosKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
@@ -757,6 +758,7 @@ Tooltip.defaultProps = {
757
758
  onVisibleChange: _noop2.default,
758
759
  onClickOutSide: _noop2.default,
759
760
  spacing: _constants2.numbers.SPACING,
761
+ margin: _constants2.numbers.MARGIN,
760
762
  showArrow: true,
761
763
  wrapWhenSpecial: true,
762
764
  zIndex: _constants2.numbers.DEFAULT_Z_INDEX,
@@ -152,6 +152,7 @@ declare class Transfer extends BaseComponent<TransferProps, TransferState> {
152
152
  static getDerivedStateFromProps(props: TransferProps, state: TransferState): TransferState;
153
153
  get adapter(): TransferAdapter<TransferProps, TransferState>;
154
154
  onInputChange(value: string): void;
155
+ search(value: string): void;
155
156
  onSelectOrRemove(item: ResolvedDataItem): void;
156
157
  onSortEnd(callbackProps: OnSortEndProps): void;
157
158
  renderFilter(locale: Locale['Transfer']): JSX.Element;
@@ -155,7 +155,13 @@ class Transfer extends _baseComponent.default {
155
155
  }
156
156
 
157
157
  onInputChange(value) {
158
- this.foundation.handleInputChange(value);
158
+ this.foundation.handleInputChange(value, true);
159
+ }
160
+
161
+ search(value) {
162
+ // The search method is used to provide the user with a manually triggered search
163
+ // Since the method is manually called by the user, setting the second parameter to false does not trigger the onSearch callback to notify the user
164
+ this.foundation.handleInputChange(value, false);
159
165
  }
160
166
 
161
167
  onSelectOrRemove(item) {
@@ -71,7 +71,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
71
71
  selected: boolean;
72
72
  loading: boolean;
73
73
  };
74
- renderIcon: (type: string) => JSX.Element;
74
+ renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
75
75
  highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
76
76
  renderFlattenOption: (data: Data[]) => JSX.Element;
77
77
  renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
@@ -93,27 +93,33 @@ export default class Item extends PureComponent {
93
93
  return state;
94
94
  };
95
95
 
96
- this.renderIcon = type => {
96
+ this.renderIcon = function (type) {
97
+ let haveMarginLeft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
98
+
99
+ const finalCls = style => {
100
+ return style + (haveMarginLeft ? " ".concat(prefixcls, "-icon-left") : '');
101
+ };
102
+
97
103
  switch (type) {
98
104
  case 'child':
99
105
  return /*#__PURE__*/React.createElement(IconChevronRight, {
100
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand")
106
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand"))
101
107
  });
102
108
 
103
109
  case 'tick':
104
110
  return /*#__PURE__*/React.createElement(IconTick, {
105
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active")
111
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active"))
106
112
  });
107
113
 
108
114
  case 'loading':
109
115
  return /*#__PURE__*/React.createElement(Spin, {
110
- wrapperClassName: "".concat(prefixcls, "-spin-icon")
116
+ wrapperClassName: finalCls("".concat(prefixcls, "-spin-icon"))
111
117
  });
112
118
 
113
119
  case 'empty':
114
120
  return /*#__PURE__*/React.createElement("span", {
115
121
  "aria-hidden": true,
116
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty")
122
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty"))
117
123
  });
118
124
 
119
125
  default:
@@ -261,7 +267,7 @@ export default class Item extends PureComponent {
261
267
  indeterminate: halfCheckedKeys.has(item.key),
262
268
  checked: checkedKeys.has(item.key),
263
269
  className: "".concat(prefixcls, "-label-checkbox")
264
- }), /*#__PURE__*/React.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child') : null);
270
+ }), /*#__PURE__*/React.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child', true) : null);
265
271
  })));
266
272
 
267
273
  if (showChildItem) {
@@ -11,7 +11,7 @@ import { BaseFormProps, FormApi } from './interface';
11
11
  interface BaseFormState {
12
12
  formId: string;
13
13
  }
14
- declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
14
+ declare class Form<Values extends Record<string, any> = any> extends BaseComponent<BaseFormProps<Values>, BaseFormState> {
15
15
  static propTypes: {
16
16
  'aria-label': PropTypes.Requireable<string>;
17
17
  onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
@@ -148,11 +148,11 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
148
148
  static InputGroup: typeof FormInputGroup;
149
149
  static Label: typeof Label;
150
150
  static Section: typeof Section;
151
- formApi: FormApi;
152
- constructor(props: BaseFormProps);
151
+ formApi: FormApi<Values>;
152
+ constructor(props: BaseFormProps<Values>);
153
153
  componentDidMount(): void;
154
154
  componentWillUnmount(): void;
155
- get adapter(): BaseFormAdapter<BaseFormProps, BaseFormState>;
155
+ get adapter(): BaseFormAdapter<BaseFormProps<Values>, BaseFormState, Values>;
156
156
  get content(): React.ReactNode;
157
157
  submit(e: React.FormEvent<HTMLFormElement>): void;
158
158
  reset(e: React.FormEvent<HTMLFormElement>): void;
@@ -1,6 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- export declare type ReactFieldError = Array<any> | React.ReactNode;
3
+ import type { BasicFieldError } from '@douyinfe/semi-foundation/lib/es/form/interface';
4
+ export declare type ReactFieldError = BasicFieldError | React.ReactNode;
4
5
  export interface ErrorMessageProps {
5
6
  error?: ReactFieldError;
6
7
  className?: string;
@@ -1,2 +1,3 @@
1
- declare function useFormState(): import("@douyinfe/semi-foundation/lib/es/form/interface").FormState<any>;
1
+ import { FormState } from '@douyinfe/semi-foundation/lib/es/form/interface';
2
+ declare function useFormState<T extends Record<string, any> = any>(): FormState<T>;
2
3
  export default useFormState;