@douyinfe/semi-ui 2.27.0-alpha.2 → 2.27.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/dist/css/semi.css +19 -196
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +295 -330
- 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/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/index.d.ts +1 -1
- package/lib/cjs/carousel/index.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/select/index.js +14 -2
- package/lib/cjs/tabs/TabBar.d.ts +2 -1
- package/lib/cjs/tabs/TabBar.js +51 -23
- package/lib/cjs/tabs/index.d.ts +1 -2
- package/lib/cjs/tabs/index.js +0 -3
- package/lib/cjs/tooltip/index.js +1 -1
- package/lib/cjs/transfer/index.js +29 -29
- package/lib/cjs/typography/base.d.ts +1 -1
- package/lib/cjs/typography/numeral.d.ts +1 -1
- package/lib/cjs/typography/paragraph.d.ts +1 -1
- package/lib/cjs/typography/text.d.ts +1 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/index.d.ts +1 -1
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/select/index.js +14 -2
- package/lib/es/tabs/TabBar.d.ts +2 -1
- package/lib/es/tabs/TabBar.js +52 -23
- package/lib/es/tabs/index.d.ts +1 -2
- package/lib/es/tabs/index.js +0 -2
- package/lib/es/tooltip/index.js +1 -1
- package/lib/es/transfer/index.js +29 -29
- package/lib/es/typography/base.d.ts +1 -1
- package/lib/es/typography/numeral.d.ts +1 -1
- package/lib/es/typography/paragraph.d.ts +1 -1
- package/lib/es/typography/text.d.ts +1 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +8 -8
- package/lib/cjs/tabs/TabItem.d.ts +0 -18
- package/lib/cjs/tabs/TabItem.js +0 -95
- package/lib/es/tabs/TabItem.d.ts +0 -18
- package/lib/es/tabs/TabItem.js +0 -78
package/lib/es/select/index.js
CHANGED
|
@@ -699,7 +699,10 @@ class Select extends BaseComponent {
|
|
|
699
699
|
style: style,
|
|
700
700
|
ref: this.setOptionContainerEl,
|
|
701
701
|
onKeyDown: e => this.foundation.handleContainerKeyDown(e)
|
|
702
|
-
}, outerTopSlot
|
|
702
|
+
}, outerTopSlot ? /*#__PURE__*/React.createElement("div", {
|
|
703
|
+
className: "".concat(prefixcls, "-option-list-outer-top-slot"),
|
|
704
|
+
onMouseEnter: () => this.foundation.handleSlotMouseEnter()
|
|
705
|
+
}, outerTopSlot) : null, /*#__PURE__*/React.createElement("div", {
|
|
703
706
|
style: {
|
|
704
707
|
maxHeight: "".concat(maxHeight, "px")
|
|
705
708
|
},
|
|
@@ -707,7 +710,16 @@ class Select extends BaseComponent {
|
|
|
707
710
|
role: "listbox",
|
|
708
711
|
"aria-multiselectable": multiple,
|
|
709
712
|
onScroll: e => this.foundation.handleListScroll(e)
|
|
710
|
-
}, innerTopSlot
|
|
713
|
+
}, innerTopSlot ? /*#__PURE__*/React.createElement("div", {
|
|
714
|
+
className: "".concat(prefixcls, "-option-list-inner-top-slot"),
|
|
715
|
+
onMouseEnter: () => this.foundation.handleSlotMouseEnter()
|
|
716
|
+
}, innerTopSlot) : null, loading ? this.renderLoading() : isEmpty ? this.renderEmpty() : listContent, innerBottomSlot ? /*#__PURE__*/React.createElement("div", {
|
|
717
|
+
className: "".concat(prefixcls, "-option-list-inner-bottom-slot"),
|
|
718
|
+
onMouseEnter: () => this.foundation.handleSlotMouseEnter()
|
|
719
|
+
}, innerBottomSlot) : null), outerBottomSlot ? /*#__PURE__*/React.createElement("div", {
|
|
720
|
+
className: "".concat(prefixcls, "-option-list-outer-bottom-slot"),
|
|
721
|
+
onMouseEnter: () => this.foundation.handleSlotMouseEnter()
|
|
722
|
+
}, outerBottomSlot) : null)
|
|
711
723
|
);
|
|
712
724
|
}
|
|
713
725
|
|
package/lib/es/tabs/TabBar.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface TabBarState {
|
|
|
5
5
|
endInd: number;
|
|
6
6
|
rePosKey: number;
|
|
7
7
|
startInd: number;
|
|
8
|
+
uuid: string;
|
|
8
9
|
}
|
|
9
10
|
export interface OverflowItem extends PlainTab {
|
|
10
11
|
key: string;
|
|
@@ -25,8 +26,8 @@ declare class TabBar extends React.Component<TabBarProps, TabBarState> {
|
|
|
25
26
|
closable: PropTypes.Requireable<boolean>;
|
|
26
27
|
deleteTabItem: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
28
|
};
|
|
28
|
-
uuid: string;
|
|
29
29
|
constructor(props: TabBarProps);
|
|
30
|
+
componentDidMount(): void;
|
|
30
31
|
renderIcon(icon: ReactNode): ReactNode;
|
|
31
32
|
renderExtra(): ReactNode;
|
|
32
33
|
handleItemClick: (itemKey: string, e: MouseEvent<Element>) => void;
|
package/lib/es/tabs/TabBar.js
CHANGED
|
@@ -19,9 +19,8 @@ import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
|
|
|
19
19
|
import OverflowList from '../overflowList';
|
|
20
20
|
import Dropdown from '../dropdown';
|
|
21
21
|
import Button from '../button';
|
|
22
|
-
import { IconChevronRight, IconChevronLeft } from '@douyinfe/semi-icons';
|
|
22
|
+
import { IconChevronRight, IconChevronLeft, IconClose } from '@douyinfe/semi-icons';
|
|
23
23
|
import { getUuidv4 } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
24
|
-
import TabItem from './TabItem';
|
|
25
24
|
|
|
26
25
|
class TabBar extends React.Component {
|
|
27
26
|
constructor(props) {
|
|
@@ -34,7 +33,7 @@ class TabBar extends React.Component {
|
|
|
34
33
|
const key = this._getItemKey(itemKey); // eslint-disable-next-line max-len
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
const tabItem = document.querySelector("[data-uuid=\"".concat(this.uuid, "\"] .").concat(cssClasses.TABS_TAB, "[data-scrollkey=\"").concat(key, "\"]"));
|
|
36
|
+
const tabItem = document.querySelector("[data-uuid=\"".concat(this.state.uuid, "\"] .").concat(cssClasses.TABS_TAB, "[data-scrollkey=\"").concat(key, "\"]"));
|
|
38
37
|
tabItem.scrollIntoView({
|
|
39
38
|
behavior: 'smooth',
|
|
40
39
|
block: 'nearest',
|
|
@@ -51,23 +50,45 @@ class TabBar extends React.Component {
|
|
|
51
50
|
const {
|
|
52
51
|
size,
|
|
53
52
|
type,
|
|
54
|
-
deleteTabItem
|
|
55
|
-
handleKeyDown,
|
|
56
|
-
tabPosition
|
|
53
|
+
deleteTabItem
|
|
57
54
|
} = this.props;
|
|
55
|
+
const panelIcon = panel.icon ? this.renderIcon(panel.icon) : null;
|
|
56
|
+
const closableIcon = type === 'card' && panel.closable ? /*#__PURE__*/React.createElement(IconClose, {
|
|
57
|
+
"aria-label": "Close",
|
|
58
|
+
role: "button",
|
|
59
|
+
className: "".concat(cssClasses.TABS_TAB, "-icon-close"),
|
|
60
|
+
onClick: e => deleteTabItem(panel.itemKey, e)
|
|
61
|
+
}) : null;
|
|
62
|
+
let events = {};
|
|
63
|
+
const key = panel.itemKey;
|
|
64
|
+
|
|
65
|
+
if (!panel.disabled) {
|
|
66
|
+
events = {
|
|
67
|
+
onClick: e => this.handleItemClick(key, e)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
58
70
|
|
|
59
|
-
const isSelected = this._isActive(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
const isSelected = this._isActive(key);
|
|
72
|
+
|
|
73
|
+
const className = cls(cssClasses.TABS_TAB, {
|
|
74
|
+
[cssClasses.TABS_TAB_ACTIVE]: isSelected,
|
|
75
|
+
[cssClasses.TABS_TAB_DISABLED]: panel.disabled,
|
|
76
|
+
["".concat(cssClasses.TABS_TAB, "-small")]: size === 'small',
|
|
77
|
+
["".concat(cssClasses.TABS_TAB, "-medium")]: size === 'medium'
|
|
78
|
+
});
|
|
79
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
80
|
+
role: "tab",
|
|
81
|
+
id: "semiTab".concat(key),
|
|
82
|
+
"data-tabkey": "semiTab".concat(key),
|
|
83
|
+
"aria-controls": "semiTabPanel".concat(key),
|
|
84
|
+
"aria-disabled": panel.disabled ? 'true' : 'false',
|
|
85
|
+
"aria-selected": isSelected ? 'true' : 'false',
|
|
86
|
+
tabIndex: isSelected ? 0 : -1,
|
|
87
|
+
onKeyDown: e => this.handleKeyDown(e, key, panel.closable)
|
|
88
|
+
}, events, {
|
|
89
|
+
className: className,
|
|
90
|
+
key: this._getItemKey(key)
|
|
91
|
+
}), panelIcon, panel.tab, closableIcon);
|
|
71
92
|
};
|
|
72
93
|
|
|
73
94
|
this.renderTabComponents = list => list.map(panel => this.renderTabItem(panel));
|
|
@@ -82,7 +103,7 @@ class TabBar extends React.Component {
|
|
|
82
103
|
const key = this._getItemKey(lastItem.itemKey); // eslint-disable-next-line max-len
|
|
83
104
|
|
|
84
105
|
|
|
85
|
-
const tabItem = document.querySelector("[data-uuid=\"".concat(this.uuid, "\"] .").concat(cssClasses.TABS_TAB, "[data-scrollkey=\"").concat(key, "\"]"));
|
|
106
|
+
const tabItem = document.querySelector("[data-uuid=\"".concat(this.state.uuid, "\"] .").concat(cssClasses.TABS_TAB, "[data-scrollkey=\"").concat(key, "\"]"));
|
|
86
107
|
tabItem.scrollIntoView({
|
|
87
108
|
behavior: 'smooth',
|
|
88
109
|
block: 'nearest',
|
|
@@ -136,7 +157,9 @@ class TabBar extends React.Component {
|
|
|
136
157
|
render: disabled ? null : menu,
|
|
137
158
|
showTick: true,
|
|
138
159
|
style: dropdownStyle,
|
|
139
|
-
trigger: 'hover'
|
|
160
|
+
trigger: 'hover',
|
|
161
|
+
disableFocusListener // prevent the panel from popping up again after clicking
|
|
162
|
+
: true
|
|
140
163
|
}, /*#__PURE__*/React.createElement("div", {
|
|
141
164
|
role: "presentation",
|
|
142
165
|
className: arrowCls,
|
|
@@ -184,9 +207,15 @@ class TabBar extends React.Component {
|
|
|
184
207
|
this.state = {
|
|
185
208
|
endInd: props.list.length,
|
|
186
209
|
rePosKey: 0,
|
|
187
|
-
startInd: 0
|
|
210
|
+
startInd: 0,
|
|
211
|
+
uuid: ''
|
|
188
212
|
};
|
|
189
|
-
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
componentDidMount() {
|
|
216
|
+
this.setState({
|
|
217
|
+
uuid: getUuidv4()
|
|
218
|
+
});
|
|
190
219
|
}
|
|
191
220
|
|
|
192
221
|
renderIcon(icon) {
|
|
@@ -248,7 +277,7 @@ class TabBar extends React.Component {
|
|
|
248
277
|
className: classNames,
|
|
249
278
|
style: style
|
|
250
279
|
}, getDataAttr(restProps), {
|
|
251
|
-
"data-uuid": this.uuid
|
|
280
|
+
"data-uuid": this.state.uuid
|
|
252
281
|
}), contents, extra);
|
|
253
282
|
}
|
|
254
283
|
|
package/lib/es/tabs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MouseEvent, ReactElement, ReactNode, RefCallback, RefObject } 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';
|
|
@@ -14,7 +14,6 @@ export interface TabsState {
|
|
|
14
14
|
}
|
|
15
15
|
declare class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
16
16
|
static TabPane: typeof TabPane;
|
|
17
|
-
static TabItem: React.ForwardRefExoticComponent<import("./TabItem").TabItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
17
|
static propTypes: {
|
|
19
18
|
activeKey: PropTypes.Requireable<string>;
|
|
20
19
|
className: PropTypes.Requireable<string>;
|
package/lib/es/tabs/index.js
CHANGED
|
@@ -23,7 +23,6 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
23
23
|
import '@douyinfe/semi-foundation/lib/es/tabs/tabs.css';
|
|
24
24
|
import TabBar from './TabBar';
|
|
25
25
|
import TabPane from './TabPane';
|
|
26
|
-
import TabItem from './TabItem';
|
|
27
26
|
import TabsContext from './tabs-context';
|
|
28
27
|
const panePickKeys = ['className', 'style', 'disabled', 'itemKey', 'tab', 'icon'];
|
|
29
28
|
export * from './interface';
|
|
@@ -336,7 +335,6 @@ class Tabs extends BaseComponent {
|
|
|
336
335
|
}
|
|
337
336
|
|
|
338
337
|
Tabs.TabPane = TabPane;
|
|
339
|
-
Tabs.TabItem = TabItem;
|
|
340
338
|
Tabs.propTypes = {
|
|
341
339
|
activeKey: PropTypes.string,
|
|
342
340
|
className: PropTypes.string,
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -450,7 +450,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
450
450
|
el = ReactDOM.findDOMNode(el);
|
|
451
451
|
popupEl = ReactDOM.findDOMNode(popupEl);
|
|
452
452
|
|
|
453
|
-
if (el && !el.contains(e.target) && popupEl && !popupEl.contains(e.target) || this.props.clickTriggerToHide) {
|
|
453
|
+
if (el && !el.contains(e.target) && popupEl && !popupEl.contains(e.target) || this.props.clickTriggerToHide && el && el.contains(e.target)) {
|
|
454
454
|
this.props.onClickOutSide(e);
|
|
455
455
|
cb();
|
|
456
456
|
}
|
package/lib/es/transfer/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import Spin from '../spin';
|
|
|
19
19
|
import Button from '../button';
|
|
20
20
|
import Tree from '../tree';
|
|
21
21
|
import { IconClose, IconSearch, IconHandle } from '@douyinfe/semi-icons';
|
|
22
|
-
const
|
|
22
|
+
const prefixCls = cssClasses.PREFIX; // SortableItem & SortableList should not be assigned inside of the render function
|
|
23
23
|
|
|
24
24
|
const SortableItem = SortableElement(props => props.item.node);
|
|
25
25
|
const SortableList = SortableContainer(_ref => {
|
|
@@ -27,7 +27,7 @@ const SortableList = SortableContainer(_ref => {
|
|
|
27
27
|
items
|
|
28
28
|
} = _ref;
|
|
29
29
|
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
className: "".concat(
|
|
30
|
+
className: "".concat(prefixCls, "-right-list"),
|
|
31
31
|
role: "list",
|
|
32
32
|
"aria-label": "Selected list"
|
|
33
33
|
}, items.map((item, index) =>
|
|
@@ -179,7 +179,7 @@ class Transfer extends BaseComponent {
|
|
|
179
179
|
return /*#__PURE__*/React.createElement("div", {
|
|
180
180
|
role: "search",
|
|
181
181
|
"aria-label": "Transfer filter",
|
|
182
|
-
className: "".concat(
|
|
182
|
+
className: "".concat(prefixCls, "-filter")
|
|
183
183
|
}, /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
184
184
|
prefix: /*#__PURE__*/React.createElement(IconSearch, null),
|
|
185
185
|
placeholder: locale.placeholder,
|
|
@@ -202,20 +202,20 @@ class Transfer extends BaseComponent {
|
|
|
202
202
|
showButton
|
|
203
203
|
} = headerConfig;
|
|
204
204
|
const headerCls = cls({
|
|
205
|
-
["".concat(
|
|
206
|
-
["".concat(
|
|
207
|
-
["".concat(
|
|
205
|
+
["".concat(prefixCls, "-header")]: true,
|
|
206
|
+
["".concat(prefixCls, "-right-header")]: type === 'right',
|
|
207
|
+
["".concat(prefixCls, "-left-header")]: type === 'left'
|
|
208
208
|
});
|
|
209
209
|
return /*#__PURE__*/React.createElement("div", {
|
|
210
210
|
className: headerCls
|
|
211
211
|
}, /*#__PURE__*/React.createElement("span", {
|
|
212
|
-
className: "".concat(
|
|
212
|
+
className: "".concat(prefixCls, "-header-total")
|
|
213
213
|
}, totalContent), showButton ? /*#__PURE__*/React.createElement(Button, {
|
|
214
214
|
theme: "borderless",
|
|
215
215
|
disabled: disabled,
|
|
216
216
|
type: "tertiary",
|
|
217
217
|
size: "small",
|
|
218
|
-
className: "".concat(
|
|
218
|
+
className: "".concat(prefixCls, "-header-all"),
|
|
219
219
|
onClick: onAllClick
|
|
220
220
|
}, allContent) : null);
|
|
221
221
|
}
|
|
@@ -238,8 +238,8 @@ class Transfer extends BaseComponent {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
const leftItemCls = cls({
|
|
241
|
-
["".concat(
|
|
242
|
-
["".concat(
|
|
241
|
+
["".concat(prefixCls, "-item")]: true,
|
|
242
|
+
["".concat(prefixCls, "-item-disabled")]: item.disabled
|
|
243
243
|
});
|
|
244
244
|
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
245
245
|
key: index,
|
|
@@ -344,12 +344,12 @@ class Transfer extends BaseComponent {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
return /*#__PURE__*/React.createElement("section", {
|
|
347
|
-
className: "".concat(
|
|
347
|
+
className: "".concat(prefixCls, "-left")
|
|
348
348
|
}, inputCom, content);
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
renderGroupTitle(group, index) {
|
|
352
|
-
const groupCls = cls("".concat(
|
|
352
|
+
const groupCls = cls("".concat(prefixCls, "-group-title"));
|
|
353
353
|
return /*#__PURE__*/React.createElement("div", {
|
|
354
354
|
className: groupCls,
|
|
355
355
|
key: "title-".concat(index)
|
|
@@ -417,7 +417,7 @@ class Transfer extends BaseComponent {
|
|
|
417
417
|
}
|
|
418
418
|
});
|
|
419
419
|
return /*#__PURE__*/React.createElement("div", {
|
|
420
|
-
className: "".concat(
|
|
420
|
+
className: "".concat(prefixCls, "-left-list"),
|
|
421
421
|
role: "list",
|
|
422
422
|
"aria-label": "Option list"
|
|
423
423
|
}, content);
|
|
@@ -434,9 +434,9 @@ class Transfer extends BaseComponent {
|
|
|
434
434
|
const onRemove = () => this.foundation.handleSelectOrRemove(item);
|
|
435
435
|
|
|
436
436
|
const rightItemCls = cls({
|
|
437
|
-
["".concat(
|
|
438
|
-
["".concat(
|
|
439
|
-
["".concat(
|
|
437
|
+
["".concat(prefixCls, "-item")]: true,
|
|
438
|
+
["".concat(prefixCls, "-right-item")]: true,
|
|
439
|
+
["".concat(prefixCls, "-right-item-draggable")]: draggable
|
|
440
440
|
});
|
|
441
441
|
const shouldShowPath = type === strings.TYPE_TREE_TO_LIST && showPath === true;
|
|
442
442
|
const label = shouldShowPath ? this.foundation._generatePath(item) : item.label;
|
|
@@ -451,7 +451,7 @@ class Transfer extends BaseComponent {
|
|
|
451
451
|
const DragHandle = SortableHandle(() => /*#__PURE__*/React.createElement(IconHandle, {
|
|
452
452
|
role: "button",
|
|
453
453
|
"aria-label": "Drag and sort",
|
|
454
|
-
className: "".concat(
|
|
454
|
+
className: "".concat(prefixCls, "-right-item-drag-handler")
|
|
455
455
|
}));
|
|
456
456
|
return (
|
|
457
457
|
/*#__PURE__*/
|
|
@@ -461,12 +461,12 @@ class Transfer extends BaseComponent {
|
|
|
461
461
|
className: rightItemCls,
|
|
462
462
|
key: item.key
|
|
463
463
|
}, draggable ? /*#__PURE__*/React.createElement(DragHandle, null) : null, /*#__PURE__*/React.createElement("div", {
|
|
464
|
-
className: "".concat(
|
|
464
|
+
className: "".concat(prefixCls, "-right-item-text")
|
|
465
465
|
}, label), /*#__PURE__*/React.createElement(IconClose, {
|
|
466
466
|
onClick: onRemove,
|
|
467
467
|
"aria-disabled": item.disabled,
|
|
468
|
-
className: cls("".concat(
|
|
469
|
-
["".concat(
|
|
468
|
+
className: cls("".concat(prefixCls, "-item-close-icon"), {
|
|
469
|
+
["".concat(prefixCls, "-item-close-icon-disabled")]: item.disabled
|
|
470
470
|
})
|
|
471
471
|
}))
|
|
472
472
|
);
|
|
@@ -474,9 +474,9 @@ class Transfer extends BaseComponent {
|
|
|
474
474
|
|
|
475
475
|
renderEmpty(type, emptyText) {
|
|
476
476
|
const emptyCls = cls({
|
|
477
|
-
["".concat(
|
|
478
|
-
["".concat(
|
|
479
|
-
["".concat(
|
|
477
|
+
["".concat(prefixCls, "-empty")]: true,
|
|
478
|
+
["".concat(prefixCls, "-right-empty")]: type === 'right',
|
|
479
|
+
["".concat(prefixCls, "-left-empty")]: type === 'left'
|
|
480
480
|
});
|
|
481
481
|
return /*#__PURE__*/React.createElement("div", {
|
|
482
482
|
"aria-label": "empty",
|
|
@@ -492,7 +492,7 @@ class Transfer extends BaseComponent {
|
|
|
492
492
|
|
|
493
493
|
const sortList = /*#__PURE__*/React.createElement(SortableList, {
|
|
494
494
|
useDragHandle: true,
|
|
495
|
-
helperClass: "".concat(
|
|
495
|
+
helperClass: "".concat(prefixCls, "-right-item-drag-item-move"),
|
|
496
496
|
onSortEnd: this.onSortEnd,
|
|
497
497
|
items: sortableListItems
|
|
498
498
|
});
|
|
@@ -533,7 +533,7 @@ class Transfer extends BaseComponent {
|
|
|
533
533
|
};
|
|
534
534
|
const headerCom = this.renderHeader(headerConfig);
|
|
535
535
|
const emptyCom = this.renderEmpty('right', emptyContent.right ? emptyContent.right : locale.emptyRight);
|
|
536
|
-
const panelCls = "".concat(
|
|
536
|
+
const panelCls = "".concat(prefixCls, "-right");
|
|
537
537
|
let content = null;
|
|
538
538
|
|
|
539
539
|
switch (true) {
|
|
@@ -544,7 +544,7 @@ class Transfer extends BaseComponent {
|
|
|
544
544
|
|
|
545
545
|
case selectedData.length && !draggable:
|
|
546
546
|
const list = /*#__PURE__*/React.createElement("div", {
|
|
547
|
-
className: "".concat(
|
|
547
|
+
className: "".concat(prefixCls, "-right-list"),
|
|
548
548
|
role: "list",
|
|
549
549
|
"aria-label": "Selected list"
|
|
550
550
|
}, selectedData.map(item => this.renderRightItem(Object.assign({}, item))));
|
|
@@ -572,9 +572,9 @@ class Transfer extends BaseComponent {
|
|
|
572
572
|
renderSelectedPanel,
|
|
573
573
|
renderSourcePanel
|
|
574
574
|
} = this.props;
|
|
575
|
-
const transferCls = cls(
|
|
576
|
-
["".concat(
|
|
577
|
-
["".concat(
|
|
575
|
+
const transferCls = cls(prefixCls, className, {
|
|
576
|
+
["".concat(prefixCls, "-disabled")]: disabled,
|
|
577
|
+
["".concat(prefixCls, "-custom-panel")]: renderSelectedPanel && renderSourcePanel
|
|
578
578
|
});
|
|
579
579
|
return /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
580
580
|
componentName: "Transfer"
|
|
@@ -64,7 +64,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
|
|
|
64
64
|
spacing: PropTypes.Requireable<"normal" | "extended">;
|
|
65
65
|
strong: PropTypes.Requireable<boolean>;
|
|
66
66
|
size: PropTypes.Requireable<"small" | "normal">;
|
|
67
|
-
type: PropTypes.Requireable<"warning" | "success" | "primary" | "
|
|
67
|
+
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
68
68
|
style: PropTypes.Requireable<object>;
|
|
69
69
|
className: PropTypes.Requireable<string>;
|
|
70
70
|
icon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -38,7 +38,7 @@ export default class Numeral extends PureComponent<NumeralProps> {
|
|
|
38
38
|
underline: PropTypes.Requireable<boolean>;
|
|
39
39
|
link: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
40
40
|
strong: PropTypes.Requireable<boolean>;
|
|
41
|
-
type: PropTypes.Requireable<"warning" | "success" | "primary" | "
|
|
41
|
+
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
42
42
|
size: PropTypes.Requireable<"small" | "normal">;
|
|
43
43
|
style: PropTypes.Requireable<object>;
|
|
44
44
|
className: PropTypes.Requireable<string>;
|
|
@@ -29,7 +29,7 @@ export default class Paragraph extends PureComponent<ParagraphProps> {
|
|
|
29
29
|
link: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
30
30
|
underline: PropTypes.Requireable<boolean>;
|
|
31
31
|
strong: PropTypes.Requireable<boolean>;
|
|
32
|
-
type: PropTypes.Requireable<"warning" | "success" | "primary" | "
|
|
32
|
+
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
33
33
|
size: PropTypes.Requireable<"small" | "normal">;
|
|
34
34
|
spacing: PropTypes.Requireable<"normal" | "extended">;
|
|
35
35
|
style: PropTypes.Requireable<object>;
|
|
@@ -32,7 +32,7 @@ export default class Text extends PureComponent<TextProps> {
|
|
|
32
32
|
underline: PropTypes.Requireable<boolean>;
|
|
33
33
|
link: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
34
34
|
strong: PropTypes.Requireable<boolean>;
|
|
35
|
-
type: PropTypes.Requireable<"warning" | "success" | "primary" | "
|
|
35
|
+
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
36
36
|
size: PropTypes.Requireable<"small" | "normal">;
|
|
37
37
|
style: PropTypes.Requireable<object>;
|
|
38
38
|
className: PropTypes.Requireable<string>;
|
|
@@ -36,7 +36,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
36
36
|
link: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
|
-
type: PropTypes.Requireable<"warning" | "success" | "primary" | "
|
|
39
|
+
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
40
|
heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 6 | 5>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.27.0
|
|
3
|
+
"version": "2.27.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"lib/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@douyinfe/semi-animation": "2.27.0
|
|
21
|
-
"@douyinfe/semi-animation-react": "2.27.0
|
|
22
|
-
"@douyinfe/semi-foundation": "2.27.0
|
|
23
|
-
"@douyinfe/semi-icons": "2.27.0
|
|
24
|
-
"@douyinfe/semi-illustrations": "2.27.0
|
|
25
|
-
"@douyinfe/semi-theme-default": "2.27.0
|
|
20
|
+
"@douyinfe/semi-animation": "2.27.0",
|
|
21
|
+
"@douyinfe/semi-animation-react": "2.27.0",
|
|
22
|
+
"@douyinfe/semi-foundation": "2.27.0",
|
|
23
|
+
"@douyinfe/semi-icons": "2.27.0",
|
|
24
|
+
"@douyinfe/semi-illustrations": "2.27.0",
|
|
25
|
+
"@douyinfe/semi-theme-default": "2.27.0",
|
|
26
26
|
"async-validator": "^3.5.0",
|
|
27
27
|
"classnames": "^2.2.6",
|
|
28
28
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "a7a3f537ef48f75e3824c156e9b25a084e562dd6",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, MouseEvent } from 'react';
|
|
2
|
-
import { TabType, TabSize, TabPosition } from './interface';
|
|
3
|
-
export interface TabItemProps {
|
|
4
|
-
tab?: ReactNode;
|
|
5
|
-
icon?: ReactNode;
|
|
6
|
-
size?: TabSize;
|
|
7
|
-
type?: TabType;
|
|
8
|
-
tabPosition?: TabPosition;
|
|
9
|
-
selected?: boolean;
|
|
10
|
-
closable?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
itemKey?: string;
|
|
13
|
-
handleKeyDown?: (event: React.KeyboardEvent, itemKey: string, closable: boolean) => void;
|
|
14
|
-
deleteTabItem?: (tabKey: string, event: MouseEvent<Element>) => void;
|
|
15
|
-
onClick?: (itemKey: string, e: MouseEvent<Element>) => void;
|
|
16
|
-
}
|
|
17
|
-
declare const ForwardTabItem: React.ForwardRefExoticComponent<TabItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
-
export default ForwardTabItem;
|
package/lib/cjs/tabs/TabItem.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _constants = require("@douyinfe/semi-foundation/lib/cjs/tabs/constants");
|
|
13
|
-
|
|
14
|
-
var _semiIcons = require("@douyinfe/semi-icons");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
23
|
-
var t = {};
|
|
24
|
-
|
|
25
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
26
|
-
|
|
27
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
29
|
-
}
|
|
30
|
-
return t;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const TabItem = (props, ref) => {
|
|
34
|
-
const {
|
|
35
|
-
tab,
|
|
36
|
-
size,
|
|
37
|
-
type,
|
|
38
|
-
icon,
|
|
39
|
-
selected,
|
|
40
|
-
closable,
|
|
41
|
-
disabled,
|
|
42
|
-
itemKey,
|
|
43
|
-
deleteTabItem,
|
|
44
|
-
tabPosition,
|
|
45
|
-
handleKeyDown,
|
|
46
|
-
onClick
|
|
47
|
-
} = props,
|
|
48
|
-
resetProps = __rest(props, ["tab", "size", "type", "icon", "selected", "closable", "disabled", "itemKey", "deleteTabItem", "tabPosition", "handleKeyDown", "onClick"]);
|
|
49
|
-
|
|
50
|
-
const closableIcon = (0, _react.useMemo)(() => {
|
|
51
|
-
return type === 'card' && closable ? /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, {
|
|
52
|
-
"aria-label": "Close",
|
|
53
|
-
role: "button",
|
|
54
|
-
className: "".concat(_constants.cssClasses.TABS_TAB, "-icon-close"),
|
|
55
|
-
onClick: e => deleteTabItem(itemKey, e)
|
|
56
|
-
}) : null;
|
|
57
|
-
}, [type, closable, deleteTabItem, itemKey]);
|
|
58
|
-
const renderIcon = (0, _react.useCallback)(icon => /*#__PURE__*/_react.default.createElement("span", null, icon), []);
|
|
59
|
-
const handleKeyDownInItem = (0, _react.useCallback)(event => {
|
|
60
|
-
handleKeyDown && handleKeyDown(event, itemKey, closable);
|
|
61
|
-
}, [handleKeyDown, itemKey, closable]);
|
|
62
|
-
const handleItemClick = (0, _react.useCallback)(e => {
|
|
63
|
-
!disabled && onClick && onClick(itemKey, e);
|
|
64
|
-
}, [itemKey, disabled, onClick]);
|
|
65
|
-
const panelIcon = icon ? renderIcon(icon) : null;
|
|
66
|
-
const className = (0, _classnames.default)(_constants.cssClasses.TABS_TAB, "".concat(_constants.cssClasses.TABS_TAB, "-").concat(type), "".concat(_constants.cssClasses.TABS_TAB, "-").concat(tabPosition), "".concat(_constants.cssClasses.TABS_TAB, "-single"), {
|
|
67
|
-
[_constants.cssClasses.TABS_TAB_ACTIVE]: selected,
|
|
68
|
-
[_constants.cssClasses.TABS_TAB_DISABLED]: disabled,
|
|
69
|
-
["".concat(_constants.cssClasses.TABS_TAB, "-small")]: size === 'small',
|
|
70
|
-
["".concat(_constants.cssClasses.TABS_TAB, "-medium")]: size === 'medium'
|
|
71
|
-
});
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
73
|
-
role: "tab",
|
|
74
|
-
id: "semiTab".concat(itemKey),
|
|
75
|
-
"data-tabkey": "semiTab".concat(itemKey),
|
|
76
|
-
"aria-controls": "semiTabPanel".concat(itemKey),
|
|
77
|
-
"aria-disabled": disabled ? 'true' : 'false',
|
|
78
|
-
"aria-selected": selected ? 'true' : 'false',
|
|
79
|
-
tabIndex: selected ? 0 : -1,
|
|
80
|
-
onKeyDown: handleKeyDownInItem,
|
|
81
|
-
onClick: handleItemClick,
|
|
82
|
-
className: className
|
|
83
|
-
}, resetProps, {
|
|
84
|
-
ref: ref
|
|
85
|
-
}), panelIcon, tab, closableIcon);
|
|
86
|
-
}; // Why is forwardRef needed here?
|
|
87
|
-
// Because TabItem needs to be used in OverflowList (when tabs' type is collapsible),
|
|
88
|
-
// OverflowList will pass ref to the outermost div DOM node of TabItem
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const ForwardTabItem = /*#__PURE__*/(0, _react.forwardRef)(TabItem); // @ts-ignore
|
|
92
|
-
|
|
93
|
-
ForwardTabItem.elementType = 'TabItem';
|
|
94
|
-
var _default = ForwardTabItem;
|
|
95
|
-
exports.default = _default;
|
package/lib/es/tabs/TabItem.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, MouseEvent } from 'react';
|
|
2
|
-
import { TabType, TabSize, TabPosition } from './interface';
|
|
3
|
-
export interface TabItemProps {
|
|
4
|
-
tab?: ReactNode;
|
|
5
|
-
icon?: ReactNode;
|
|
6
|
-
size?: TabSize;
|
|
7
|
-
type?: TabType;
|
|
8
|
-
tabPosition?: TabPosition;
|
|
9
|
-
selected?: boolean;
|
|
10
|
-
closable?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
itemKey?: string;
|
|
13
|
-
handleKeyDown?: (event: React.KeyboardEvent, itemKey: string, closable: boolean) => void;
|
|
14
|
-
deleteTabItem?: (tabKey: string, event: MouseEvent<Element>) => void;
|
|
15
|
-
onClick?: (itemKey: string, e: MouseEvent<Element>) => void;
|
|
16
|
-
}
|
|
17
|
-
declare const ForwardTabItem: React.ForwardRefExoticComponent<TabItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
-
export default ForwardTabItem;
|