@douyinfe/semi-ui 2.19.0-alpha.0 → 2.19.0-alpha.3
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/checkbox/checkbox.tsx +7 -7
- package/dist/css/semi.css +9 -10
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +111 -63
- 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/form/baseForm.tsx +0 -1
- package/lib/cjs/checkbox/checkbox.js +8 -2
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/baseForm.js +0 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/popconfirm/index.d.ts +4 -2
- package/lib/cjs/popconfirm/index.js +49 -31
- package/lib/cjs/tabs/TabBar.js +5 -1
- package/lib/cjs/transfer/index.js +7 -2
- package/lib/cjs/tree/treeNode.d.ts +1 -4
- package/lib/cjs/tree/treeNode.js +4 -13
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/checkbox/checkbox.js +8 -2
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/baseForm.js +0 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/popconfirm/index.d.ts +4 -2
- package/lib/es/popconfirm/index.js +49 -31
- package/lib/es/tabs/TabBar.js +5 -1
- package/lib/es/transfer/index.js +7 -2
- package/lib/es/tree/treeNode.d.ts +1 -4
- package/lib/es/tree/treeNode.js +4 -13
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +7 -7
- package/popconfirm/_story/popconfirm.stories.js +37 -1
- package/popconfirm/index.tsx +14 -6
- package/tabs/TabBar.tsx +7 -1
- package/transfer/index.tsx +7 -2
- package/tree/treeNode.tsx +5 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.19.0-alpha.
|
|
3
|
+
"version": "2.19.0-alpha.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
17
|
"@douyinfe/semi-animation": "2.12.0",
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.19.0-alpha.
|
|
19
|
-
"@douyinfe/semi-foundation": "2.19.0-alpha.
|
|
20
|
-
"@douyinfe/semi-icons": "2.19.0-alpha.
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.19.0-alpha.3",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.19.0-alpha.3",
|
|
20
|
+
"@douyinfe/semi-icons": "2.19.0-alpha.3",
|
|
21
21
|
"@douyinfe/semi-illustrations": "2.15.0",
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.19.0-alpha.
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.19.0-alpha.3",
|
|
23
23
|
"async-validator": "^3.5.0",
|
|
24
24
|
"classnames": "^2.2.6",
|
|
25
25
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
],
|
|
67
67
|
"author": "",
|
|
68
68
|
"license": "MIT",
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "db52c2a32ffb9587992b72bf7114289a4759e790",
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
72
72
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
73
73
|
"@babel/preset-env": "^7.15.8",
|
|
74
74
|
"@babel/preset-react": "^7.14.5",
|
|
75
|
-
"@douyinfe/semi-scss-compile": "2.19.0-alpha.
|
|
75
|
+
"@douyinfe/semi-scss-compile": "2.19.0-alpha.3",
|
|
76
76
|
"@storybook/addon-knobs": "^6.3.1",
|
|
77
77
|
"@types/lodash": "^4.14.176",
|
|
78
78
|
"@types/react": ">=16.0.0",
|
|
@@ -167,4 +167,40 @@ export const ClickOutSideDemo = () => {
|
|
|
167
167
|
|
|
168
168
|
ClickOutSideDemo.story = {
|
|
169
169
|
name: 'ClickOutSideDemo',
|
|
170
|
-
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const PromiseCallback = () => {
|
|
173
|
+
const onConfirm = () => {
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
console.log('ccc');
|
|
177
|
+
resolve(1);
|
|
178
|
+
}, 2000)
|
|
179
|
+
})
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const onCancel = () => {
|
|
183
|
+
return new Promise((resolve, reject) => {
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
console.log('ccc');
|
|
186
|
+
reject(1);
|
|
187
|
+
}, 2000)
|
|
188
|
+
})
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<Popconfirm
|
|
193
|
+
title="确定是否要保存此修改?"
|
|
194
|
+
content="此修改将不可逆"
|
|
195
|
+
onConfirm={onConfirm}
|
|
196
|
+
onCancel={onCancel}
|
|
197
|
+
>
|
|
198
|
+
<Button>保存</Button>
|
|
199
|
+
</Popconfirm>
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
PromiseCallback.story = {
|
|
204
|
+
name: 'PromiseCallbackDemo',
|
|
205
|
+
};
|
|
206
|
+
|
package/popconfirm/index.tsx
CHANGED
|
@@ -35,14 +35,16 @@ export interface PopconfirmProps extends PopoverProps {
|
|
|
35
35
|
zIndex?: number;
|
|
36
36
|
trigger?: Trigger;
|
|
37
37
|
position?: Position;
|
|
38
|
-
onCancel?: (e: React.MouseEvent) => void;
|
|
39
|
-
onConfirm?: (e: React.MouseEvent) => void;
|
|
38
|
+
onCancel?: (e: React.MouseEvent) => Promise<any> | void;
|
|
39
|
+
onConfirm?: (e: React.MouseEvent) => Promise<any> | void;
|
|
40
40
|
onVisibleChange?: (visible: boolean) => void;
|
|
41
41
|
onClickOutSide?: (e: React.MouseEvent) => void;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export interface PopconfirmState {
|
|
45
45
|
visible: boolean;
|
|
46
|
+
cancelLoading: boolean;
|
|
47
|
+
confirmLoading: boolean;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
interface PopProps {
|
|
@@ -99,6 +101,8 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
99
101
|
super(props);
|
|
100
102
|
|
|
101
103
|
this.state = {
|
|
104
|
+
cancelLoading: false,
|
|
105
|
+
confirmLoading: false,
|
|
102
106
|
visible: props.defaultVisible || false,
|
|
103
107
|
};
|
|
104
108
|
|
|
@@ -122,8 +126,10 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
122
126
|
return {
|
|
123
127
|
...super.adapter,
|
|
124
128
|
setVisible: (visible: boolean): void => this.setState({ visible }),
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
updateConfirmLoading: (loading: boolean): void => this.setState({ confirmLoading: loading }),
|
|
130
|
+
updateCancelLoading: (loading: boolean): void => this.setState({ cancelLoading: loading }),
|
|
131
|
+
notifyConfirm: (e: React.MouseEvent): Promise<any> | void => this.props.onConfirm(e),
|
|
132
|
+
notifyCancel: (e: React.MouseEvent): Promise<any> | void => this.props.onCancel(e),
|
|
127
133
|
notifyVisibleChange: (visible: boolean): void => this.props.onVisibleChange(visible),
|
|
128
134
|
notifyClickOutSide: (e: React.MouseEvent) => this.props.onClickOutSide(e),
|
|
129
135
|
};
|
|
@@ -141,14 +147,15 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
141
147
|
|
|
142
148
|
renderControls() {
|
|
143
149
|
const { okText, cancelText, okType, cancelType, cancelButtonProps, okButtonProps } = this.props;
|
|
150
|
+
const { cancelLoading, confirmLoading } = this.state;
|
|
144
151
|
return (
|
|
145
152
|
<LocaleConsumer componentName="Popconfirm">
|
|
146
153
|
{(locale: LocaleObject['Popconfirm'], localeCode: string) => (
|
|
147
154
|
<>
|
|
148
|
-
<Button type={cancelType} onClick={this.handleCancel} {...cancelButtonProps}>
|
|
155
|
+
<Button type={cancelType} onClick={this.handleCancel} loading={cancelLoading} {...cancelButtonProps}>
|
|
149
156
|
{cancelText || get(locale, 'cancel')}
|
|
150
157
|
</Button>
|
|
151
|
-
<Button type={okType} theme="solid" onClick={this.handleConfirm} {...okButtonProps}>
|
|
158
|
+
<Button type={okType} theme="solid" onClick={this.handleConfirm} loading={confirmLoading} {...okButtonProps}>
|
|
152
159
|
{okText || get(locale, 'confirm')}
|
|
153
160
|
</Button>
|
|
154
161
|
</>
|
|
@@ -171,6 +178,7 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
171
178
|
const showContent = content !== null || typeof content !== 'undefined';
|
|
172
179
|
|
|
173
180
|
return (
|
|
181
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
174
182
|
<div className={popCardCls} onClick={this.stopImmediatePropagation} style={style}>
|
|
175
183
|
<div className={`${prefixCls}-inner`}>
|
|
176
184
|
<div className={`${prefixCls}-header`}>
|
package/tabs/TabBar.tsx
CHANGED
|
@@ -147,7 +147,13 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
|
|
|
147
147
|
|
|
148
148
|
renderCollapse = (items: Array<OverflowItem>, icon: ReactNode, pos: 'start' | 'end'): ReactNode => {
|
|
149
149
|
if (isEmpty(items)) {
|
|
150
|
-
return
|
|
150
|
+
return (
|
|
151
|
+
<Button
|
|
152
|
+
disabled={true}
|
|
153
|
+
icon={icon}
|
|
154
|
+
theme="borderless"
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
151
157
|
}
|
|
152
158
|
const { dropdownClassName, dropdownStyle } = this.props;
|
|
153
159
|
const { rePosKey } = this.state;
|
package/transfer/index.tsx
CHANGED
|
@@ -393,7 +393,9 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
393
393
|
const noMatch = inSearchMode && searchResult.size === 0;
|
|
394
394
|
const emptySearch = emptyContent.search ? emptyContent.search : locale.emptySearch;
|
|
395
395
|
const emptyLeft = emptyContent.left ? emptyContent.left : locale.emptyLeft;
|
|
396
|
-
const
|
|
396
|
+
const emptyDataCom = this.renderEmpty('left', emptyLeft);
|
|
397
|
+
const emptySearchCom = this.renderEmpty('left', emptySearch);
|
|
398
|
+
|
|
397
399
|
const loadingCom = <Spin />;
|
|
398
400
|
|
|
399
401
|
let content: React.ReactNode = null;
|
|
@@ -402,7 +404,10 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
402
404
|
content = loadingCom;
|
|
403
405
|
break;
|
|
404
406
|
case noMatch:
|
|
405
|
-
content =
|
|
407
|
+
content = emptySearchCom;
|
|
408
|
+
break;
|
|
409
|
+
case data.length === 0:
|
|
410
|
+
content = emptyDataCom;
|
|
406
411
|
break;
|
|
407
412
|
case type === strings.TYPE_TREE_TO_LIST:
|
|
408
413
|
content = (
|
package/tree/treeNode.tsx
CHANGED
|
@@ -220,8 +220,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
220
220
|
);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
renderCheckbox(
|
|
224
|
-
const { label, icon } = options;
|
|
223
|
+
renderCheckbox() {
|
|
225
224
|
const { checked, halfChecked, eventKey } = this.props;
|
|
226
225
|
const disabled = this.isDisabled();
|
|
227
226
|
return (
|
|
@@ -236,10 +235,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
236
235
|
indeterminate={halfChecked}
|
|
237
236
|
checked={checked}
|
|
238
237
|
disabled={Boolean(disabled)}
|
|
239
|
-
|
|
240
|
-
{icon}
|
|
241
|
-
{label}
|
|
242
|
-
</Checkbox>
|
|
238
|
+
/>
|
|
243
239
|
</div>
|
|
244
240
|
);
|
|
245
241
|
}
|
|
@@ -413,8 +409,6 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
413
409
|
});
|
|
414
410
|
const setsize = get(rest, ['data', 'children', 'length']);
|
|
415
411
|
const posinset = isString(rest.pos) ? Number(rest.pos.split('-')[level+1]) + 1 : 1;
|
|
416
|
-
const label = this.renderRealLabel();
|
|
417
|
-
const icon = this.renderIcon();
|
|
418
412
|
return (
|
|
419
413
|
<li
|
|
420
414
|
className={nodeCls}
|
|
@@ -439,9 +433,9 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
439
433
|
<span
|
|
440
434
|
className={labelCls}
|
|
441
435
|
>
|
|
442
|
-
{multiple ? this.renderCheckbox(
|
|
443
|
-
{
|
|
444
|
-
|
|
436
|
+
{multiple ? this.renderCheckbox() : null}
|
|
437
|
+
{this.renderIcon()}
|
|
438
|
+
<span className={`${prefixcls}-label-text`}>{this.renderRealLabel()}</span>
|
|
445
439
|
</span>
|
|
446
440
|
</li>
|
|
447
441
|
);
|