@douyinfe/semi-ui 2.1.4-alpha.0 → 2.1.4

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 (65) hide show
  1. package/_base/_story/index.scss +1 -0
  2. package/button/__test__/button.test.js +15 -0
  3. package/button/_story/button.stories.js +13 -0
  4. package/button/buttonGroup.tsx +6 -4
  5. package/cascader/item.tsx +3 -0
  6. package/checkbox/__test__/checkboxGroup.test.js +37 -5
  7. package/checkbox/_story/checkbox.stories.js +78 -6
  8. package/checkbox/checkbox.tsx +1 -0
  9. package/dist/css/semi.css +57 -4
  10. package/dist/css/semi.min.css +1 -1
  11. package/dist/umd/semi-ui.js +284 -256
  12. package/dist/umd/semi-ui.js.map +1 -1
  13. package/dist/umd/semi-ui.min.js +1 -1
  14. package/dist/umd/semi-ui.min.js.map +1 -1
  15. package/form/_story/form.stories.tsx +2 -2
  16. package/form/hoc/withField.tsx +1 -1
  17. package/lib/cjs/button/buttonGroup.js +11 -3
  18. package/lib/cjs/cascader/item.js +5 -0
  19. package/lib/cjs/checkbox/checkbox.js +1 -0
  20. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  21. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  22. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  23. package/lib/cjs/modal/Modal.d.ts +6 -6
  24. package/lib/cjs/modal/Modal.js +2 -2
  25. package/lib/cjs/radio/radio.d.ts +1 -1
  26. package/lib/cjs/radio/radio.js +1 -0
  27. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  28. package/lib/cjs/rating/item.js +2 -1
  29. package/lib/cjs/table/Table.d.ts +1 -1
  30. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  31. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  32. package/lib/cjs/timePicker/index.d.ts +2 -2
  33. package/lib/cjs/treeSelect/index.js +1 -0
  34. package/lib/cjs/typography/title.d.ts +1 -1
  35. package/lib/cjs/upload/index.d.ts +11 -2
  36. package/lib/cjs/upload/index.js +8 -0
  37. package/lib/es/button/buttonGroup.js +3 -3
  38. package/lib/es/cascader/item.js +5 -0
  39. package/lib/es/checkbox/checkbox.js +1 -0
  40. package/lib/es/datePicker/dateInput.d.ts +1 -1
  41. package/lib/es/datePicker/datePicker.d.ts +1 -1
  42. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  43. package/lib/es/modal/Modal.d.ts +6 -6
  44. package/lib/es/modal/Modal.js +2 -2
  45. package/lib/es/radio/radio.d.ts +1 -1
  46. package/lib/es/radio/radio.js +1 -0
  47. package/lib/es/radio/radioGroup.d.ts +1 -1
  48. package/lib/es/rating/item.js +2 -1
  49. package/lib/es/table/Table.d.ts +1 -1
  50. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  51. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  52. package/lib/es/timePicker/index.d.ts +2 -2
  53. package/lib/es/treeSelect/index.js +1 -0
  54. package/lib/es/typography/title.d.ts +1 -1
  55. package/lib/es/upload/index.d.ts +11 -2
  56. package/lib/es/upload/index.js +8 -0
  57. package/modal/Modal.tsx +2 -2
  58. package/package.json +8 -8
  59. package/radio/__test__/radioGroup.test.jsx +41 -6
  60. package/radio/_story/radio.stories.js +10 -10
  61. package/radio/radio.tsx +1 -0
  62. package/rating/item.tsx +1 -0
  63. package/treeSelect/index.tsx +3 -2
  64. package/tsconfig.json +2 -1
  65. package/upload/index.tsx +8 -1
@@ -267,6 +267,14 @@ class Upload extends BaseComponent {
267
267
  this.inputRef = /*#__PURE__*/React.createRef();
268
268
  this.replaceInputRef = /*#__PURE__*/React.createRef();
269
269
  }
270
+ /**
271
+ * Notes:
272
+ * The input parameter and return value here do not declare the type, otherwise tsc may report an error in form/fields.tsx when wrap after withField
273
+ * `The types of the parameters "props" and "nextProps" are incompatible.
274
+ The attribute "action" is missing in the type "Readonly<any>", but it is required in the type "UploadProps".`
275
+ * which seems to be a bug, remove props type declare here
276
+ */
277
+
270
278
 
