@douyinfe/semi-ui 2.1.0-beta.1 → 2.1.0-beta.2
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/dist/css/semi.css +1 -13
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +73 -197
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/es/button/index.d.ts +1 -0
- package/lib/es/button/index.js +2 -1
- package/lib/es/cascader/index.d.ts +0 -1
- package/lib/es/cascader/index.js +3 -15
- package/lib/es/datePicker/index.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.js +1 -1
- package/lib/es/iconButton/index.d.ts +1 -0
- package/lib/es/iconButton/index.js +1 -0
- package/lib/es/navigation/index.d.ts +1 -1
- package/lib/es/popconfirm/index.d.ts +1 -5
- package/lib/es/popconfirm/index.js +4 -10
- package/lib/es/popover/index.d.ts +1 -3
- package/lib/es/popover/index.js +8 -4
- package/lib/es/radio/context.d.ts +1 -1
- package/lib/es/radio/radio.d.ts +2 -2
- package/lib/es/radio/radioGroup.d.ts +4 -4
- package/lib/es/select/index.js +9 -16
- package/lib/es/select/option.js +2 -2
- package/lib/es/select/utils.d.ts +1 -1
- package/lib/es/select/utils.js +4 -10
- package/lib/es/table/interface.d.ts +2 -1
- package/lib/es/tabs/TabBar.d.ts +2 -4
- package/lib/es/tabs/TabBar.js +4 -12
- package/lib/es/tabs/TabPane.d.ts +1 -2
- package/lib/es/tabs/TabPane.js +2 -3
- package/lib/es/tabs/index.d.ts +2 -4
- package/lib/es/tabs/index.js +14 -83
- package/lib/es/tabs/interface.d.ts +1 -6
- package/lib/es/tagInput/index.d.ts +0 -3
- package/lib/es/tagInput/index.js +1 -6
- package/lib/es/toast/index.d.ts +1 -1
- package/lib/es/tooltip/index.d.ts +0 -3
- package/lib/es/tooltip/index.js +0 -3
- package/lib/es/tree/interface.d.ts +2 -2
- package/lib/es/treeSelect/index.d.ts +11 -2
- package/package.json +8 -8
package/lib/es/button/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
14
14
|
loading: import("prop-types").Requireable<boolean>;
|
|
15
15
|
prefixCls: import("prop-types").Requireable<string>;
|
|
16
16
|
icon: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
17
|
+
iconType: import("prop-types").Requireable<import("prop-types").ReactElementLike>;
|
|
17
18
|
iconSize: import("prop-types").Requireable<string>;
|
|
18
19
|
noHorizontalPadding: import("prop-types").Requireable<string | boolean | any[]>;
|
|
19
20
|
children: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
package/lib/es/button/index.js
CHANGED
|
@@ -12,7 +12,8 @@ class Button extends React.PureComponent {
|
|
|
12
12
|
render() {
|
|
13
13
|
const props = _Object$assign({}, this.props);
|
|
14
14
|
|
|
15
|
-
const hasIcon = Boolean(props.icon);
|
|
15
|
+
const hasIcon = Boolean(props.icon || props.iconType); // TODO: iconType needs to be confirmed
|
|
16
|
+
|
|
16
17
|
const isLoading = Boolean(props.loading);
|
|
17
18
|
const isDisabled = Boolean(props.disabled);
|
|
18
19
|
|
|
@@ -7,7 +7,6 @@ import Input from '../input/index';
|
|
|
7
7
|
import { PopoverProps } from '../popover/index';
|
|
8
8
|
import { CascaderData, Entities, Entity, Data } from './item';
|
|
9
9
|
import { Motion } from '../_base/base';
|
|
10
|
-
export { CascaderType, ShowNextType } from '@douyinfe/semi-foundation/cascader/foundation';
|
|
11
10
|
export { CascaderData, Entity, Data, CascaderItemProps } from './item';
|
|
12
11
|
export interface ScrollPanelProps extends BasicScrollPanelProps {
|
|
13
12
|
activeNode: CascaderData;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -272,27 +272,15 @@ class Cascader extends BaseComponent {
|
|
|
272
272
|
this.renderCustomTrigger = () => {
|
|
273
273
|
const {
|
|
274
274
|
disabled,
|
|
275
|
-
triggerRender
|
|
276
|
-
multiple,
|
|
277
|
-
autoMergeValue
|
|
275
|
+
triggerRender
|
|
278
276
|
} = this.props;
|
|
279
277
|
const {
|
|
280
278
|
selectedKeys,
|
|
281
279
|
inputValue,
|
|
282
|
-
inputPlaceHolder
|
|
283
|
-
mergedCheckedKeys,
|
|
284
|
-
checkedKeys
|
|
280
|
+
inputPlaceHolder
|
|
285
281
|
} = this.state;
|
|
286
|
-
let realValue;
|
|
287
|
-
|
|
288
|
-
if (multiple) {
|
|
289
|
-
realValue = autoMergeValue ? mergedCheckedKeys : checkedKeys;
|
|
290
|
-
} else {
|
|
291
|
-
realValue = [...selectedKeys][0];
|
|
292
|
-
}
|
|
293
|
-
|
|
294
282
|
return /*#__PURE__*/React.createElement(Trigger, {
|
|
295
|
-
value:
|
|
283
|
+
value: [...selectedKeys][0],
|
|
296
284
|
inputValue: inputValue,
|
|
297
285
|
onChange: this.handleInputChange,
|
|
298
286
|
onClear: this.handleClear,
|
|
@@ -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';
|
|
@@ -220,7 +220,7 @@ class YearAndMonth extends BaseComponent {
|
|
|
220
220
|
className: prefix
|
|
221
221
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
222
222
|
noHorizontalPadding: false,
|
|
223
|
-
|
|
223
|
+
iconType: /*#__PURE__*/React.createElement(IconChevronLeft, {
|
|
224
224
|
size: iconSize
|
|
225
225
|
}),
|
|
226
226
|
size: buttonSize,
|
|
@@ -32,6 +32,7 @@ declare class IconButton extends PureComponent<IconButtonProps> {
|
|
|
32
32
|
loading: PropTypes.Requireable<boolean>;
|
|
33
33
|
prefixCls: PropTypes.Requireable<string>;
|
|
34
34
|
icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
35
|
+
iconType: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
35
36
|
iconSize: PropTypes.Requireable<string>;
|
|
36
37
|
noHorizontalPadding: PropTypes.Requireable<string | boolean | any[]>;
|
|
37
38
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -108,6 +108,7 @@ IconButton.propTypes = {
|
|
|
108
108
|
loading: PropTypes.bool,
|
|
109
109
|
prefixCls: PropTypes.string,
|
|
110
110
|
icon: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.node]),
|
|
111
|
+
iconType: PropTypes.element,
|
|
111
112
|
iconSize: PropTypes.oneOf(iconSizes),
|
|
112
113
|
noHorizontalPadding: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.array]),
|
|
113
114
|
children: PropTypes.node,
|
|
@@ -7,7 +7,7 @@ import Item, { NavItemProps } from './Item';
|
|
|
7
7
|
import Footer, { NavFooterProps } from './Footer';
|
|
8
8
|
import Header, { NavHeaderProps } from './Header';
|
|
9
9
|
import '@douyinfe/semi-foundation/lib/es/navigation/navigation.css';
|
|
10
|
-
import { Motion } from '_base/base';
|
|
10
|
+
import { Motion } from '../_base/base';
|
|
11
11
|
export { CollapseButtonProps } from './CollapseButton';
|
|
12
12
|
export { NavFooterProps } from './Footer';
|
|
13
13
|
export { NavHeaderProps } from './Header';
|
|
@@ -29,7 +29,6 @@ export interface PopconfirmProps extends PopoverProps {
|
|
|
29
29
|
onCancel?: (e: React.MouseEvent) => void;
|
|
30
30
|
onConfirm?: (e: React.MouseEvent) => void;
|
|
31
31
|
onVisibleChange?: (visible: boolean) => void;
|
|
32
|
-
onClickOutSide?: (e: React.MouseEvent) => void;
|
|
33
32
|
}
|
|
34
33
|
export interface PopconfirmState {
|
|
35
34
|
visible: boolean;
|
|
@@ -51,14 +50,13 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
51
50
|
cancelType: PropTypes.Requireable<string>;
|
|
52
51
|
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
52
|
onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
|
-
|
|
53
|
+
zIndex: PropTypes.Requireable<number>;
|
|
55
54
|
onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
56
55
|
visible: PropTypes.Requireable<boolean>;
|
|
57
56
|
defaultVisible: PropTypes.Requireable<boolean>;
|
|
58
57
|
okButtonProps: PropTypes.Requireable<object>;
|
|
59
58
|
cancelButtonProps: PropTypes.Requireable<object>;
|
|
60
59
|
stopPropagation: PropTypes.Requireable<string | boolean>;
|
|
61
|
-
zIndex: PropTypes.Requireable<number>;
|
|
62
60
|
trigger: PropTypes.Requireable<string>;
|
|
63
61
|
position: PropTypes.Requireable<string>;
|
|
64
62
|
};
|
|
@@ -74,7 +72,6 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
74
72
|
zIndex: number;
|
|
75
73
|
onCancel: (...args: any[]) => void;
|
|
76
74
|
onConfirm: (...args: any[]) => void;
|
|
77
|
-
onClickOutSide: (...args: any[]) => void;
|
|
78
75
|
};
|
|
79
76
|
constructor(props: PopconfirmProps);
|
|
80
77
|
static getDerivedStateFromProps(props: PopconfirmProps, state: PopconfirmState): Partial<PopconfirmState>;
|
|
@@ -82,7 +79,6 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
82
79
|
handleCancel: (e: React.MouseEvent) => void;
|
|
83
80
|
handleConfirm: (e: React.MouseEvent) => void;
|
|
84
81
|
handleVisibleChange: (visible: boolean) => void;
|
|
85
|
-
handleClickOutSide: (e: React.MouseEvent) => any;
|
|
86
82
|
stopImmediatePropagation: (e: React.SyntheticEvent) => void;
|
|
87
83
|
renderControls(): JSX.Element;
|
|
88
84
|
renderConfirmPopCard(): JSX.Element;
|
|
@@ -38,8 +38,6 @@ export default class Popconfirm extends BaseComponent {
|
|
|
38
38
|
|
|
39
39
|
this.handleVisibleChange = visible => this.foundation.handleVisibleChange(visible);
|
|
40
40
|
|
|
41
|
-
this.handleClickOutSide = e => this.foundation.handleClickOutSide(e);
|
|
42
|
-
|
|
43
41
|
this.stopImmediatePropagation = e => e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
|
|
44
42
|
|
|
45
43
|
this.state = {
|
|
@@ -68,8 +66,7 @@ export default class Popconfirm extends BaseComponent {
|
|
|
68
66
|
}),
|
|
69
67
|
notifyConfirm: e => this.props.onConfirm(e),
|
|
70
68
|
notifyCancel: e => this.props.onCancel(e),
|
|
71
|
-
notifyVisibleChange: visible => this.props.onVisibleChange(visible)
|
|
72
|
-
notifyClickOutSide: e => this.props.onClickOutSide(e)
|
|
69
|
+
notifyVisibleChange: visible => this.props.onVisibleChange(visible)
|
|
73
70
|
});
|
|
74
71
|
}
|
|
75
72
|
|
|
@@ -168,8 +165,7 @@ export default class Popconfirm extends BaseComponent {
|
|
|
168
165
|
const popContent = this.renderConfirmPopCard();
|
|
169
166
|
const popProps = {
|
|
170
167
|
onVisibleChange: this.handleVisibleChange,
|
|
171
|
-
className: cssClasses.POPOVER
|
|
172
|
-
onClickOutSide: this.handleClickOutSide
|
|
168
|
+
className: cssClasses.POPOVER
|
|
173
169
|
};
|
|
174
170
|
|
|
175
171
|
if (this.isControlled('visible')) {
|
|
@@ -200,14 +196,13 @@ Popconfirm.propTypes = {
|
|
|
200
196
|
cancelType: PropTypes.string,
|
|
201
197
|
onCancel: PropTypes.func,
|
|
202
198
|
onConfirm: PropTypes.func,
|
|
203
|
-
|
|
199
|
+
zIndex: PropTypes.number,
|
|
204
200
|
onVisibleChange: PropTypes.func,
|
|
205
201
|
visible: PropTypes.bool,
|
|
206
202
|
defaultVisible: PropTypes.bool,
|
|
207
203
|
okButtonProps: PropTypes.object,
|
|
208
204
|
cancelButtonProps: PropTypes.object,
|
|
209
205
|
stopPropagation: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
210
|
-
zIndex: PropTypes.number,
|
|
211
206
|
// private
|
|
212
207
|
trigger: PropTypes.string,
|
|
213
208
|
position: PropTypes.string
|
|
@@ -226,6 +221,5 @@ Popconfirm.defaultProps = {
|
|
|
226
221
|
prefixCls: cssClasses.PREFIX,
|
|
227
222
|
zIndex: numbers.DEFAULT_Z_INDEX,
|
|
228
223
|
onCancel: noop,
|
|
229
|
-
onConfirm: noop
|
|
230
|
-
onClickOutSide: noop
|
|
224
|
+
onConfirm: noop
|
|
231
225
|
};
|
|
@@ -22,7 +22,6 @@ export interface PopoverProps extends BaseProps {
|
|
|
22
22
|
trigger?: Trigger;
|
|
23
23
|
contentClassName?: string | any[];
|
|
24
24
|
onVisibleChange?: (visible: boolean) => void;
|
|
25
|
-
onClickOutSide?: (e: React.MouseEvent) => void;
|
|
26
25
|
showArrow?: boolean;
|
|
27
26
|
spacing?: number;
|
|
28
27
|
stopPropagation?: boolean | string;
|
|
@@ -51,7 +50,6 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
51
50
|
trigger: PropTypes.Validator<"hover" | "focus" | "click" | "custom">;
|
|
52
51
|
contentClassName: PropTypes.Requireable<string | any[]>;
|
|
53
52
|
onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
|
-
onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
|
|
55
53
|
style: PropTypes.Requireable<object>;
|
|
56
54
|
spacing: PropTypes.Requireable<number>;
|
|
57
55
|
zIndex: PropTypes.Requireable<number>;
|
|
@@ -81,8 +79,8 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
81
79
|
okText: string;
|
|
82
80
|
position: string;
|
|
83
81
|
prefixCls: string;
|
|
84
|
-
onClickOutSide: (...args: any[]) => void;
|
|
85
82
|
};
|
|
83
|
+
constructor(props: PopoverProps);
|
|
86
84
|
renderPopCard(): JSX.Element;
|
|
87
85
|
render(): JSX.Element;
|
|
88
86
|
}
|
package/lib/es/popover/index.js
CHANGED
|
@@ -21,11 +21,17 @@ import { cssClasses, strings, numbers } from '@douyinfe/semi-foundation/lib/es/p
|
|
|
21
21
|
import Tooltip from '../tooltip/index';
|
|
22
22
|
import Arrow from './Arrow';
|
|
23
23
|
import '@douyinfe/semi-foundation/lib/es/popover/popover.css';
|
|
24
|
-
import { noop } from 'lodash-es';
|
|
25
24
|
const positionSet = strings.POSITION_SET;
|
|
26
25
|
const triggerSet = strings.TRIGGER_SET;
|
|
27
26
|
|
|
28
27
|
class Popover extends React.PureComponent {
|
|
28
|
+
constructor(props) {
|
|
29
|
+
super(props);
|
|
30
|
+
this.state = {
|
|
31
|
+
popConfirmVisible: false
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
renderPopCard() {
|
|
30
36
|
const {
|
|
31
37
|
content,
|
|
@@ -101,7 +107,6 @@ Popover.propTypes = {
|
|
|
101
107
|
trigger: PropTypes.oneOf(triggerSet).isRequired,
|
|
102
108
|
contentClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
103
109
|
onVisibleChange: PropTypes.func,
|
|
104
|
-
onClickOutSide: PropTypes.func,
|
|
105
110
|
style: PropTypes.object,
|
|
106
111
|
spacing: PropTypes.number,
|
|
107
112
|
zIndex: PropTypes.number,
|
|
@@ -125,7 +130,6 @@ Popover.defaultProps = {
|
|
|
125
130
|
cancelText: 'No',
|
|
126
131
|
okText: 'Yes',
|
|
127
132
|
position: 'bottom',
|
|
128
|
-
prefixCls: cssClasses.PREFIX
|
|
129
|
-
onClickOutSide: noop
|
|
133
|
+
prefixCls: cssClasses.PREFIX
|
|
130
134
|
};
|
|
131
135
|
export default Popover;
|
package/lib/es/radio/radio.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare type RadioProps = {
|
|
|
13
13
|
autoFocus?: boolean;
|
|
14
14
|
checked?: boolean;
|
|
15
15
|
defaultChecked?: boolean;
|
|
16
|
-
value?:
|
|
16
|
+
value?: any;
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
prefixCls?: string;
|
|
19
19
|
displayMode?: RadioDisplayMode;
|
|
@@ -59,7 +59,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
59
59
|
constructor(props: RadioProps);
|
|
60
60
|
get adapter(): RadioAdapter;
|
|
61
61
|
isInGroup(): {
|
|
62
|
-
value?:
|
|
62
|
+
value?: any;
|
|
63
63
|
isButtonRadio?: any;
|
|
64
64
|
disabled?: boolean;
|
|
65
65
|
prefixCls?: string;
|
|
@@ -8,8 +8,8 @@ import { ArrayElement } from '../_base/base';
|
|
|
8
8
|
import { RadioType } from './radio';
|
|
9
9
|
import { RadioGroupButtonSize, RadioMode } from './context';
|
|
10
10
|
export interface OptionItem {
|
|
11
|
-
label?:
|
|
12
|
-
value?: string
|
|
11
|
+
label?: string;
|
|
12
|
+
value?: string;
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
extra?: React.ReactNode;
|
|
15
15
|
style?: React.CSSProperties;
|
|
@@ -17,11 +17,11 @@ export interface OptionItem {
|
|
|
17
17
|
}
|
|
18
18
|
export declare type Options = string[] | Array<OptionItem>;
|
|
19
19
|
export declare type RadioGroupProps = {
|
|
20
|
-
defaultValue?:
|
|
20
|
+
defaultValue?: any;
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
name?: string;
|
|
23
23
|
options?: Options;
|
|
24
|
-
value?:
|
|
24
|
+
value?: any;
|
|
25
25
|
onChange?: (event: RadioChangeEvent) => void;
|
|
26
26
|
className?: string;
|
|
27
27
|
style?: React.CSSProperties;
|
package/lib/es/select/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import ConfigContext from '../configProvider/context';
|
|
|
22
22
|
import SelectFoundation from '@douyinfe/semi-foundation/lib/es/select/foundation';
|
|
23
23
|
import { cssClasses, strings, numbers } from '@douyinfe/semi-foundation/lib/es/select/constants';
|
|
24
24
|
import BaseComponent from '../_base/baseComponent';
|
|
25
|
-
import { isEqual, isString, noop
|
|
25
|
+
import { isEqual, isString, noop } from 'lodash-es';
|
|
26
26
|
import Tag from '../tag/index';
|
|
27
27
|
import TagGroup from '../tag/group';
|
|
28
28
|
import LocaleCosumer from '../locale/localeConsumer';
|
|
@@ -177,10 +177,9 @@ class Select extends BaseComponent {
|
|
|
177
177
|
} = _this.props;
|
|
178
178
|
|
|
179
179
|
if (optionList && optionList.length) {
|
|
180
|
-
options = _mapInstanceProperty(optionList).call(optionList,
|
|
180
|
+
options = _mapInstanceProperty(optionList).call(optionList, itemOpt => _Object$assign({
|
|
181
181
|
_show: true,
|
|
182
|
-
_selected: false
|
|
183
|
-
_scrollIndex: index
|
|
182
|
+
_selected: false
|
|
184
183
|
}, itemOpt));
|
|
185
184
|
optionGroups[0] = {
|
|
186
185
|
children: options,
|
|
@@ -755,21 +754,15 @@ class Select extends BaseComponent {
|
|
|
755
754
|
}
|
|
756
755
|
|
|
757
756
|
if (virtualize) {
|
|
758
|
-
let
|
|
757
|
+
let minKey;
|
|
759
758
|
|
|
760
|
-
_forEachInstanceProperty(selections).call(selections,
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
if (isNumber(itemIndex) && itemIndex >= 0) {
|
|
765
|
-
minItemIndex = minItemIndex !== -1 && minItemIndex < itemIndex ? minItemIndex : itemIndex;
|
|
766
|
-
}
|
|
759
|
+
_forEachInstanceProperty(selections).call(selections, (v, k) => {
|
|
760
|
+
const tempKey = Number(String(k).match(/option-(.*)/)[1]);
|
|
761
|
+
minKey = typeof minKey === 'number' && minKey < tempKey ? minKey : tempKey;
|
|
767
762
|
});
|
|
768
763
|
|
|
769
|
-
if (
|
|
770
|
-
|
|
771
|
-
this.virtualizeListRef.current.scrollToItem(minItemIndex, 'center');
|
|
772
|
-
} catch (error) {}
|
|
764
|
+
if (minKey) {
|
|
765
|
+
this.virtualizeListRef.current.scrollToItem(minKey, 'center');
|
|
773
766
|
}
|
|
774
767
|
} else {
|
|
775
768
|
this.foundation.updateScrollTop();
|
package/lib/es/select/option.js
CHANGED
|
@@ -144,14 +144,14 @@ class Option extends PureComponent {
|
|
|
144
144
|
style: style
|
|
145
145
|
}, showTick ? /*#__PURE__*/React.createElement("div", {
|
|
146
146
|
className: selectedIconClassName
|
|
147
|
-
}, /*#__PURE__*/React.createElement(IconTick, null)) : null,
|
|
147
|
+
}, /*#__PURE__*/React.createElement(IconTick, null)) : null, /*#__PURE__*/React.createElement("div", {
|
|
148
148
|
className: "".concat(prefixCls, "-text")
|
|
149
149
|
}, this.renderOptionContent({
|
|
150
150
|
children,
|
|
151
151
|
config,
|
|
152
152
|
inputValue,
|
|
153
153
|
prefixCls
|
|
154
|
-
}))
|
|
154
|
+
})));
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
}
|
package/lib/es/select/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OptionProps } from './option';
|
|
3
3
|
import { OptionGroupProps } from './optionGroup';
|
|
4
|
-
declare const generateOption: (child: React.ReactElement, parent
|
|
4
|
+
declare const generateOption: (child: React.ReactElement, parent?: any) => OptionProps;
|
|
5
5
|
declare const getOptionsFromGroup: (selectChildren: React.ReactNode) => {
|
|
6
6
|
optionGroups: OptionGroupProps[];
|
|
7
7
|
options: OptionProps[];
|
package/lib/es/select/utils.js
CHANGED
|
@@ -20,7 +20,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
20
20
|
import React from 'react';
|
|
21
21
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
22
22
|
|
|
23
|
-
const generateOption = (child, parent
|
|
23
|
+
const generateOption = (child, parent) => {
|
|
24
24
|
const childProps = child.props;
|
|
25
25
|
|
|
26
26
|
if (!child || !childProps) {
|
|
@@ -32,8 +32,7 @@ const generateOption = (child, parent, index) => {
|
|
|
32
32
|
// Drop-down menu rendering priority label value, children, value in turn downgrade
|
|
33
33
|
label: childProps.label || childProps.children || childProps.value,
|
|
34
34
|
_show: true,
|
|
35
|
-
_selected: false
|
|
36
|
-
_scrollIndex: index
|
|
35
|
+
_selected: false
|
|
37
36
|
}, childProps), {
|
|
38
37
|
_parentGroup: parent
|
|
39
38
|
});
|
|
@@ -56,13 +55,11 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
56
55
|
const childNodes = _filterInstanceProperty(_context = React.Children.toArray(selectChildren)).call(_context, childNode => childNode && childNode.props);
|
|
57
56
|
|
|
58
57
|
let type = '';
|
|
59
|
-
let optionIndex = -1;
|
|
60
58
|
|
|
61
59
|
_forEachInstanceProperty(childNodes).call(childNodes, child => {
|
|
62
60
|
if (child.type.isSelectOption) {
|
|
63
61
|
type = 'option';
|
|
64
|
-
|
|
65
|
-
const option = generateOption(child, undefined, optionIndex);
|
|
62
|
+
const option = generateOption(child);
|
|
66
63
|
emptyGroup.children.push(option);
|
|
67
64
|
options.push(option);
|
|
68
65
|
} else if (child.type.isSelectOptionGroup) {
|
|
@@ -77,10 +74,7 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
77
74
|
|
|
78
75
|
children = React.Children.toArray(children);
|
|
79
76
|
|
|
80
|
-
const childrenOption = _mapInstanceProperty(children).call(children, option =>
|
|
81
|
-
optionIndex++;
|
|
82
|
-
return generateOption(option, restGroupProps, optionIndex);
|
|
83
|
-
});
|
|
77
|
+
const childrenOption = _mapInstanceProperty(children).call(children, option => generateOption(option, restGroupProps));
|
|
84
78
|
|
|
85
79
|
const group = _Object$assign(_Object$assign({}, child.props), {
|
|
86
80
|
children: childrenOption,
|
|
@@ -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?:
|
|
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>;
|
package/lib/es/tabs/TabBar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ReactNode, MouseEvent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { TabBarProps, PlainTab } from './interface';
|
|
4
4
|
export interface TabBarState {
|
|
5
5
|
endInd: number;
|
|
6
6
|
rePosKey: number;
|
|
@@ -22,8 +22,6 @@ declare class TabBar extends React.Component<TabBarProps, TabBarState> {
|
|
|
22
22
|
tabBarExtraContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
23
23
|
tabPosition: PropTypes.Requireable<string>;
|
|
24
24
|
type: PropTypes.Requireable<string>;
|
|
25
|
-
closable: PropTypes.Requireable<boolean>;
|
|
26
|
-
deleteTabItem: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
25
|
};
|
|
28
26
|
uuid: string;
|
|
29
27
|
constructor(props: TabBarProps);
|
package/lib/es/tabs/TabBar.js
CHANGED
|
@@ -24,7 +24,7 @@ import OverflowList from '../overflowList';
|
|
|
24
24
|
import Dropdown from '../dropdown';
|
|
25
25
|
import Button from '../button';
|
|
26
26
|
import { isEmpty } from 'lodash-es';
|
|
27
|
-
import {
|
|
27
|
+
import { IconChevronRight, IconChevronLeft } from '@douyinfe/semi-icons';
|
|
28
28
|
import { getUuidv4 } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
29
29
|
|
|
30
30
|
class TabBar extends React.Component {
|
|
@@ -51,15 +51,9 @@ class TabBar extends React.Component {
|
|
|
51
51
|
|
|
52
52
|
this.renderTabItem = panel => {
|
|
53
53
|
const {
|
|
54
|
-
size
|
|
55
|
-
type,
|
|
56
|
-
deleteTabItem
|
|
54
|
+
size
|
|
57
55
|
} = this.props;
|
|
58
56
|
const panelIcon = panel.icon ? this.renderIcon(panel.icon) : null;
|
|
59
|
-
const closableIcon = type === 'card' && panel.closable ? /*#__PURE__*/React.createElement(IconClose, {
|
|
60
|
-
className: "".concat(cssClasses.TABS_TAB, "-icon-close"),
|
|
61
|
-
onClick: e => deleteTabItem(panel.itemKey, e)
|
|
62
|
-
}) : null;
|
|
63
57
|
let events = {};
|
|
64
58
|
const key = panel.itemKey;
|
|
65
59
|
|
|
@@ -82,7 +76,7 @@ class TabBar extends React.Component {
|
|
|
82
76
|
}, events, {
|
|
83
77
|
className: className,
|
|
84
78
|
key: this._getItemKey(key)
|
|
85
|
-
}), panelIcon, panel.tab
|
|
79
|
+
}), panelIcon, panel.tab);
|
|
86
80
|
};
|
|
87
81
|
|
|
88
82
|
this.renderTabComponents = list => _mapInstanceProperty(list).call(list, panel => this.renderTabItem(panel));
|
|
@@ -284,8 +278,6 @@ TabBar.propTypes = {
|
|
|
284
278
|
style: PropTypes.object,
|
|
285
279
|
tabBarExtraContent: PropTypes.node,
|
|
286
280
|
tabPosition: PropTypes.oneOf(strings.POSITION_MAP),
|
|
287
|
-
type: PropTypes.oneOf(strings.TYPE_MAP)
|
|
288
|
-
closable: PropTypes.bool,
|
|
289
|
-
deleteTabItem: PropTypes.func
|
|
281
|
+
type: PropTypes.oneOf(strings.TYPE_MAP)
|
|
290
282
|
};
|
|
291
283
|
export default TabBar;
|
package/lib/es/tabs/TabPane.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent, ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { TabPaneProps, PlainTab } from './interface';
|
|
4
4
|
declare class TabPane extends PureComponent<TabPaneProps> {
|
|
5
5
|
static isTabPane: boolean;
|
|
6
6
|
static contextType: React.Context<import("./interface").TabContextValue>;
|
|
@@ -12,7 +12,6 @@ declare class TabPane extends PureComponent<TabPaneProps> {
|
|
|
12
12
|
itemKey: PropTypes.Requireable<string>;
|
|
13
13
|
tab: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
14
14
|
icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
15
|
-
closable: PropTypes.Requireable<boolean>;
|
|
16
15
|
};
|
|
17
16
|
lastActiveKey: string;
|
|
18
17
|
ref: React.RefObject<HTMLDivElement>;
|
package/lib/es/tabs/TabPane.js
CHANGED
|
@@ -15,7 +15,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
15
15
|
return t;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
import React, {
|
|
18
|
+
import React, { PureComponent, createRef } from 'react';
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
20
|
import cls from 'classnames';
|
|
21
21
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/tabs/constants';
|
|
@@ -131,7 +131,6 @@ TabPane.propTypes = {
|
|
|
131
131
|
disabled: PropTypes.bool,
|
|
132
132
|
itemKey: PropTypes.string,
|
|
133
133
|
tab: PropTypes.node,
|
|
134
|
-
icon: PropTypes.node
|
|
135
|
-
closable: PropTypes.bool
|
|
134
|
+
icon: PropTypes.node
|
|
136
135
|
};
|
|
137
136
|
export default TabPane;
|
package/lib/es/tabs/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RefObject, ReactElement, MouseEvent, RefCallback, ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import TabsFoundation, { TabsAdapter } from '@douyinfe/semi-foundation/lib/es/tabs/foundation';
|
|
4
4
|
import BaseComponent from '../_base/baseComponent';
|
|
5
5
|
import '@douyinfe/semi-foundation/lib/es/tabs/tabs.css';
|
|
6
6
|
import TabPane from './TabPane';
|
|
7
|
-
import {
|
|
7
|
+
import { TabsProps, PlainTab } from './interface';
|
|
8
8
|
export * from './interface';
|
|
9
9
|
export interface TabsState {
|
|
10
10
|
activeKey: string;
|
|
@@ -32,7 +32,6 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
32
32
|
tabPaneMotion: PropTypes.Requireable<boolean | object>;
|
|
33
33
|
tabPosition: PropTypes.Requireable<string>;
|
|
34
34
|
type: PropTypes.Requireable<string>;
|
|
35
|
-
onTabClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
35
|
};
|
|
37
36
|
static defaultProps: TabsProps;
|
|
38
37
|
contentRef: RefObject<HTMLDivElement>;
|
|
@@ -46,7 +45,6 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
46
45
|
onTabClick: (activeKey: string, event: MouseEvent<HTMLDivElement>) => void;
|
|
47
46
|
rePosChildren: (children: ReactElement[], activeKey: string) => ReactElement[];
|
|
48
47
|
getActiveItem: () => ReactNode | ReactNode[];
|
|
49
|
-
deleteTabItem: (tabKey: string, event: MouseEvent<HTMLDivElement>) => void;
|
|
50
48
|
render(): ReactNode;
|
|
51
49
|
}
|
|
52
50
|
export default Tabs;
|