@douyinfe/semi-ui 2.0.6 → 2.0.9-alpha.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.
@@ -5,7 +5,6 @@ import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
5
5
  import { Position } from '../tooltip';
6
6
  import Option from '../select/option';
7
7
  import '@douyinfe/semi-foundation/lib/es/autoComplete/autoComplete.css';
8
- import '@douyinfe/semi-foundation/lib/es/select/option.css';
9
8
  import { Motion } from '../_base/base';
10
9
  /**
11
10
  * AutoComplete is an enhanced Input (candidates suggest that users can choose or not),
@@ -21,7 +21,6 @@ import Trigger from '../trigger';
21
21
  import Option from '../select/option';
22
22
  import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
23
23
  import '@douyinfe/semi-foundation/lib/es/autoComplete/autoComplete.css';
24
- import '@douyinfe/semi-foundation/lib/es/select/option.css';
25
24
  const prefixCls = cssClasses.PREFIX;
26
25
  const sizeSet = strings.SIZE;
27
26
  const positionSet = strings.POSITION;
@@ -8,4 +8,4 @@ export { QuickControlProps } from './quickControl';
8
8
  export { YearAndMonthProps } from './yearAndMonth';
9
9
  declare const _default: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<DatePicker>>;
10
10
  export default _default;
11
- export { BaseValueType, DayStatusType, DisabledDateOptions, DisabledDateType, DisabledTimeType, InputSize, Position, PresetType, PresetsType, TriggerRenderProps, ValidateStatus, ValueType, } from '@douyinfe/semi-foundation/datePicker/foundation';
11
+ export { BaseValueType, DayStatusType, DisabledDateOptions, DisabledDateType, DisabledTimeType, InputSize, Position, PresetType, PresetsType, TriggerRenderProps, ValidateStatus, ValueType, } from '@douyinfe/semi-foundation/lib/es/datePicker/foundation';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { withFieldOption } from '@douyinfe/semi-foundation/lib/es/form/interface';
2
+ import { WithFieldOption } from '@douyinfe/semi-foundation/lib/es/form/interface';
3
3
  import { CommonFieldProps, CommonexcludeType } from '../interface';
4
4
  import { Subtract } from 'utility-types';
5
5
  /**
@@ -8,5 +8,5 @@ import { Subtract } from 'utility-types';
8
8
  * 2. Insert <Label>
9
9
  * 3. Insert <ErrorMessage>
10
10
  */
11
- declare function withField<C extends React.ComponentType<React.ComponentProps<C>>, T extends React.ComponentType<Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps>>(Component: C, opts?: withFieldOption): T;
11
+ declare function withField<C extends React.ComponentType<React.ComponentProps<C>>, T extends React.ComponentType<Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps>>(Component: C, opts?: WithFieldOption): T;
12
12
  export default withField;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { Subtract } from 'utility-types';
3
3
  import type { RuleItem } from 'async-validator';
