@douyinfe/semi-ui 2.19.0-alpha.6 → 2.19.0-alpha.9

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.
Files changed (114) hide show
  1. package/avatar/index.tsx +3 -1
  2. package/button/buttonGroup.tsx +38 -4
  3. package/button/index.tsx +2 -0
  4. package/checkbox/_story/checkbox.stories.js +2 -0
  5. package/checkbox/checkbox.tsx +25 -20
  6. package/checkbox/checkboxGroup.tsx +1 -0
  7. package/dist/css/semi.css +64 -55
  8. package/dist/css/semi.min.css +1 -1
  9. package/dist/umd/semi-ui.js +422 -311
  10. package/dist/umd/semi-ui.js.map +1 -1
  11. package/dist/umd/semi-ui.min.js +1 -1
  12. package/dist/umd/semi-ui.min.js.map +1 -1
  13. package/form/baseForm.tsx +0 -1
  14. package/lib/cjs/anchor/index.d.ts +1 -1
  15. package/lib/cjs/autoComplete/index.d.ts +1 -1
  16. package/lib/cjs/avatar/index.d.ts +1 -0
  17. package/lib/cjs/avatar/index.js +2 -1
  18. package/lib/cjs/button/Button.d.ts +2 -2
  19. package/lib/cjs/button/buttonGroup.d.ts +2 -1
  20. package/lib/cjs/button/buttonGroup.js +52 -3
  21. package/lib/cjs/button/index.d.ts +2 -1
  22. package/lib/cjs/button/index.js +1 -0
  23. package/lib/cjs/carousel/CarouselIndicator.d.ts +2 -2
  24. package/lib/cjs/carousel/index.d.ts +3 -3
  25. package/lib/cjs/cascader/index.d.ts +1 -1
  26. package/lib/cjs/cascader/item.d.ts +1 -1
  27. package/lib/cjs/checkbox/checkbox.d.ts +1 -0
  28. package/lib/cjs/checkbox/checkbox.js +19 -10
  29. package/lib/cjs/checkbox/checkboxGroup.js +10 -9
  30. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  31. package/lib/cjs/datePicker/datePicker.d.ts +3 -3
  32. package/lib/cjs/datePicker/monthsGrid.d.ts +3 -3
  33. package/lib/cjs/datePicker/quickControl.d.ts +1 -1
  34. package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
  35. package/lib/cjs/dropdown/index.d.ts +1 -1
  36. package/lib/cjs/form/baseForm.d.ts +1 -1
  37. package/lib/cjs/form/baseForm.js +0 -1
  38. package/lib/cjs/form/field.d.ts +1 -1
  39. package/lib/cjs/popconfirm/index.d.ts +4 -2
  40. package/lib/cjs/popconfirm/index.js +49 -31
  41. package/lib/cjs/popover/index.d.ts +2 -2
  42. package/lib/cjs/radio/radio.d.ts +2 -1
  43. package/lib/cjs/radio/radio.js +1 -0
  44. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  45. package/lib/cjs/select/index.d.ts +1 -1
  46. package/lib/cjs/table/Table.d.ts +2 -2
  47. package/lib/cjs/tabs/TabBar.js +5 -1
  48. package/lib/cjs/tag/index.d.ts +1 -1
  49. package/lib/cjs/tag/index.js +1 -1
  50. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  51. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  52. package/lib/cjs/timePicker/index.d.ts +2 -2
  53. package/lib/cjs/tooltip/index.d.ts +2 -2
  54. package/lib/cjs/transfer/index.js +7 -2
  55. package/lib/cjs/typography/base.d.ts +1 -1
  56. package/lib/cjs/typography/paragraph.d.ts +1 -1
  57. package/lib/cjs/typography/text.d.ts +1 -1
  58. package/lib/cjs/typography/title.d.ts +1 -1
  59. package/lib/cjs/upload/index.d.ts +1 -1
  60. package/lib/es/anchor/index.d.ts +1 -1
  61. package/lib/es/autoComplete/index.d.ts +1 -1
  62. package/lib/es/avatar/index.d.ts +1 -0
  63. package/lib/es/avatar/index.js +2 -1
  64. package/lib/es/button/Button.d.ts +2 -2
  65. package/lib/es/button/buttonGroup.d.ts +2 -1
  66. package/lib/es/button/buttonGroup.js +50 -3
  67. package/lib/es/button/index.d.ts +2 -1
  68. package/lib/es/button/index.js +1 -0
  69. package/lib/es/carousel/CarouselIndicator.d.ts +2 -2
  70. package/lib/es/carousel/index.d.ts +3 -3
  71. package/lib/es/cascader/index.d.ts +1 -1
  72. package/lib/es/cascader/item.d.ts +1 -1
  73. package/lib/es/checkbox/checkbox.d.ts +1 -0
  74. package/lib/es/checkbox/checkbox.js +19 -10
  75. package/lib/es/checkbox/checkboxGroup.js +8 -7
  76. package/lib/es/datePicker/dateInput.d.ts +1 -1
  77. package/lib/es/datePicker/datePicker.d.ts +3 -3
  78. package/lib/es/datePicker/monthsGrid.d.ts +3 -3
  79. package/lib/es/datePicker/quickControl.d.ts +1 -1
  80. package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
  81. package/lib/es/dropdown/index.d.ts +1 -1
  82. package/lib/es/form/baseForm.d.ts +1 -1
  83. package/lib/es/form/baseForm.js +0 -1
  84. package/lib/es/form/field.d.ts +1 -1
  85. package/lib/es/popconfirm/index.d.ts +4 -2
  86. package/lib/es/popconfirm/index.js +49 -31
  87. package/lib/es/popover/index.d.ts +2 -2
  88. package/lib/es/radio/radio.d.ts +2 -1
  89. package/lib/es/radio/radio.js +1 -0
  90. package/lib/es/radio/radioGroup.d.ts +1 -1
  91. package/lib/es/select/index.d.ts +1 -1
  92. package/lib/es/table/Table.d.ts +2 -2
  93. package/lib/es/tabs/TabBar.js +5 -1
  94. package/lib/es/tag/index.d.ts +1 -1
  95. package/lib/es/tag/index.js +1 -1
  96. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  97. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  98. package/lib/es/timePicker/index.d.ts +2 -2
  99. package/lib/es/tooltip/index.d.ts +2 -2
  100. package/lib/es/transfer/index.js +7 -2
  101. package/lib/es/typography/base.d.ts +1 -1
  102. package/lib/es/typography/paragraph.d.ts +1 -1
  103. package/lib/es/typography/text.d.ts +1 -1
  104. package/lib/es/typography/title.d.ts +1 -1
  105. package/lib/es/upload/index.d.ts +1 -1
  106. package/package.json +7 -7
  107. package/popconfirm/_story/popconfirm.stories.js +37 -1
  108. package/popconfirm/index.tsx +14 -6
  109. package/radio/radio.tsx +2 -0
  110. package/tabs/TabBar.tsx +7 -1
  111. package/tag/index.tsx +1 -1
  112. package/transfer/_story/transfer.stories.js +2 -2
  113. package/transfer/index.tsx +7 -2
  114. package/treeSelect/_story/treeSelect.stories.js +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.19.0-alpha.6",
