@douyinfe/semi-ui 2.5.0 → 2.5.1
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/button/index.tsx +1 -1
- package/dist/css/semi.css +6 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +59 -56
- 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/__test__/formApi.test.js +182 -0
- package/form/_story/FormApi/arrayDemo.jsx +4 -7
- package/form/_story/Layout/slotDemo.jsx +2 -2
- package/form/_story/demo.jsx +18 -1
- package/form/_story/form.stories.js +6 -6
- package/form/baseForm.tsx +2 -2
- package/lib/cjs/button/Button.d.ts +4 -4
- package/lib/cjs/button/buttonGroup.d.ts +2 -2
- package/lib/cjs/button/index.d.ts +5 -6
- package/lib/cjs/form/baseForm.js +2 -2
- package/lib/cjs/iconButton/index.d.ts +2 -2
- package/lib/cjs/tooltip/index.js +6 -2
- package/lib/es/button/Button.d.ts +4 -4
- package/lib/es/button/buttonGroup.d.ts +2 -2
- package/lib/es/button/index.d.ts +5 -6
- package/lib/es/form/baseForm.js +2 -2
- package/lib/es/iconButton/index.d.ts +2 -2
- package/lib/es/tooltip/index.js +6 -2
- package/package.json +9 -9
- package/table/_story/Perf/Virtualized/index.jsx +6 -0
- package/table/_story/v2/FixedHeaderMerge/index.jsx +1 -1
- package/table/_story/v2/defaultFilteredValue.tsx +0 -9
- package/tooltip/_story/tooltip.stories.js +702 -625
- package/tooltip/index.tsx +2 -2
|
@@ -30,6 +30,11 @@ const fields = (
|
|
|
30
30
|
</>
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
+
const getDomValue = (field, form) => {
|
|
34
|
+
let inputDOM = form.find(`[x-field-id="${field}"] input`).getDOMNode();
|
|
35
|
+
return inputDOM.getAttribute("value");
|
|
36
|
+
};
|
|
37
|
+
|
|
33
38
|
describe('Form-formApi', () => {
|
|
34
39
|
beforeEach(() => {
|
|
35
40
|
document.body.innerHTML = '';
|
|
@@ -416,6 +421,183 @@ describe('Form-formApi', () => {
|
|
|
416
421
|
expect(formApi.getFormState().touched).toEqual({ a: { b: true, c: true }});
|
|
417
422
|
})
|
|
418
423
|
|
|
424
|
+
it('formApi-setValue, field path precise', () => {
|
|
425
|
+
// case like:
|
|
426
|
+
// Exist 3 Field: a.b、a.c、a.d
|
|
427
|
+
// formApi.setValue('a.b', '123');
|
|
428
|
+
let formApi = null;
|
|
429
|
+
const fields = (
|
|
430
|
+
<>
|
|
431
|
+
<Form.Input field='a.b' />
|
|
432
|
+
<Form.Input field='a.c' />
|
|
433
|
+
<Form.Input field='a.d' />
|
|
434
|
+
</>
|
|
435
|
+
);
|
|
436
|
+
const props = {
|
|
437
|
+
children: fields,
|
|
438
|
+
getFormApi: api => {
|
|
439
|
+
formApi = api;
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
const form = getForm(props);
|
|
443
|
+
formApi.setValue('a.c', 'semi');
|
|
444
|
+
// check formState.values
|
|
445
|
+
let val = formApi.getValue('a.c');
|
|
446
|
+
expect(val).toEqual('semi');
|
|
447
|
+
form.update();
|
|
448
|
+
// check dom render
|
|
449
|
+
expect(getDomValue('a.c', form)).toEqual('semi');
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it('formApi-setValue, field path belongs to parent aggregate', () => {
|
|
453
|
+
// case like:
|
|
454
|
+
// Exist 3 Field: a.b、a.c、a.d
|
|
455
|
+
// formApi.setValue('a', { b: 'semi', c: 'design' });
|
|
456
|
+
let formApi = null;
|
|
457
|
+
const fields = (
|
|
458
|
+
<>
|
|
459
|
+
<Form.Input field='a.b' />
|
|
460
|
+
<Form.Input field='a.c' />
|
|
461
|
+
<Form.Input field='a.d' />
|
|
462
|
+
</>
|
|
463
|
+
);
|
|
464
|
+
const props = {
|
|
465
|
+
children: fields,
|
|
466
|
+
getFormApi: api => {
|
|
467
|
+
formApi = api;
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
const form = getForm(props);
|
|
471
|
+
formApi.setValue('a', { b: 'semi', c: 'design' });
|
|
472
|
+
let acVal = formApi.getValue('a.c');
|
|
473
|
+
let abVal = formApi.getValue('a.b');
|
|
474
|
+
expect(abVal).toEqual('semi');
|
|
475
|
+
expect(acVal).toEqual('design');
|
|
476
|
+
form.update();
|
|
477
|
+
|
|
478
|
+
// check dom render
|
|
479
|
+
expect(getDomValue('a.b', form)).toEqual('semi');
|
|
480
|
+
expect(getDomValue('a.c', form)).toEqual('design');
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
it('formApi-setValue with array field path, 0 -> 3', () => {
|
|
484
|
+
|
|
485
|
+
const fields = ({ formState, values }) => {
|
|
486
|
+
|
|
487
|
+
return values.a && values.a.map((effect, i) => (
|
|
488
|
+
<div key={effect.key}>
|
|
489
|
+
<Form.Input field={`a[${i}].name`} />
|
|
490
|
+
<Form.Input field={`a[${i}].type`} />
|
|
491
|
+
</div>
|
|
492
|
+
));
|
|
493
|
+
};
|
|
494
|
+
let formApi = null;
|
|
495
|
+
const props = {
|
|
496
|
+
children: fields,
|
|
497
|
+
getFormApi: api => {
|
|
498
|
+
formApi = api;
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
const form = getForm(props);
|
|
502
|
+
let targetValue = [
|
|
503
|
+
{ name: '0-name', type: '0-type' },
|
|
504
|
+
{ name: '1-name', type: '1-type' },
|
|
505
|
+
{ name: '2-name', type: '2-type' },
|
|
506
|
+
];
|
|
507
|
+
formApi.setValue('a', targetValue);
|
|
508
|
+
let formStateValues = formApi.getValue();
|
|
509
|
+
form.update();
|
|
510
|
+
// check dom render
|
|
511
|
+
expect(getDomValue('a[0].name', form)).toEqual('0-name');
|
|
512
|
+
expect(getDomValue('a[0].type', form)).toEqual('0-type');
|
|
513
|
+
expect(getDomValue('a[1].name', form)).toEqual('1-name');
|
|
514
|
+
expect(getDomValue('a[1].type', form)).toEqual('1-type');
|
|
515
|
+
expect(getDomValue('a[2].name', form)).toEqual('2-name');
|
|
516
|
+
expect(getDomValue('a[2].type', form)).toEqual('2-type');
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
// // this case result was different in cypress / jest, jest result is wrong
|
|
520
|
+
// it('formApi-setValue with array field path, 3 -> 2, delete some field', done => {
|
|
521
|
+
// const fields = ({ formState, values }) => {
|
|
522
|
+
// return values.a && values.a.map((item, i) => (
|
|
523
|
+
// <div key={item.key} style={{ width: 300 }}>
|
|
524
|
+
// <Form.Input field={`a[${i}].name`} />
|
|
525
|
+
// <Form.Input field={`a[${i}].type`} />
|
|
526
|
+
// </div>
|
|
527
|
+
// ));
|
|
528
|
+
// };
|
|
529
|
+
// let formApi = null;
|
|
530
|
+
// const props = {
|
|
531
|
+
// children: fields,
|
|
532
|
+
// initValues: {
|
|
533
|
+
// a: [
|
|
534
|
+
// { name: '0-name', type: '0-type', key: 0 },
|
|
535
|
+
// { name: '1-name', type: '1-type', key: 1 },
|
|
536
|
+
// { name: '2-name', type: '2-type', key: 2 },
|
|
537
|
+
// ]
|
|
538
|
+
// },
|
|
539
|
+
// getFormApi: api => {
|
|
540
|
+
// formApi = api;
|
|
541
|
+
// },
|
|
542
|
+
// };
|
|
543
|
+
// let form = getForm(props);
|
|
544
|
+
// // remove middle one
|
|
545
|
+
// formApi.setValue('a', [
|
|
546
|
+
// { name: '0-name', type: '0-type', key: 0 },
|
|
547
|
+
// { name: '2-name', type: '2-type', key: 2 },
|
|
548
|
+
// ]);
|
|
549
|
+
// let formStateValues = formApi.getValue();
|
|
550
|
+
// form.update();
|
|
551
|
+
|
|
552
|
+
// setTimeout(() => {
|
|
553
|
+
// // check dom render
|
|
554
|
+
// expect(getDomValue('a[0].name', form)).toEqual('0-name');
|
|
555
|
+
// expect(getDomValue('a[0].type', form)).toEqual('0-type');
|
|
556
|
+
// expect(getDomValue('a[1].name', form)).toEqual('2-name');
|
|
557
|
+
// expect(getDomValue('a[1].type', form)).toEqual('2-type');
|
|
558
|
+
|
|
559
|
+
// expect(form.exists(`[x-field-id="a[2].name"] input`)).toEqual(false);
|
|
560
|
+
// expect(form.exists(`[x-field-id="a[2].type"] input`)).toEqual(false);
|
|
561
|
+
// done();
|
|
562
|
+
// }, 5000);
|
|
563
|
+
// });
|
|
564
|
+
|
|
565
|
+
it('formApi-setValue with array field path, 1 -> 3, add some field', () => {
|
|
566
|
+
const fields = ({ formState, values }) => {
|
|
567
|
+
return values.a && values.a.map((effect, i) => (
|
|
568
|
+
<div key={effect.key}>
|
|
569
|
+
<Form.Input field={`a[${i}].name`} />
|
|
570
|
+
<Form.Input field={`a[${i}].type`} />
|
|
571
|
+
</div>
|
|
572
|
+
));
|
|
573
|
+
};
|
|
574
|
+
let formApi = null;
|
|
575
|
+
const props = {
|
|
576
|
+
children: fields,
|
|
577
|
+
initValues: {
|
|
578
|
+
a: [{ name: 'semi', type: 'design' }]
|
|
579
|
+
},
|
|
580
|
+
getFormApi: api => {
|
|
581
|
+
formApi = api;
|
|
582
|
+
},
|
|
583
|
+
};
|
|
584
|
+
let form = getForm(props);
|
|
585
|
+
formApi.setValue('a', [
|
|
586
|
+
{ name: '0-name', type: '0-type' },
|
|
587
|
+
{ name: '1-name', type: '1-type' },
|
|
588
|
+
{ name: '2-name', type: '2-type' },
|
|
589
|
+
]);
|
|
590
|
+
let formStateValues = formApi.getValue();
|
|
591
|
+
form.update();
|
|
592
|
+
// check dom render
|
|
593
|
+
expect(getDomValue('a[0].name', form)).toEqual('0-name');
|
|
594
|
+
expect(getDomValue('a[0].type', form)).toEqual('0-type');
|
|
595
|
+
expect(getDomValue('a[1].name', form)).toEqual('1-name');
|
|
596
|
+
expect(getDomValue('a[1].type', form)).toEqual('1-type');
|
|
597
|
+
expect(getDomValue('a[2].name', form)).toEqual('2-name');
|
|
598
|
+
expect(getDomValue('a[2].type', form)).toEqual('2-type');
|
|
599
|
+
});
|
|
600
|
+
|
|
419
601
|
// it('formApi-submitForm', () => {
|
|
420
602
|
// // submit should call validate first
|
|
421
603
|
// });
|
|
@@ -24,9 +24,9 @@ class ArrayDemo extends React.Component {
|
|
|
24
24
|
this.state = {
|
|
25
25
|
initValues: {
|
|
26
26
|
effects: [
|
|
27
|
-
{ name: '
|
|
28
|
-
{ name: '
|
|
29
|
-
{ name: '
|
|
27
|
+
{ name: '1-name', type: '1-type', key: 0 },
|
|
28
|
+
{ name: '2-name', type: '2-type', key: 1 },
|
|
29
|
+
{ name: '3-name', type: '3-type', key: 2 },
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
32
|
};
|
|
@@ -59,10 +59,7 @@ class ArrayDemo extends React.Component {
|
|
|
59
59
|
return values.effects && values.effects.map((effect, i) => (
|
|
60
60
|
<div key={effect.key} style={{ width: 1000, display: 'flex' }}>
|
|
61
61
|
<Form.Input field={`effects[${i}].name`} style={{ width: 200, marginRight: 16 }} />
|
|
62
|
-
<Form.
|
|
63
|
-
<Form.Select.Option value="2D">2D</Form.Select.Option>
|
|
64
|
-
<Form.Select.Option value="3D">3D</Form.Select.Option>
|
|
65
|
-
</Form.Select>
|
|
62
|
+
<Form.Input field={`effects[${i}].type`} style={{ width: 90 }} />
|
|
66
63
|
<Button type="danger" onClick={() => this.remove(effect.key)} style={{ margin: 16 }}>Remove</Button>
|
|
67
64
|
</div>
|
|
68
65
|
));
|
|
@@ -98,7 +98,7 @@ class AssistComponent extends React.Component {
|
|
|
98
98
|
我是Semi Form SlotB, 我的Label Align、Width与众不同
|
|
99
99
|
</div>
|
|
100
100
|
</Form.Slot>
|
|
101
|
-
</Form
|
|
101
|
+
</Form>
|
|
102
102
|
<Form.Slot
|
|
103
103
|
label={{
|
|
104
104
|
text: 'SlotB',
|
|
@@ -117,7 +117,7 @@ class AssistComponent extends React.Component {
|
|
|
117
117
|
>
|
|
118
118
|
我是Slot,我并没有被Form包裹,我是单独使用的
|
|
119
119
|
</div>
|
|
120
|
-
</Form.Slot
|
|
120
|
+
</Form.Slot>
|
|
121
121
|
</>
|
|
122
122
|
);
|
|
123
123
|
}
|
package/form/_story/demo.jsx
CHANGED
|
@@ -195,7 +195,7 @@ class BasicDemoWithInit extends Component {
|
|
|
195
195
|
initValues={formInitValue}
|
|
196
196
|
onReset={this.handleReset}
|
|
197
197
|
onValueChange={(v)=>console.log(v)}
|
|
198
|
-
style={{ padding: '10px', width:
|
|
198
|
+
style={{ padding: '10px', width: 900 }}
|
|
199
199
|
autoScrollToError
|
|
200
200
|
aria-label='Demo Form'
|
|
201
201
|
id='demo-form-id'
|
|
@@ -341,6 +341,23 @@ class BasicDemoWithInit extends Component {
|
|
|
341
341
|
<Form.Switch field='switch' label='开关(Switch)'/>
|
|
342
342
|
</Col>
|
|
343
343
|
</Row>
|
|
344
|
+
<Form.CheckboxGroup field="cardCheckbox" label='卡片选择' style={{ width: '90%' }} type='card' initValue={['1', '3']} direction={'horizontal'} aria-label="CheckboxGroup 示例">
|
|
345
|
+
<Form.Checkbox value={'1'} disabled extra='Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统' style={{width:280}}>
|
|
346
|
+
单选框标题
|
|
347
|
+
</Form.Checkbox>
|
|
348
|
+
<Form.Checkbox value={'2'} disabled extra='Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统' style={{width:280}}>
|
|
349
|
+
单选框标题
|
|
350
|
+
</Form.Checkbox>
|
|
351
|
+
</Form.CheckboxGroup>
|
|
352
|
+
<Row>
|
|
353
|
+
<Col span={12}>
|
|
354
|
+
<Form.RadioGroup field='buttonRadio' type='button' buttonSize='middle' defaultValue={1} aria-label="单选组合示例">
|
|
355
|
+
<Radio value={1}>即时推送</Radio>
|
|
356
|
+
<Radio value={2}>定时推送</Radio>
|
|
357
|
+
<Radio value={3}>动态推送</Radio>
|
|
358
|
+
</Form.RadioGroup>
|
|
359
|
+
</Col>
|
|
360
|
+
</Row>
|
|
344
361
|
</Form.Section>
|
|
345
362
|
<Form.Checkbox value="false" field="agree" useOutSideGroup={true} noLabel={true}>
|
|
346
363
|
我已阅读并清楚相关规定
|
|
@@ -158,6 +158,12 @@ FormApiSetValueUsingFieldParentPath.story = {
|
|
|
158
158
|
name: 'formApi-setValue using field parent path',
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
+
export const UseFormApiSetValueUpdateArray = () => <ArrayDemo />;
|
|
162
|
+
|
|
163
|
+
UseFormApiSetValueUpdateArray.story = {
|
|
164
|
+
name: 'formApi-setValue set array',
|
|
165
|
+
};
|
|
166
|
+
|
|
161
167
|
export const DynamicAddRemoveField = () => (
|
|
162
168
|
<Form>
|
|
163
169
|
{({ formState }) => (
|
|
@@ -209,12 +215,6 @@ _ArrayFieldCollapseDemo.story = {
|
|
|
209
215
|
name: 'ArrayField-CollapseDemo',
|
|
210
216
|
};
|
|
211
217
|
|
|
212
|
-
export const ArrayFieldDynamicUpdate = () => <ArrayDemo />;
|
|
213
|
-
|
|
214
|
-
ArrayFieldDynamicUpdate.story = {
|
|
215
|
-
name: 'ArrayField-dynamic update',
|
|
216
|
-
};
|
|
217
|
-
|
|
218
218
|
export const LinkField = () => <LinkFieldForm />;
|
|
219
219
|
|
|
220
220
|
LinkField.story = {
|
package/form/baseForm.tsx
CHANGED
|
@@ -160,8 +160,8 @@ class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
160
160
|
notifySubmitFail: (errors: ErrorMsg, values: any) => {
|
|
161
161
|
this.props.onSubmitFail(errors, values);
|
|
162
162
|
},
|
|
163
|
-
forceUpdate: () => {
|
|
164
|
-
this.forceUpdate();
|
|
163
|
+
forceUpdate: (callback?: () => void) => {
|
|
164
|
+
this.forceUpdate(callback);
|
|
165
165
|
},
|
|
166
166
|
notifyChange: (formState: FormState) => {
|
|
167
167
|
this.props.onChange(formState);
|
|
@@ -46,15 +46,15 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
46
46
|
disabled: PropTypes.Requireable<boolean>;
|
|
47
47
|
prefixCls: PropTypes.Requireable<string>;
|
|
48
48
|
style: PropTypes.Requireable<object>;
|
|
49
|
-
size: PropTypes.Requireable<
|
|
50
|
-
type: PropTypes.Requireable<
|
|
49
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
50
|
+
type: PropTypes.Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
|
|
51
51
|
block: PropTypes.Requireable<boolean>;
|
|
52
52
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
53
|
onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
54
|
circle: PropTypes.Requireable<boolean>;
|
|
55
55
|
loading: PropTypes.Requireable<boolean>;
|
|
56
|
-
htmlType: PropTypes.Requireable<
|
|
57
|
-
theme: PropTypes.Requireable<
|
|
56
|
+
htmlType: PropTypes.Requireable<"button" | "reset" | "submit">;
|
|
57
|
+
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
58
58
|
className: PropTypes.Requireable<string>;
|
|
59
59
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
60
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -16,8 +16,8 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
16
16
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
17
17
|
disabled: PropTypes.Requireable<boolean>;
|
|
18
18
|
type: PropTypes.Requireable<string>;
|
|
19
|
-
size: PropTypes.Requireable<
|
|
20
|
-
theme: PropTypes.Requireable<
|
|
19
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
20
|
+
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
21
21
|
'aria-label': PropTypes.Requireable<string>;
|
|
22
22
|
};
|
|
23
23
|
static defaultProps: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonProps as BaseButtonProps } from './Button';
|
|
3
2
|
import { IconButtonProps } from '../iconButton';
|
|
4
3
|
export { ButtonProps as BaseButtonProps, HtmlType, Size, Theme, Type } from './Button';
|
|
5
4
|
export { HorizontalPaddingType } from '../iconButton';
|
|
6
5
|
export { ButtonGroupProps } from './buttonGroup';
|
|
7
6
|
export { SplitButtonGroupProps } from './splitButtonGroup';
|
|
8
|
-
export interface ButtonProps extends IconButtonProps
|
|
7
|
+
export interface ButtonProps extends IconButtonProps {
|
|
9
8
|
}
|
|
10
9
|
declare class Button extends React.PureComponent<ButtonProps> {
|
|
11
10
|
static propTypes: {
|
|
@@ -18,18 +17,18 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
18
17
|
noHorizontalPadding: import("prop-types").Requireable<string | boolean | any[]>;
|
|
19
18
|
children: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
20
19
|
theme: import("prop-types").Requireable<string>;
|
|
21
|
-
iconPosition: import("prop-types").Requireable<
|
|
20
|
+
iconPosition: import("prop-types").Requireable<"left" | "right">;
|
|
22
21
|
className: import("prop-types").Requireable<string>;
|
|
23
22
|
onMouseEnter: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
24
23
|
onMouseLeave: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
25
24
|
disabled: import("prop-types").Requireable<boolean>;
|
|
26
|
-
size: import("prop-types").Requireable<
|
|
27
|
-
type: import("prop-types").Requireable<
|
|
25
|
+
size: import("prop-types").Requireable<"default" | "small" | "large">;
|
|
26
|
+
type: import("prop-types").Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
|
|
28
27
|
block: import("prop-types").Requireable<boolean>;
|
|
29
28
|
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
30
29
|
onMouseDown: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
31
30
|
circle: import("prop-types").Requireable<boolean>;
|
|
32
|
-
htmlType: import("prop-types").Requireable<
|
|
31
|
+
htmlType: import("prop-types").Requireable<"button" | "reset" | "submit">;
|
|
33
32
|
'aria-label': import("prop-types").Requireable<string>;
|
|
34
33
|
};
|
|
35
34
|
constructor(props?: {});
|
package/lib/cjs/form/baseForm.js
CHANGED
|
@@ -115,8 +115,8 @@ class Form extends _baseComponent.default {
|
|
|
115
115
|
notifySubmitFail: (errors, values) => {
|
|
116
116
|
this.props.onSubmitFail(errors, values);
|
|
117
117
|
},
|
|
118
|
-
forceUpdate:
|
|
119
|
-
this.forceUpdate();
|
|
118
|
+
forceUpdate: callback => {
|
|
119
|
+
this.forceUpdate(callback);
|
|
120
120
|
},
|
|
121
121
|
notifyChange: formState => {
|
|
122
122
|
this.props.onChange(formState);
|
|
@@ -19,7 +19,7 @@ export interface IconButtonProps extends ButtonProps {
|
|
|
19
19
|
}
|
|
20
20
|
declare class IconButton extends PureComponent<IconButtonProps> {
|
|
21
21
|
static defaultProps: {
|
|
22
|
-
iconPosition:
|
|
22
|
+
iconPosition: "left";
|
|
23
23
|
prefixCls: string;
|
|
24
24
|
loading: boolean;
|
|
25
25
|
noHorizontalPadding: boolean;
|
|
@@ -36,7 +36,7 @@ declare class IconButton extends PureComponent<IconButtonProps> {
|
|
|
36
36
|
noHorizontalPadding: PropTypes.Requireable<string | boolean | any[]>;
|
|
37
37
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
38
38
|
theme: PropTypes.Requireable<string>;
|
|
39
|
-
iconPosition: PropTypes.Requireable<
|
|
39
|
+
iconPosition: PropTypes.Requireable<"left" | "right">;
|
|
40
40
|
className: PropTypes.Requireable<string>;
|
|
41
41
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
42
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
package/lib/cjs/tooltip/index.js
CHANGED
|
@@ -229,7 +229,9 @@ class Tooltip extends _baseComponent.default {
|
|
|
229
229
|
} = _ref;
|
|
230
230
|
return /*#__PURE__*/_react.default.createElement("div", (0, _assign.default)({
|
|
231
231
|
className: (0, _classnames.default)(className, animateCls),
|
|
232
|
-
style: (0, _assign.default)((0, _assign.default)((0, _assign.default)({
|
|
232
|
+
style: (0, _assign.default)((0, _assign.default)((0, _assign.default)({
|
|
233
|
+
visibility: 'visible'
|
|
234
|
+
}, animateStyle), {
|
|
233
235
|
transformOrigin
|
|
234
236
|
}), style)
|
|
235
237
|
}, portalEventSet, animateEvents, {
|
|
@@ -241,7 +243,9 @@ class Tooltip extends _baseComponent.default {
|
|
|
241
243
|
className: className
|
|
242
244
|
}, portalEventSet, {
|
|
243
245
|
"x-placement": placement,
|
|
244
|
-
style:
|
|
246
|
+
style: (0, _assign.default)({
|
|
247
|
+
visibility: motion ? undefined : 'visible'
|
|
248
|
+
}, style)
|
|
245
249
|
}), content, icon);
|
|
246
250
|
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
247
251
|
getPopupContainer: this.props.getPopupContainer,
|
|
@@ -46,15 +46,15 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
46
46
|
disabled: PropTypes.Requireable<boolean>;
|
|
47
47
|
prefixCls: PropTypes.Requireable<string>;
|
|
48
48
|
style: PropTypes.Requireable<object>;
|
|
49
|
-
size: PropTypes.Requireable<
|
|
50
|
-
type: PropTypes.Requireable<
|
|
49
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
50
|
+
type: PropTypes.Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
|
|
51
51
|
block: PropTypes.Requireable<boolean>;
|
|
52
52
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
53
|
onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
54
|
circle: PropTypes.Requireable<boolean>;
|
|
55
55
|
loading: PropTypes.Requireable<boolean>;
|
|
56
|
-
htmlType: PropTypes.Requireable<
|
|
57
|
-
theme: PropTypes.Requireable<
|
|
56
|
+
htmlType: PropTypes.Requireable<"button" | "reset" | "submit">;
|
|
57
|
+
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
58
58
|
className: PropTypes.Requireable<string>;
|
|
59
59
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
60
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -16,8 +16,8 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
16
16
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
17
17
|
disabled: PropTypes.Requireable<boolean>;
|
|
18
18
|
type: PropTypes.Requireable<string>;
|
|
19
|
-
size: PropTypes.Requireable<
|
|
20
|
-
theme: PropTypes.Requireable<
|
|
19
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
20
|
+
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
21
21
|
'aria-label': PropTypes.Requireable<string>;
|
|
22
22
|
};
|
|
23
23
|
static defaultProps: {
|
package/lib/es/button/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonProps as BaseButtonProps } from './Button';
|
|
3
2
|
import { IconButtonProps } from '../iconButton';
|
|
4
3
|
export { ButtonProps as BaseButtonProps, HtmlType, Size, Theme, Type } from './Button';
|
|
5
4
|
export { HorizontalPaddingType } from '../iconButton';
|
|
6
5
|
export { ButtonGroupProps } from './buttonGroup';
|
|
7
6
|
export { SplitButtonGroupProps } from './splitButtonGroup';
|
|
8
|
-
export interface ButtonProps extends IconButtonProps
|
|
7
|
+
export interface ButtonProps extends IconButtonProps {
|
|
9
8
|
}
|
|
10
9
|
declare class Button extends React.PureComponent<ButtonProps> {
|
|
11
10
|
static propTypes: {
|
|
@@ -18,18 +17,18 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
18
17
|
noHorizontalPadding: import("prop-types").Requireable<string | boolean | any[]>;
|
|
19
18
|
children: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
20
19
|
theme: import("prop-types").Requireable<string>;
|
|
21
|
-
iconPosition: import("prop-types").Requireable<
|
|
20
|
+
iconPosition: import("prop-types").Requireable<"left" | "right">;
|
|
22
21
|
className: import("prop-types").Requireable<string>;
|
|
23
22
|
onMouseEnter: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
24
23
|
onMouseLeave: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
25
24
|
disabled: import("prop-types").Requireable<boolean>;
|
|
26
|
-
size: import("prop-types").Requireable<
|
|
27
|
-
type: import("prop-types").Requireable<
|
|
25
|
+
size: import("prop-types").Requireable<"default" | "small" | "large">;
|
|
26
|
+
type: import("prop-types").Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
|
|
28
27
|
block: import("prop-types").Requireable<boolean>;
|
|
29
28
|
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
30
29
|
onMouseDown: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
31
30
|
circle: import("prop-types").Requireable<boolean>;
|
|
32
|
-
htmlType: import("prop-types").Requireable<
|
|
31
|
+
htmlType: import("prop-types").Requireable<"button" | "reset" | "submit">;
|
|
33
32
|
'aria-label': import("prop-types").Requireable<string>;
|
|
34
33
|
};
|
|
35
34
|
constructor(props?: {});
|
package/lib/es/form/baseForm.js
CHANGED
|
@@ -77,8 +77,8 @@ class Form extends BaseComponent {
|
|
|
77
77
|
notifySubmitFail: (errors, values) => {
|
|
78
78
|
this.props.onSubmitFail(errors, values);
|
|
79
79
|
},
|
|
80
|
-
forceUpdate:
|
|
81
|
-
this.forceUpdate();
|
|
80
|
+
forceUpdate: callback => {
|
|
81
|
+
this.forceUpdate(callback);
|
|
82
82
|
},
|
|
83
83
|
notifyChange: formState => {
|
|
84
84
|
this.props.onChange(formState);
|
|
@@ -19,7 +19,7 @@ export interface IconButtonProps extends ButtonProps {
|
|
|
19
19
|
}
|
|
20
20
|
declare class IconButton extends PureComponent<IconButtonProps> {
|
|
21
21
|
static defaultProps: {
|
|
22
|
-
iconPosition:
|
|
22
|
+
iconPosition: "left";
|
|
23
23
|
prefixCls: string;
|
|
24
24
|
loading: boolean;
|
|
25
25
|
noHorizontalPadding: boolean;
|
|
@@ -36,7 +36,7 @@ declare class IconButton extends PureComponent<IconButtonProps> {
|
|
|
36
36
|
noHorizontalPadding: PropTypes.Requireable<string | boolean | any[]>;
|
|
37
37
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
38
38
|
theme: PropTypes.Requireable<string>;
|
|
39
|
-
iconPosition: PropTypes.Requireable<
|
|
39
|
+
iconPosition: PropTypes.Requireable<"left" | "right">;
|
|
40
40
|
className: PropTypes.Requireable<string>;
|
|
41
41
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
42
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -184,7 +184,9 @@ export default class Tooltip extends BaseComponent {
|
|
|
184
184
|
} = _ref;
|
|
185
185
|
return /*#__PURE__*/React.createElement("div", _Object$assign({
|
|
186
186
|
className: classNames(className, animateCls),
|
|
187
|
-
style: _Object$assign(_Object$assign(_Object$assign({
|
|
187
|
+
style: _Object$assign(_Object$assign(_Object$assign({
|
|
188
|
+
visibility: 'visible'
|
|
189
|
+
}, animateStyle), {
|
|
188
190
|
transformOrigin
|
|
189
191
|
}), style)
|
|
190
192
|
}, portalEventSet, animateEvents, {
|
|
@@ -196,7 +198,9 @@ export default class Tooltip extends BaseComponent {
|
|
|
196
198
|
className: className
|
|
197
199
|
}, portalEventSet, {
|
|
198
200
|
"x-placement": placement,
|
|
199
|
-
style:
|
|
201
|
+
style: _Object$assign({
|
|
202
|
+
visibility: motion ? undefined : 'visible'
|
|
203
|
+
}, style)
|
|
200
204
|
}), content, icon);
|
|
201
205
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
202
206
|
getPopupContainer: this.props.getPopupContainer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation": "2.5.
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.5.
|
|
19
|
-
"@douyinfe/semi-foundation": "2.5.
|
|
20
|
-
"@douyinfe/semi-icons": "2.5.
|
|
21
|
-
"@douyinfe/semi-illustrations": "2.5.
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.5.
|
|
17
|
+
"@douyinfe/semi-animation": "2.5.1",
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.5.1",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.5.1",
|
|
20
|
+
"@douyinfe/semi-icons": "2.5.1",
|
|
21
|
+
"@douyinfe/semi-illustrations": "2.5.1",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.5.1",
|
|
23
23
|
"@types/react-window": "^1.8.2",
|
|
24
24
|
"async-validator": "^3.5.0",
|
|
25
25
|
"classnames": "^2.2.6",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "3f83639f8a4fff7f912a237bf2842cb0944d993c",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
76
76
|
"@babel/preset-env": "^7.15.8",
|
|
77
77
|
"@babel/preset-react": "^7.14.5",
|
|
78
|
-
"@douyinfe/semi-scss-compile": "2.5.
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.5.1",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@types/lodash": "^4.14.176",
|
|
81
81
|
"babel-loader": "^8.2.2",
|
|
@@ -9,29 +9,35 @@ class PerfVirtualized extends React.Component {
|
|
|
9
9
|
{
|
|
10
10
|
title: 'A',
|
|
11
11
|
dataIndex: 'key',
|
|
12
|
+
key: 'a',
|
|
12
13
|
width: 150,
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
title: 'B',
|
|
16
17
|
dataIndex: 'key',
|
|
18
|
+
key: 'b',
|
|
17
19
|
},
|
|
18
20
|
{
|
|
19
21
|
title: 'C',
|
|
20
22
|
dataIndex: 'key',
|
|
23
|
+
key: 'c',
|
|
21
24
|
},
|
|
22
25
|
{
|
|
23
26
|
title: 'D',
|
|
24
27
|
dataIndex: 'key',
|
|
28
|
+
key: 'd',
|
|
25
29
|
},
|
|
26
30
|
{
|
|
27
31
|
title: 'E',
|
|
28
32
|
dataIndex: 'key',
|
|
29
33
|
width: 200,
|
|
34
|
+
key: 'e',
|
|
30
35
|
},
|
|
31
36
|
{
|
|
32
37
|
title: 'F',
|
|
33
38
|
dataIndex: 'key',
|
|
34
39
|
width: 100,
|
|
40
|
+
key: 'f'
|
|
35
41
|
},
|
|
36
42
|
];
|
|
37
43
|
|
|
@@ -45,7 +45,7 @@ export default function Demo() {
|
|
|
45
45
|
const data = useMemo(() => {
|
|
46
46
|
const data = [];
|
|
47
47
|
for (let i = 0; i < 100; i++) {
|
|
48
|
-
let age =
|
|
48
|
+
let age = (i * 1000) % 149;
|
|
49
49
|
let name = `Edward King ${i}`;
|
|
50
50
|
data.push({
|
|
51
51
|
key: '' + i,
|