4
4
  import { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
5
- import { BaseFormApi as FormApi, FormState } from '@douyinfe/semi-foundation/lib/es/form/interface';
5
+ import { BaseFormApi as FormApi, FormState, WithFieldOption } from '@douyinfe/semi-foundation/lib/es/form/interface';
6
6
  import { SelectProps } from '../select/index';
7
7
  import Option from '../select/option';
8
8
  import OptGroup from '../select/optionGroup';
@@ -10,7 +10,7 @@ import { CheckboxProps } from '../checkbox/index';
10
10
  import { RadioProps } from '../radio/index';
11
11
  import { ReactFieldError as FieldError } from './errorMessage';
12
12
  import { LabelProps } from './label';
13
- export { FormState, FormApi };
13
+ export { FormState, FormApi, WithFieldOption };
14
14
  export declare type CommonFieldProps = {
15
15
  /** Field is required (except Form. Checkbox within the Group, Form. Radio) */
16
16
  field: string;
@@ -125,6 +125,7 @@ declare class Modal extends BaseComponent<ModalReactProps, ModalState> {
125
125
  componentWillUnmount(): void;
126
126
  handleCancel: (e: React.MouseEvent) => void;
127
127
  handleOk: (e: React.MouseEvent) => void;
128
+ updateHiddenState: () => void;
128
129
  renderFooter: () => ReactNode;
129
130
  renderDialog: () => JSX.Element;
130
131
  render(): JSX.Element;
@@ -45,6 +45,21 @@ class Modal extends BaseComponent {
45
45
  this.foundation.handleOk(e);
46
46
  };
47
47
 
48
+ this.updateHiddenState = () => {
49
+ const {
50
+ visible
51
+ } = this.props;
52
+ const {
53
+ hidden
54
+ } = this.state;
55
+
56
+ if (!visible && !hidden) {
57
+ this.foundation.toggleHidden(true, () => this.foundation.afterClose());
58
+ } else if (visible && this.state.hidden) {
59
+ this.foundation.toggleHidden(false);
60
+ }
61
+ };
62
+
48
63
  this.renderFooter = () => {
49
64
  const {
50
65
  okText,
@@ -123,7 +138,7 @@ class Modal extends BaseComponent {
123
138
  }
124
139
 
125
140
  const classList = cls(className, {
126
- ["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.hidden
141
+ ["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.hidden && !visible
127
142
  });
128
143
  const contentClassName = motion ? cls({
129
144
  ["".concat(cssClasses.DIALOG, "-content-animate-hide")]: !visible,
@@ -133,19 +148,6 @@ class Modal extends BaseComponent {
133
148
  ["".concat(cssClasses.DIALOG, "-mask-animate-hide")]: !visible,
134
149
  ["".concat(cssClasses.DIALOG, "-mask-animate-show")]: visible
135
150
  }) : null;
136
-
137
- const updateHiddenState = () => {
138
- if (!visible && !this.state.hidden) {
139
- this.foundation.toggleHidden(true);
140
- } else if (visible && this.state.hidden) {
141
- this.foundation.toggleHidden(false);
142
- }
143
- };
144
-
145
- if (!motion) {
146
- updateHiddenState();
147
- }
148
-
149
151
  return /*#__PURE__*/React.createElement(Portal, {
150
152
  style: wrapperStyle,
151
153
  getPopupContainer: getPopupContainer
@@ -159,7 +161,7 @@ class Modal extends BaseComponent {
159
161
  style: style,
160
162
  ref: this.modalRef,
161
163
  onAnimationEnd: () => {
162
- updateHiddenState();
164
+ this.updateHiddenState();
163
165
  },
164
166
  footer: renderFooter,
165
167
  onClose: this.handleCancel
@@ -212,11 +214,11 @@ class Modal extends BaseComponent {
212
214
  notifyClose: () => {
213
215
  this.props.afterClose();
214
216
  },
215
- toggleHidden: hidden => {
217
+ toggleHidden: (hidden, callback) => {
216
218
  if (hidden !== this.state.hidden) {
217
219
  this.setState({
218
220
  hidden
219
- });
221
+ }, callback || noop);
220
222
  }
221
223
  },
222
224
  notifyFullScreen: isFullScreen => {
@@ -232,17 +234,8 @@ class Modal extends BaseComponent {
232
234
  static getDerivedStateFromProps(props, prevState) {
233
235
  const newState = {};
234
236
 
235
- if (props.visible && prevState.hidden) {
236
- newState.hidden = false;
237
- }
238
-
239
237
  if (props.fullScreen !== prevState.isFullScreen) {
240
238
  newState.isFullScreen = props.fullScreen;
241
- } // if not using animation, need to update hidden state from props
242
-
243
-
244
- if (!props.visible && !props.motion && !prevState.hidden) {
245
- newState.hidden = true;
246
239
  }
247
240
 
248
241
  return newState;
@@ -276,6 +269,10 @@ class Modal extends BaseComponent {
276
269
  if (prevProps.visible && !this.props.visible) {
277
270
  this.foundation.afterHide();
278
271
  }
272
+
273
+ if (!this.props.motion) {
274
+ this.updateHiddenState();
275
+ }
279
276
  }
280
277
 
281
278
  componentWillUnmount() {
@@ -9,7 +9,7 @@ export { NoticeTransitionProps } from './NoticeTransition';
9
9
  export interface NoticeReactProps extends NoticeProps {
10
10
  style?: CSSProperties;
11
11
  }
12
- export { NoticeState, NotificationListProps, NotificationListState };
12
+ export { NoticeState, NotificationListProps, NotificationListState, ConfigProps };
13
13
  export declare type NoticesInPosition = {
14
14
  top: NoticeInstance[];
15
15
  topLeft: NoticeInstance[];
@@ -5,7 +5,6 @@ import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
5
5
  import Option, { OptionProps } from './option';
6
6
  import OptionGroup from './optionGroup';
7
7
  import '@douyinfe/semi-foundation/lib/es/select/select.css';
8
- import '@douyinfe/semi-foundation/lib/es/select/option.css';
9
8
  import { Position, TooltipProps } from '../tooltip';
10
9
  export { OptionProps } from './option';
11
10
  export { OptionGroupProps } from './optionGroup';
@@ -40,7 +40,6 @@ import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
40
40
  import { isSemiIcon } from '../_utils';
41
41
  import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
42
42
  import '@douyinfe/semi-foundation/lib/es/select/select.css';
43
- import '@douyinfe/semi-foundation/lib/es/select/option.css';
44
43
  const prefixcls = cssClasses.PREFIX;
45
44
  const key = 0; // Notes: Use the label of the option as the identifier, that is, the option in Select, the value is allowed to be the same, but the label must be unique
46
45
 
@@ -399,6 +399,7 @@ export default class Slider extends BaseComponent {
399
399
  },
400
400
  onHandleMove: function (mousePos, isMin) {
401
401
  let stateChangeCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
402
+ let clickTrack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
402
403
 
403
404
  const sliderDOMIsInRenderTree = _this.foundation.checkAndUpdateIsInRenderTreeState();
404
405
 
@@ -426,7 +427,8 @@ export default class Slider extends BaseComponent {
426
427
  if (!isEqual(_this.foundation.outPutValue(currentValue), outPutValue)) {
427
428
  onChange(outPutValue);
428
429
 
429
- if (_this.foundation.valueFormatIsCorrect(value)) {
430
+ if (!clickTrack && _this.foundation.valueFormatIsCorrect(value)) {
431
+ // still require afterChangeCallback when click on the track directly, need skip here
430
432
  return false;
431
433
  }
432
434
 
@@ -8,7 +8,7 @@ export interface SpinProps {
8
8
  spinning?: boolean;
9
9
  indicator?: React.ReactNode;
10
10
  delay?: number;
11
- tip?: string;
11
+ tip?: React.ReactNode;
12
12
  wrapperClassName?: string;
13
13
  style?: React.CSSProperties;
14
14
  childStyle?: React.CSSProperties;
@@ -25,7 +25,7 @@ declare class Spin extends BaseComponent<SpinProps, SpinState> {
25
25
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
26
26
  indicator: PropTypes.Requireable<PropTypes.ReactNodeLike>;
27
27
  delay: PropTypes.Requireable<number>;
28
- tip: PropTypes.Requireable<string>;
28
+ tip: PropTypes.Requireable<PropTypes.ReactNodeLike>;
29
29
  wrapperClassName: PropTypes.Requireable<string>;
30
30
  childStyle: PropTypes.Requireable<object>;
31
31
  style: PropTypes.Requireable<object>;
@@ -107,7 +107,7 @@ Spin.propTypes = {
107
107
  children: PropTypes.node,
108
108
  indicator: PropTypes.node,
109
109
  delay: PropTypes.number,
110
- tip: PropTypes.string,
110
+ tip: PropTypes.node,
111
111
  wrapperClassName: PropTypes.string,
112
112
  childStyle: PropTypes.object,
113
113
  style: PropTypes.object
@@ -35,7 +35,7 @@ export interface TableProps<RecordType extends Record<string, any> = any> extend
35
35
  id?: string;
36
36
  indentSize?: number;
37
37
  loading?: boolean;
38
- pagination?: Pagination;
38
+ pagination?: TablePagination;
39
39
  prefixCls?: string;
40
40
  renderGroupSection?: RenderGroupSection;
41
41
  renderPagination?: RenderPagination;
@@ -225,6 +225,7 @@ export declare type Size = ArrayElement<typeof strings.SIZES>;
225
225
  export declare type Title<RecordType> = React.ReactNode | ((pageData?: RecordType[]) => React.ReactNode);
226
226
  export declare type PaginationPosition = ArrayElement<typeof strings.PAGINATION_POSITIONS>;
227
227
  export declare type Pagination = TablePaginationProps | boolean;
228
+ export declare type TablePagination = Pagination;
228
229
  export interface ChangeInfoFilter<RecordType> extends BaseChangeInfoFilter<RecordType> {
229
230
  filters?: Filter[];
230
231
  onFilter?: OnFilter<RecordType>;
@@ -11,7 +11,7 @@ export interface ToastReactProps extends ToastProps {
11
11
  icon?: React.ReactNode;
12
12
  content: React.ReactNode;
13
13
  }
14
- export { ToastListProps, ToastListState, ToastState };
14
+ export { ConfigProps, ToastListProps, ToastListState, ToastState };
15
15
  declare const createBaseToast: () => {
16
16
  new (props: ToastListProps): {
17
17
  readonly adapter: ToastListAdapter;
@@ -7,6 +7,7 @@ import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
7
7
  import { ArrayElement } from '../_base/base';
8
8
  import { Locale } from '../locale/interface';
9
9
  import '@douyinfe/semi-foundation/lib/es/upload/upload.css';
10
+ export { BeforeUploadObjectResult, AfterUploadResult };
10
11
  export interface FileItem extends BaseFileItem {
11
12
  validateMessage?: ReactNode;
12
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.0.6",
3
+ "version": "2.0.9-alpha.0",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",
@@ -19,11 +19,11 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@babel/runtime-corejs3": "^7.15.4",
22
- "@douyinfe/semi-animation-react": "2.0.6",
23
- "@douyinfe/semi-foundation": "2.0.6",
24
- "@douyinfe/semi-icons": "2.0.6",
25
- "@douyinfe/semi-illustrations": "2.0.6",
26
- "@douyinfe/semi-theme-default": "2.0.6",
22
+ "@douyinfe/semi-animation-react": "2.0.8",
23
+ "@douyinfe/semi-foundation": "2.0.9-alpha.0",
24
+ "@douyinfe/semi-icons": "2.0.9-alpha.0",
25
+ "@douyinfe/semi-illustrations": "2.0.9-alpha.0",
26
+ "@douyinfe/semi-theme-default": "2.0.8",
27
27
  "async-validator": "^3.5.0",
28
28
  "classnames": "^2.2.6",
29
29
  "copy-text-to-clipboard": "^2.1.1",
@@ -64,13 +64,13 @@
64
64
  ],
65
65
  "author": "",
66
66
  "license": "MIT",
67
- "gitHead": "84d11e86280d92dd12ffe02bd8db93155a8626d2",
67
+ "gitHead": "cfbebccbd9c618b43a0eeca339980cea3723453d",
68
68
  "devDependencies": {
69
69
  "@babel/plugin-proposal-decorators": "^7.15.8",
70
70
  "@babel/plugin-transform-runtime": "^7.15.8",
71
71
  "@babel/preset-env": "^7.15.8",
72
72
  "@babel/preset-react": "^7.14.5",
73
- "@douyinfe/semi-scss-compile": "2.0.6",
73
+ "@douyinfe/semi-scss-compile": "2.0.8",
74
74
  "@storybook/addon-knobs": "^6.3.1",
75
75
  "babel-loader": "^8.2.2",
76
76
  "case-sensitive-paths-webpack-plugin": "^2.4.0",