@douyinfe/semi-ui 2.30.2 → 2.31.0-beta.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 +66 -51
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +186 -64
- 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/_base/base.d.ts +3 -3
- package/lib/cjs/anchor/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/cascader/index.js +2 -1
- package/lib/cjs/checkbox/checkbox.d.ts +1 -1
- package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/cjs/descriptions/index.d.ts +1 -1
- package/lib/cjs/layout/index.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +1 -1
- package/lib/cjs/popover/index.d.ts +1 -0
- package/lib/cjs/progress/index.d.ts +3 -3
- package/lib/cjs/radio/radio.d.ts +1 -1
- package/lib/cjs/table/Body/index.js +4 -8
- package/lib/cjs/table/Table.js +7 -4
- package/lib/cjs/table/TableCell.js +30 -7
- package/lib/cjs/table/TableContextProvider.d.ts +1 -1
- package/lib/cjs/table/TableContextProvider.js +5 -3
- package/lib/cjs/table/TableHeaderRow.js +28 -9
- package/lib/cjs/table/index.d.ts +3 -0
- package/lib/cjs/table/index.js +11 -3
- package/lib/cjs/table/interface.d.ts +1 -0
- package/lib/cjs/table/table-context.d.ts +2 -0
- package/lib/cjs/tabs/interface.d.ts +1 -1
- package/lib/cjs/tag/index.js +4 -2
- package/lib/cjs/tagInput/index.d.ts +1 -1
- package/lib/cjs/tagInput/index.js +1 -3
- package/lib/cjs/tooltip/index.d.ts +4 -0
- package/lib/cjs/tooltip/index.js +21 -6
- package/lib/cjs/typography/copyable.d.ts +3 -0
- package/lib/cjs/typography/copyable.js +30 -9
- package/lib/es/_base/base.d.ts +3 -3
- package/lib/es/anchor/index.d.ts +1 -1
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/cascader/index.js +2 -1
- package/lib/es/checkbox/checkbox.d.ts +1 -1
- package/lib/es/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/es/descriptions/index.d.ts +1 -1
- package/lib/es/layout/index.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +1 -1
- package/lib/es/popover/index.d.ts +1 -0
- package/lib/es/progress/index.d.ts +3 -3
- package/lib/es/radio/radio.d.ts +1 -1
- package/lib/es/table/Body/index.js +4 -7
- package/lib/es/table/Table.js +7 -4
- package/lib/es/table/TableCell.js +31 -8
- package/lib/es/table/TableContextProvider.d.ts +1 -1
- package/lib/es/table/TableContextProvider.js +5 -3
- package/lib/es/table/TableHeaderRow.js +29 -10
- package/lib/es/table/index.d.ts +3 -0
- package/lib/es/table/index.js +10 -3
- package/lib/es/table/interface.d.ts +1 -0
- package/lib/es/table/table-context.d.ts +2 -0
- package/lib/es/tabs/interface.d.ts +1 -1
- package/lib/es/tag/index.js +7 -2
- package/lib/es/tagInput/index.d.ts +1 -1
- package/lib/es/tagInput/index.js +1 -3
- package/lib/es/tooltip/index.d.ts +4 -0
- package/lib/es/tooltip/index.js +21 -6
- package/lib/es/typography/copyable.d.ts +3 -0
- package/lib/es/typography/copyable.js +28 -9
- package/package.json +8 -8
package/lib/es/tooltip/index.js
CHANGED
|
@@ -85,7 +85,12 @@ export default class Tooltip extends BaseComponent {
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
this.didLeave = () => {
|
|
88
|
-
this.
|
|
88
|
+
if (this.props.keepDOM) {
|
|
89
|
+
this.foundation.setDisplayNone(true);
|
|
90
|
+
} else {
|
|
91
|
+
this.foundation.removePortal();
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
this.foundation.unBindEvent();
|
|
90
95
|
};
|
|
91
96
|
|
|
@@ -155,6 +160,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
155
160
|
visible,
|
|
156
161
|
portalEventSet,
|
|
157
162
|
placement,
|
|
163
|
+
displayNone,
|
|
158
164
|
transitionState,
|
|
159
165
|
id,
|
|
160
166
|
isPositionUpdated
|
|
@@ -209,7 +215,9 @@ export default class Tooltip extends BaseComponent {
|
|
|
209
215
|
} = _ref;
|
|
210
216
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
211
217
|
className: classNames(className, animationClassName),
|
|
212
|
-
style: Object.assign(Object.assign(Object.assign(Object.assign({}, animationStyle), {
|
|
218
|
+
style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, animationStyle), displayNone ? {
|
|
219
|
+
display: "none"
|
|
220
|
+
} : {}), {
|
|
213
221
|
transformOrigin
|
|
214
222
|
}), style), {
|
|
215
223
|
opacity: isPositionUpdated ? opacity : "0"
|
|
@@ -299,8 +307,8 @@ export default class Tooltip extends BaseComponent {
|
|
|
299
307
|
placement: props.position || 'top',
|
|
300
308
|
transitionStyle: {},
|
|
301
309
|
isPositionUpdated: false,
|
|
302
|
-
id: props.wrapperId
|
|
303
|
-
|
|
310
|
+
id: props.wrapperId,
|
|
311
|
+
displayNone: false
|
|
304
312
|
};
|
|
305
313
|
this.foundation = new TooltipFoundation(this.adapter);
|
|
306
314
|
this.eventManager = new Event();
|
|
@@ -424,6 +432,11 @@ export default class Tooltip extends BaseComponent {
|
|
|
424
432
|
this.eventManager.emit('positionUpdated');
|
|
425
433
|
});
|
|
426
434
|
},
|
|
435
|
+
setDisplayNone: (displayNone, cb) => {
|
|
436
|
+
this.setState({
|
|
437
|
+
displayNone
|
|
438
|
+
}, cb);
|
|
439
|
+
},
|
|
427
440
|
updatePlacementAttr: placement => {
|
|
428
441
|
this.setState({
|
|
429
442
|
placement
|
|
@@ -730,7 +743,8 @@ Tooltip.propTypes = {
|
|
|
730
743
|
wrapWhenSpecial: PropTypes.bool,
|
|
731
744
|
guardFocus: PropTypes.bool,
|
|
732
745
|
returnFocusOnClose: PropTypes.bool,
|
|
733
|
-
preventScroll: PropTypes.bool
|
|
746
|
+
preventScroll: PropTypes.bool,
|
|
747
|
+
keepDOM: PropTypes.bool
|
|
734
748
|
};
|
|
735
749
|
Tooltip.defaultProps = {
|
|
736
750
|
arrowBounding: numbers.ARROW_BOUNDING,
|
|
@@ -756,5 +770,6 @@ Tooltip.defaultProps = {
|
|
|
756
770
|
returnFocusOnClose: false,
|
|
757
771
|
onEscKeyDown: _noop,
|
|
758
772
|
disableFocusListener: false,
|
|
759
|
-
disableArrowKeyDown: false
|
|
773
|
+
disableArrowKeyDown: false,
|
|
774
|
+
keepDOM: false
|
|
760
775
|
};
|
|
@@ -8,6 +8,7 @@ export interface CopyableProps extends BaseProps {
|
|
|
8
8
|
duration?: number;
|
|
9
9
|
forwardRef?: React.RefObject<any>;
|
|
10
10
|
successTip?: React.ReactNode;
|
|
11
|
+
icon?: React.ReactNode;
|
|
11
12
|
onCopy?: (e: React.MouseEvent, content: string, res: boolean) => void;
|
|
12
13
|
}
|
|
13
14
|
interface CopyableState {
|
|
@@ -23,6 +24,7 @@ export declare class Copyable extends React.PureComponent<CopyableProps, Copyabl
|
|
|
23
24
|
duration: PropTypes.Requireable<number>;
|
|
24
25
|
style: PropTypes.Requireable<object>;
|
|
25
26
|
className: PropTypes.Requireable<string>;
|
|
27
|
+
icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
28
|
};
|
|
27
29
|
static defaultProps: {
|
|
28
30
|
content: string;
|
|
@@ -38,6 +40,7 @@ export declare class Copyable extends React.PureComponent<CopyableProps, Copyabl
|
|
|
38
40
|
setCopied: (item: string, timer: number) => void;
|
|
39
41
|
resetCopied: () => void;
|
|
40
42
|
renderSuccessTip: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
43
|
+
renderCopyIcon: () => JSX.Element;
|
|
41
44
|
render(): JSX.Element;
|
|
42
45
|
}
|
|
43
46
|
export default Copyable;
|
|
@@ -59,6 +59,31 @@ export class Copyable extends React.PureComponent {
|
|
|
59
59
|
}, locale => /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(IconTick, null), locale.copied));
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
this.renderCopyIcon = () => {
|
|
63
|
+
const {
|
|
64
|
+
icon
|
|
65
|
+
} = this.props;
|
|
66
|
+
const copyProps = {
|
|
67
|
+
role: "button",
|
|
68
|
+
tabIndex: 0,
|
|
69
|
+
onClick: this.copy,
|
|
70
|
+
onKeyPress: e => isEnterPress(e) && this.copy(e)
|
|
71
|
+
};
|
|
72
|
+
{
|
|
73
|
+
/* TODO: replace `a` tag with `span` in next major version
|
|
74
|
+
NOTE: may have effect on style */
|
|
75
|
+
}
|
|
76
|
+
const defaultIcon =
|
|
77
|
+
/*#__PURE__*/
|
|
78
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
79
|
+
React.createElement("a", {
|
|
80
|
+
className: `${prefixCls}-action-copy-icon`
|
|
81
|
+
}, /*#__PURE__*/React.createElement(IconCopy, Object.assign({
|
|
82
|
+
onClick: this.copy
|
|
83
|
+
}, copyProps)));
|
|
84
|
+
return /*#__PURE__*/React.isValidElement(icon) ? /*#__PURE__*/React.cloneElement(icon, copyProps) : defaultIcon;
|
|
85
|
+
};
|
|
86
|
+
|
|
62
87
|
this.state = {
|
|
63
88
|
copied: false,
|
|
64
89
|
item: ''
|
|
@@ -96,14 +121,7 @@ export class Copyable extends React.PureComponent {
|
|
|
96
121
|
ref: forwardRef
|
|
97
122
|
}, copied ? this.renderSuccessTip() : /*#__PURE__*/React.createElement(Tooltip, {
|
|
98
123
|
content: typeof copyTip !== 'undefined' ? copyTip : locale.copy
|
|
99
|
-
},
|
|
100
|
-
className: `${prefixCls}-action-copy-icon`
|
|
101
|
-
}, /*#__PURE__*/React.createElement(IconCopy, {
|
|
102
|
-
role: "button",
|
|
103
|
-
tabIndex: 0,
|
|
104
|
-
onClick: this.copy,
|
|
105
|
-
onKeyPress: e => isEnterPress(e) && this.copy(e)
|
|
106
|
-
})))));
|
|
124
|
+
}, this.renderCopyIcon())));
|
|
107
125
|
}
|
|
108
126
|
|
|
109
127
|
}
|
|
@@ -114,7 +132,8 @@ Copyable.propTypes = {
|
|
|
114
132
|
copyTip: PropTypes.node,
|
|
115
133
|
duration: PropTypes.number,
|
|
116
134
|
style: PropTypes.object,
|
|
117
|
-
className: PropTypes.string
|
|
135
|
+
className: PropTypes.string,
|
|
136
|
+
icon: PropTypes.node
|
|
118
137
|
};
|
|
119
138
|
Copyable.defaultProps = {
|
|
120
139
|
content: '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0-beta.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.
|
|
21
|
-
"@douyinfe/semi-animation-react": "2.
|
|
22
|
-
"@douyinfe/semi-foundation": "2.
|
|
23
|
-
"@douyinfe/semi-icons": "2.
|
|
24
|
-
"@douyinfe/semi-illustrations": "2.
|
|
25
|
-
"@douyinfe/semi-theme-default": "2.
|
|
20
|
+
"@douyinfe/semi-animation": "2.31.0-beta.0",
|
|
21
|
+
"@douyinfe/semi-animation-react": "2.31.0-beta.0",
|
|
22
|
+
"@douyinfe/semi-foundation": "2.31.0-beta.0",
|
|
23
|
+
"@douyinfe/semi-icons": "2.31.0-beta.0",
|
|
24
|
+
"@douyinfe/semi-illustrations": "2.31.0-beta.0",
|
|
25
|
+
"@douyinfe/semi-theme-default": "2.31.0-beta.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": "8b378259f169ca3bfb9af17118e962d717efa685",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|