271
279
  static getDerivedStateFromProps(props) {
272
280
  const {
package/modal/Modal.tsx CHANGED
@@ -11,9 +11,9 @@ import PropTypes from 'prop-types';
11
11
  import { noop } from 'lodash';
12
12
  import '@douyinfe/semi-foundation/modal/modal.scss';
13
13
  import BaseComponent from '../_base/baseComponent';
14
- import confirm, { withConfirm, withError, withInfo, withSuccess, withWarning } from '../modal/confirm';
14
+ import confirm, { withConfirm, withError, withInfo, withSuccess, withWarning } from './confirm';
15
15
  import { Locale } from '../locale/interface';
16
- import useModal from '../modal/useModal';
16
+ import useModal from './useModal';
17
17
  import { ButtonProps } from '../button/Button';
18
18
 
19
19
  export const destroyFns: any[] = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.1.4-alpha.0",
3
+ "version": "2.1.4",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -14,11 +14,11 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
- "@douyinfe/semi-animation-react": "2.1.3",
18
- "@douyinfe/semi-foundation": "2.1.3",
19
- "@douyinfe/semi-icons": "2.1.3",
20
- "@douyinfe/semi-illustrations": "2.1.3",
21
- "@douyinfe/semi-theme-default": "2.1.3",
17
+ "@douyinfe/semi-animation-react": "2.1.4",
18
+ "@douyinfe/semi-foundation": "2.1.4",
19
+ "@douyinfe/semi-icons": "2.1.4",
20
+ "@douyinfe/semi-illustrations": "2.1.4",
21
+ "@douyinfe/semi-theme-default": "2.1.4",
22
22
  "@types/react-window": "^1.8.2",
23
23
  "async-validator": "^3.5.0",
24
24
  "classnames": "^2.2.6",
@@ -60,13 +60,13 @@
60
60
  ],
61
61
  "author": "",
62
62
  "license": "MIT",
63
- "gitHead": "77731b7e7efb84a5233e1ba6e96cca47e1b86620",
63
+ "gitHead": "c6ce83aa28229d455cba4c01bc84c53f76c57c78",
64
64
  "devDependencies": {
65
65
  "@babel/plugin-proposal-decorators": "^7.15.8",
66
66
  "@babel/plugin-transform-runtime": "^7.15.8",
67
67
  "@babel/preset-env": "^7.15.8",
68
68
  "@babel/preset-react": "^7.14.5",
69
- "@douyinfe/semi-scss-compile": "2.1.3",
69
+ "@douyinfe/semi-scss-compile": "2.1.4",
70
70
  "@storybook/addon-knobs": "^6.3.1",
71
71
  "@types/lodash": "^4.14.176",
72
72
  "babel-loader": "^8.2.2",
@@ -131,20 +131,55 @@ describe('RadioGroup', () => {
131
131
  });
132
132
 
133
133
  it('radioGroup card style', () => {
134
- const radio = mount(
134
+ const radioGroup = mount(
135
135
  createRadioGroup({ type: 'card' })
136
136
  );
137
- expect(radio.exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)).toEqual(true);
137
+ expect(radioGroup.exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)).toEqual(true);
138
+ radioGroup.unmount();
139
+
140
+ const disabledRadioGroup = mount(
141
+ createRadioGroup({ type: 'card', disabled: true, defaultValue: 'A' })
142
+ );
143
+ expect(
144
+ disabledRadioGroup
145
+ .find(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)
146
+ .at(0)
147
+ .exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup_checked_disabled`)
148
+ ).toEqual(true);
149
+ expect(
150
+ disabledRadioGroup
151
+ .find(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)
152
+ .at(1)
153
+ .exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup_checked_disabled`)
154
+ ).toEqual(false);
155
+ disabledRadioGroup.unmount();
138
156
  });
139
157
 