3
+ "version": "2.19.0-alpha.9",
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.6",
19
- "@douyinfe/semi-foundation": "2.19.0-alpha.6",
20
- "@douyinfe/semi-icons": "2.19.0-alpha.6",
18
+ "@douyinfe/semi-animation-react": "2.19.0-alpha.9",
19
+ "@douyinfe/semi-foundation": "2.19.0-alpha.9",
20
+ "@douyinfe/semi-icons": "2.19.0-alpha.9",
21
21
  "@douyinfe/semi-illustrations": "2.15.0",
22
- "@douyinfe/semi-theme-default": "2.19.0-alpha.6",
22
+ "@douyinfe/semi-theme-default": "2.19.0-alpha.9",
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": "f131defbb2a909ebb7035eea975bf3466908ac15",
69
+ "gitHead": "d8b8c16f3d15e7f89c41a591d0336f9f06b21eba",
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.6",
75
+ "@douyinfe/semi-scss-compile": "2.19.0-alpha.9",
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
+
@@ -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
- notifyConfirm: (e: React.MouseEvent): void => this.props.onConfirm(e),
126
- notifyCancel: (e: React.MouseEvent): void => this.props.onCancel(e),
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/radio/radio.tsx CHANGED
@@ -92,6 +92,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
92
92
  mode: '',
93
93
  type: 'default'
94
94
  };
95
+ static elementType: string;
95
96
 
96
97
  radioEntity: RadioInner;
97
98
  context!: RadioContextValue;
@@ -317,5 +318,6 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
317
318
  );
318
319
  }
319
320
  }
321
+ Radio.elementType = 'Radio';
320
322
 
321
323
  export default Radio;
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 null;
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/tag/index.tsx CHANGED
@@ -40,7 +40,7 @@ export default class Tag extends Component<TagProps, TagState> {
40
40
 
41
41
  static propTypes = {
42
42
  children: PropTypes.node,
43
- tagKey: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
43
+ tagKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
44
44
  size: PropTypes.oneOf(tagSize),
45
45
  color: PropTypes.oneOf(tagColors),
46
46
  type: PropTypes.oneOf(tagType),
@@ -209,9 +209,9 @@ const ControlledTransfer = () => {
209
209
  );
210
210
  };
211
211
 
212
- export const ControlledTransfer = () => <ControlledTransfer />;
212
+ export const ControlledTransferDemo = () => <ControlledTransfer />;
213
213
 
214
- ControlledTransfer.story = {
214
+ ControlledTransferDemo.story = {
215
215
  name: '受控Transfer',
216
216
  };
217
217
 
@@ -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 emptyCom = this.renderEmpty('left', inputValue ? emptySearch : emptyLeft);
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 = emptyCom;
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 = (
@@ -469,6 +469,9 @@ export const Multiple = () => (
469
469
  // value={this.state.value}
470
470
  dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
471
471
  treeData={treeData2}
472
+ defaultOpen
473
+ defaultExpandAll
474
+ motion={false}
472
475
  multiple
473
476
  placeholder="Please select"
474
477
  />