140
158
  it('radioGroup pure card style', () => {
141
- const radio = mount(
159
+ const radioGroup = mount(
142
160
  createRadioGroup({ type: 'pureCard' })
143
161
  );
144
- expect(radio.exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)).toEqual(true);
145
- expect(radio.exists(`.${BASE_CLASS_PREFIX}-radio-inner-pureCardRadio`)).toEqual(true);
146
- });
162
+ expect(radioGroup.exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)).toEqual(true);
163
+ expect(radioGroup.exists(`.${BASE_CLASS_PREFIX}-radio-inner-pureCardRadio`)).toEqual(true);
164
+ radioGroup.unmount();
147
165
 
166
+ const disabledRadioGroup = mount(
167
+ createRadioGroup({ type: 'pureCard', disabled: true, defaultValue: 'A' })
168
+ );
169
+ expect(
170
+ disabledRadioGroup
171
+ .find(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)
172
+ .at(0)
173
+ .exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup_checked_disabled`)
174
+ ).toEqual(true);
175
+ expect(
176
+ disabledRadioGroup
177
+ .find(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup`)
178
+ .at(1)
179
+ .exists(`.${BASE_CLASS_PREFIX}-radio-cardRadioGroup_checked_disabled`)
180
+ ).toEqual(false);
181
+ disabledRadioGroup.unmount();
182
+ });
148
183
 
149
184
  it('The buttonSize of the button type radio', () => {
150
185
  const smallRadio = mount(
@@ -481,10 +481,10 @@ export const RadioGroupCardStyle = () => (
481
481
  <br />
482
482
  <div>radio disabled</div>
483
483
  <RadioGroup type="card" defaultValue={1}>
484
- <Radio value={1} disabled extra="Semi Design" style={{ width: 280 }}>
484
+ <Radio value={1} disabled extra="disabled+checked" style={{ width: 280 }}>
485
485
  多选框标题
486
486
  </Radio>
487
- <Radio value={2} extra="Semi Design" style={{ width: 280 }}>
487
+ <Radio value={2} disabled extra="disabled+unchecked" style={{ width: 280 }}>
488
488
  多选框标题
489
489
  </Radio>
490
490
  <Radio value={3} extra="Semi Design" style={{ width: 280 }}>
@@ -495,13 +495,13 @@ export const RadioGroupCardStyle = () => (
495
495
  <br />
496
496
  <div>radioGroup disabled</div>
497
497
  <RadioGroup type="card" disabled defaultValue={1}>
498
- <Radio value={1} extra="Semi Design" style={{ width: 280 }}>
498
+ <Radio value={1} extra="disabled+checked" style={{ width: 280 }}>
499
499
  多选框标题
500
500
  </Radio>
501
- <Radio value={2} extra="Semi Design" style={{ width: 280 }}>
501
+ <Radio value={2} extra="disabled+unchecked" style={{ width: 280 }}>
502
502
  多选框标题
503
503
  </Radio>
504
- <Radio value={3} extra="Semi Design" style={{ width: 280 }}>
504
+ <Radio value={3} extra="disabled+unchecked" style={{ width: 280 }}>
505
505
  多选框标题
506
506
  </Radio>
507
507
  </RadioGroup>
@@ -678,10 +678,10 @@ export const RadioGroupPureCardStyle = () => (
678
678
  <br />
679
679
  <div>radio disabled</div>
680
680
  <RadioGroup type="pureCard" defaultValue={1}>
681
- <Radio value={1} disabled extra="Semi Design" style={{ width: 280 }}>
681
+ <Radio value={1} disabled extra="disabled+checked" style={{ width: 280 }}>
682
682
  多选框标题
683
683
  </Radio>
684
- <Radio value={2} extra="Semi Design" style={{ width: 280 }}>
684
+ <Radio value={2} disabled extra="disabled+unchecked" style={{ width: 280 }}>
685
685
  多选框标题
686
686
  </Radio>
687
687
  <Radio value={3} extra="Semi Design" style={{ width: 280 }}>
@@ -692,13 +692,13 @@ export const RadioGroupPureCardStyle = () => (
692
692
  <br />
693
693
  <div>radioGroup disabled</div>
694
694
  <RadioGroup type="pureCard" disabled defaultValue={1}>
695
- <Radio value={1} extra="Semi Design" style={{ width: 280 }}>
695
+ <Radio value={1} extra="disabled+checked" style={{ width: 280 }}>
696
696
  多选框标题
697
697
  </Radio>
698
- <Radio value={2} extra="Semi Design" style={{ width: 280 }}>
698
+ <Radio value={2} extra="disabled+unchecked" style={{ width: 280 }}>
699
699
  多选框标题
700
700
  </Radio>
701
- <Radio value={3} extra="Semi Design" style={{ width: 280 }}>
701
+ <Radio value={3} extra="disabled+unchecked" style={{ width: 280 }}>
702
702
  多选框标题
703
703
  </Radio>
704
704
  </RadioGroup>
package/radio/radio.tsx CHANGED
@@ -193,6 +193,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
193
193
  [`${prefix}-cardRadioGroup`]: isCardRadioGroup,
194
194
  [`${prefix}-cardRadioGroup_disabled`]: isDisabled && isCardRadioGroup,
195
195
  [`${prefix}-cardRadioGroup_checked`]: isCardRadioGroup && realChecked && !isDisabled,
196
+ [`${prefix}-cardRadioGroup_checked_disabled`]: isCardRadioGroup && realChecked && isDisabled,
196
197
  [`${prefix}-cardRadioGroup_hover`]: isCardRadioGroup && !realChecked && isHover && !isDisabled,
197
198
  [className]: Boolean(className),
198
199
  });
package/rating/item.tsx CHANGED
@@ -101,6 +101,7 @@ export default class Item extends PureComponent<RatingItemProps> {
101
101
  aria-posinset={index + 1}
102
102
  aria-setsize={count}
103
103
  tabIndex={0}
104
+ className={`${prefixCls}-wrapper`}
104
105
  >
105
106
  <div className={`${prefixCls}-first`} style={{ width: `${firstWidth * 100}%` }}>{content}</div>
106
107
  <div className={`${prefixCls}-second`}>{content}</div>
@@ -27,7 +27,7 @@ import {
27
27
  } from '@douyinfe/semi-foundation/tree/treeUtil';
28
28
  import { cssClasses, strings } from '@douyinfe/semi-foundation/treeSelect/constants';
29
29
  import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/popover/constants';
30
- import { FixedSizeList as VirtualList } from 'react-window';
30
+ import { FixedSizeList as VirtualList, ListItemKeySelector } from 'react-window';
31
31
  import '@douyinfe/semi-foundation/tree/tree.scss';
32
32
  import '@douyinfe/semi-foundation/treeSelect/treeSelect.scss';
33
33
  import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
@@ -1166,7 +1166,8 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
1166
1166
  itemSize={virtualize.itemSize}
1167
1167
  height={height}
1168
1168
  width={width}
1169
- itemKey={this.itemKey}
1169
+ // @ts-ignore avoid strict check of itemKey
1170
+ itemKey={this.itemKey as ListItemKeySelector<TreeNodeData>}
1170
1171
  itemData={flattenNodes as any}
1171
1172
  className={`${prefixTree}-virtual-list`}
1172
1173
  style={{ direction }}
package/tsconfig.json CHANGED
@@ -25,7 +25,8 @@
25
25
  "esModuleInterop": true,
26
26
  "skipLibCheck": true,
27
27
  "declaration": true,
28
- "strictNullChecks": false
28
+ "strictNullChecks": false,
29
+ "strict": true
29
30
  },
30
31
  "include": ["**/*.tsx", "**/*.ts"],
31
32
  "exclude": ["node_modules", "packages/rollup-plugin-semi-svg"]
package/upload/index.tsx CHANGED
@@ -193,7 +193,14 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
193
193
  this.replaceInputRef = React.createRef<HTMLInputElement>();
194
194
  }
195
195
 
196
- static getDerivedStateFromProps(props: UploadProps): Partial<UploadState> | null {
196
+ /**
197
+ * Notes:
198
+ * The input parameter and return value here do not declare the type, otherwise tsc may report an error in form/fields.tsx when wrap after withField
199
+ * `The types of the parameters "props" and "nextProps" are incompatible.
200
+ The attribute "action" is missing in the type "Readonly<any>", but it is required in the type "UploadProps".`
201
+ * which seems to be a bug, remove props type declare here
202
+ */
203
+ static getDerivedStateFromProps(props) {
197
204
  const { fileList } = props;
198
205
  if ('fileList' in props) {
199
206
  return {