@douyinfe/semi-ui 2.1.5 → 2.1.6-alpha.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 +3 -1
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +267 -266
- 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/_story/form.stories.js +0 -67
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/pagination/index.js +9 -4
- package/lib/cjs/select/index.js +3 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/pagination/index.js +8 -4
- package/lib/es/select/index.js +3 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/navigation/__test__/navigation.test.js +4 -4
- package/navigation/_story/AutoOpen/index.js +1 -1
- package/navigation/_story/WithChildren/index.js +1 -1
- package/navigation/_story/navigation.stories.js +1 -1
- package/navigation/_story/navigation.stories.tsx +4 -4
- package/package.json +13 -5
- package/pagination/_story/pagination.stories.js +11 -0
- package/pagination/index.tsx +9 -4
- package/select/_story/select.stories.js +14 -14
- package/select/index.tsx +1 -1
- package/table/_story/DynamicFilters/index.js +13 -16
- package/timeline/_story/timeline.stories.js +20 -6
- package/tooltip/_story/tooltip.stories.js +1 -1
|
@@ -432,73 +432,6 @@ FieldDisplayName.story = {
|
|
|
432
432
|
name: 'Field displayName',
|
|
433
433
|
};
|
|
434
434
|
|
|
435
|
-
class ReUseDemo extends React.Component {
|
|
436
|
-
constructor() {
|
|
437
|
-
super();
|
|
438
|
-
this.getFormApi = this.getFormApi.bind(this);
|
|
439
|
-
this.suppressRankOptions = [
|
|
440
|
-
{ label: '不打压', value: 0 },
|
|
441
|
-
{ label: 'top10以下', value: 10 },
|
|
442
|
-
{ label: 'top30以下', value: 30 },
|
|
443
|
-
];
|
|
444
|
-
this.citySuppressRankOptions = [
|
|
445
|
-
{ label: '不打压', value: 0 },
|
|
446
|
-
{ label: 'top3以下', value: 3 },
|
|
447
|
-
{ label: 'top5以下', value: 5 },
|
|
448
|
-
{ label: 'top10以下', value: 10 },
|
|
449
|
-
];
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
getFormApi(formApi) {
|
|
453
|
-
this.formApi = formApi;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
render() {
|
|
457
|
-
return (
|
|
458
|
-
<Form
|
|
459
|
-
getFormApi={this.getFormApi}
|
|
460
|
-
initValues={{ listType: 'online', attr: { suppress_rank: 0, city_suppress_rank: 5 } }}
|
|
461
|
-
onValueChange={values => console.log(values)}
|
|
462
|
-
style={{ width: 250 }}
|
|
463
|
-
>
|
|
464
|
-
{({ formState }) => (
|
|
465
|
-
<>
|
|
466
|
-
<Form.Select
|
|
467
|
-
field="listType"
|
|
468
|
-
label="榜单类型"
|
|
469
|
-
disabled={this.ifUseOld}
|
|
470
|
-
style={{ width: '100%' }}
|
|
471
|
-
// onChange={val => this.onChangeListType(val)}
|
|
472
|
-
>
|
|
473
|
-
<Option value="online">热点榜</Option>
|
|
474
|
-
<Option value="riseHot">上升热点榜</Option>
|
|
475
|
-
<Option value="sameCity">同城热点榜</Option>
|
|
476
|
-
</Form.Select>
|
|
477
|
-
{formState.values.listType !== 'sameCity' ? (
|
|
478
|
-
<Form.Select
|
|
479
|
-
label="竞品打压类型"
|
|
480
|
-
field="attr.suppress_rank"
|
|
481
|
-
optionList={this.suppressRankOptions}
|
|
482
|
-
/>
|
|
483
|
-
) : (
|
|
484
|
-
<Form.Select
|
|
485
|
-
label="同城竞品打压"
|
|
486
|
-
field="attr.city_suppress_rank"
|
|
487
|
-
optionList={this.citySuppressRankOptions}
|
|
488
|
-
/>
|
|
489
|
-
)}
|
|
490
|
-
</>
|
|
491
|
-
)}
|
|
492
|
-
</Form>
|
|
493
|
-
);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
export const SameFieldSwitchCauseReuse = () => <ReUseDemo />;
|
|
497
|
-
|
|
498
|
-
SameFieldSwitchCauseReuse.story = {
|
|
499
|
-
name: 'same field switch cause reuse',
|
|
500
|
-
};
|
|
501
|
-
|
|
502
435
|
export const _ChildDidMount = () => <ChildDidMount />;
|
|
503
436
|
|
|
504
437
|
_ChildDidMount.story = {
|
|
@@ -111,7 +111,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
111
111
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
112
112
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
113
113
|
children?: React.ReactNode;
|
|
114
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
114
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
115
115
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
116
116
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
117
117
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
61
61
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
62
62
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
63
63
|
children?: import("react").ReactNode;
|
|
64
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
64
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
65
65
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
66
66
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
67
67
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
@@ -40,6 +40,8 @@ var _constants2 = require("@douyinfe/semi-foundation/lib/cjs/popover/constants")
|
|
|
40
40
|
|
|
41
41
|
var _semiIcons = require("@douyinfe/semi-icons");
|
|
42
42
|
|
|
43
|
+
var _warning = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/warning"));
|
|
44
|
+
|
|
43
45
|
var _context7 = _interopRequireDefault(require("../configProvider/context"));
|
|
44
46
|
|
|
45
47
|
var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
|
|
@@ -78,6 +80,7 @@ class Pagination extends _baseComponent.default {
|
|
|
78
80
|
this.foundation = new _foundation.default(this.adapter);
|
|
79
81
|
this.renderDefaultPage = (0, _bind.default)(_context = this.renderDefaultPage).call(_context, this);
|
|
80
82
|
this.renderSmallPage = (0, _bind.default)(_context2 = this.renderSmallPage).call(_context2, this);
|
|
83
|
+
(0, _warning.default)(Boolean(props.showSizeChanger && props.hideOnSinglePage), '[Semi Pagination] You should not use showSizeChanger and hideOnSinglePage in ths same time. At this time, hideOnSinglePage no longer takes effect, otherwise there may be a problem that the switch entry disappears');
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
get adapter() {
|
|
@@ -370,7 +373,8 @@ class Pagination extends _baseComponent.default {
|
|
|
370
373
|
className,
|
|
371
374
|
style,
|
|
372
375
|
hideOnSinglePage,
|
|
373
|
-
hoverShowPageSelect
|
|
376
|
+
hoverShowPageSelect,
|
|
377
|
+
showSizeChanger
|
|
374
378
|
} = this.props;
|
|
375
379
|
const paginationCls = (0, _classnames.default)("".concat(prefixCls, "-small"), prefixCls, className);
|
|
376
380
|
const {
|
|
@@ -380,7 +384,7 @@ class Pagination extends _baseComponent.default {
|
|
|
380
384
|
} = this.state;
|
|
381
385
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
382
386
|
|
|
383
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
387
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
384
388
|
return null;
|
|
385
389
|
}
|
|
386
390
|
|
|
@@ -410,13 +414,14 @@ class Pagination extends _baseComponent.default {
|
|
|
410
414
|
showTotal,
|
|
411
415
|
className,
|
|
412
416
|
style,
|
|
413
|
-
hideOnSinglePage
|
|
417
|
+
hideOnSinglePage,
|
|
418
|
+
showSizeChanger
|
|
414
419
|
} = this.props;
|
|
415
420
|
const paginationCls = (0, _classnames.default)(className, "".concat(prefixCls));
|
|
416
421
|
const showTotalCls = "".concat(prefixCls, "-total");
|
|
417
422
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
418
423
|
|
|
419
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
424
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
420
425
|
return null;
|
|
421
426
|
}
|
|
422
427
|
|
package/lib/cjs/select/index.js
CHANGED
|
@@ -762,7 +762,9 @@ class Select extends _baseComponent.default {
|
|
|
762
762
|
key: value
|
|
763
763
|
}), content);
|
|
764
764
|
} else {
|
|
765
|
-
return
|
|
765
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
766
|
+
key: value
|
|
767
|
+
}, content);
|
|
766
768
|
}
|
|
767
769
|
});
|
|
768
770
|
const contentWrapperCls = (0, _classnames.default)({
|
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<
|
|
40
|
+
heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|
|
@@ -111,7 +111,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
111
111
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
112
112
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
113
113
|
children?: React.ReactNode;
|
|
114
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
114
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
115
115
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
116
116
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
117
117
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
61
61
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
62
62
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
63
63
|
children?: import("react").ReactNode;
|
|
64
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
64
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
65
65
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
66
66
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
67
67
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
@@ -15,6 +15,7 @@ import { cssClasses, numbers } from '@douyinfe/semi-foundation/lib/es/pagination
|
|
|
15
15
|
import '@douyinfe/semi-foundation/lib/es/pagination/pagination.css';
|
|
16
16
|
import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/lib/es/popover/constants';
|
|
17
17
|
import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons';
|
|
18
|
+
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
18
19
|
import ConfigContext from '../configProvider/context';
|
|
19
20
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
20
21
|
import Select from '../select/index';
|
|
@@ -45,6 +46,7 @@ export default class Pagination extends BaseComponent {
|
|
|
45
46
|
this.foundation = new PaginationFoundation(this.adapter);
|
|
46
47
|
this.renderDefaultPage = _bindInstanceProperty(_context = this.renderDefaultPage).call(_context, this);
|
|
47
48
|
this.renderSmallPage = _bindInstanceProperty(_context2 = this.renderSmallPage).call(_context2, this);
|
|
49
|
+
warning(Boolean(props.showSizeChanger && props.hideOnSinglePage), '[Semi Pagination] You should not use showSizeChanger and hideOnSinglePage in ths same time. At this time, hideOnSinglePage no longer takes effect, otherwise there may be a problem that the switch entry disappears');
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
get adapter() {
|
|
@@ -338,7 +340,8 @@ export default class Pagination extends BaseComponent {
|
|
|
338
340
|
className,
|
|
339
341
|
style,
|
|
340
342
|
hideOnSinglePage,
|
|
341
|
-
hoverShowPageSelect
|
|
343
|
+
hoverShowPageSelect,
|
|
344
|
+
showSizeChanger
|
|
342
345
|
} = this.props;
|
|
343
346
|
const paginationCls = classNames("".concat(prefixCls, "-small"), prefixCls, className);
|
|
344
347
|
const {
|
|
@@ -348,7 +351,7 @@ export default class Pagination extends BaseComponent {
|
|
|
348
351
|
} = this.state;
|
|
349
352
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
350
353
|
|
|
351
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
354
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
352
355
|
return null;
|
|
353
356
|
}
|
|
354
357
|
|
|
@@ -377,13 +380,14 @@ export default class Pagination extends BaseComponent {
|
|
|
377
380
|
showTotal,
|
|
378
381
|
className,
|
|
379
382
|
style,
|
|
380
|
-
hideOnSinglePage
|
|
383
|
+
hideOnSinglePage,
|
|
384
|
+
showSizeChanger
|
|
381
385
|
} = this.props;
|
|
382
386
|
const paginationCls = classNames(className, "".concat(prefixCls));
|
|
383
387
|
const showTotalCls = "".concat(prefixCls, "-total");
|
|
384
388
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
385
389
|
|
|
386
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
390
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
387
391
|
return null;
|
|
388
392
|
}
|
|
389
393
|
|
package/lib/es/select/index.js
CHANGED
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<
|
|
40
|
+
heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|
|
@@ -36,7 +36,7 @@ describe(`Navigation`, () => {
|
|
|
36
36
|
onSelect={key => console.log(key)}
|
|
37
37
|
header={{
|
|
38
38
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwzthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
39
|
-
text: '
|
|
39
|
+
text: 'Semi 运营后台',
|
|
40
40
|
}}
|
|
41
41
|
footer={{
|
|
42
42
|
collapseButton: true,
|
|
@@ -71,7 +71,7 @@ describe(`Navigation`, () => {
|
|
|
71
71
|
onSelect={data => console.log('trigger onSelect: ', data)}
|
|
72
72
|
onClick={data => console.log('trigger onClick: ', data)}
|
|
73
73
|
>
|
|
74
|
-
<Nav.Header logo={'bytedance_logo'} text={'
|
|
74
|
+
<Nav.Header logo={'bytedance_logo'} text={'Semi 运营后台'} />
|
|
75
75
|
<Nav.Item itemKey={'union'} text={'公会中心'} icon={'star'} />
|
|
76
76
|
<Nav.Sub itemKey={'user'} text="用户管理" icon="user">
|
|
77
77
|
<Nav.Item itemKey={'golder'} text={'金主管理'} />
|
|
@@ -135,7 +135,7 @@ describe(`Navigation`, () => {
|
|
|
135
135
|
items={items}
|
|
136
136
|
header={{
|
|
137
137
|
logo: 'bytedance_logo',
|
|
138
|
-
text: '
|
|
138
|
+
text: 'Semi 运营后台',
|
|
139
139
|
}}
|
|
140
140
|
footer={{ collapseButton: true }}
|
|
141
141
|
/>
|
|
@@ -201,7 +201,7 @@ describe(`Navigation`, () => {
|
|
|
201
201
|
onClick={onClick}
|
|
202
202
|
header={{
|
|
203
203
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwzthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
204
|
-
text: '
|
|
204
|
+
text: 'Semi 运营后台',
|
|
205
205
|
}}
|
|
206
206
|
footer={{
|
|
207
207
|
collapseButton: true,
|
|
@@ -55,7 +55,7 @@ const Demo = (props = {}) => {
|
|
|
55
55
|
onSelect={key => console.log(key)}
|
|
56
56
|
header={{
|
|
57
57
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
58
|
-
text: '
|
|
58
|
+
text: 'Semi运营后台',
|
|
59
59
|
}}
|
|
60
60
|
footer={{
|
|
61
61
|
collapseButton: true,
|
|
@@ -106,7 +106,7 @@ const Demo = (props = {}) => {
|
|
|
106
106
|
onOpenChange={onOpenChange}
|
|
107
107
|
header={{
|
|
108
108
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
109
|
-
text: '
|
|
109
|
+
text: 'Semi 运营后台',
|
|
110
110
|
}}
|
|
111
111
|
footer={{
|
|
112
112
|
collapseButton: true,
|
|
@@ -272,7 +272,7 @@ class HorizontalDemo extends React.Component {
|
|
|
272
272
|
logo: (
|
|
273
273
|
<img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />
|
|
274
274
|
),
|
|
275
|
-
text: '
|
|
275
|
+
text: 'Semi 运营后台',
|
|
276
276
|
}}
|
|
277
277
|
footer={{
|
|
278
278
|
collapseButton: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { IconHome, IconHistogram, IconSetting, IconLive, IconUser, IconStar } from '@douyinfe/semi-icons';
|
|
3
|
+
import { IconHome, IconHistogram, IconSetting, IconLive, IconUser, IconStar, IconUserGroup } from '@douyinfe/semi-icons';
|
|
4
4
|
|
|
5
5
|
import Nav from '..';
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ stories.add(`default`, () => {
|
|
|
15
15
|
<Nav onSelect={(...args: any[]) => console.log(...args)}>
|
|
16
16
|
<Nav.Header logo={<img src={logo} />} text={'火山运营'} />
|
|
17
17
|
<Nav.Item itemKey={'1'} text={'Option 1'} icon="mail" link="/mail" />
|
|
18
|
-
<Nav.Sub text={'Group 2'} icon="folder"
|
|
18
|
+
<Nav.Sub text={'Group 2'} icon="folder" itemKey={'2'}>
|
|
19
19
|
{['2-1', '2-2'].map(k => (
|
|
20
20
|
<Nav.Item key={k} itemKey={String(k)} text={'Option ' + k} link={`folder/${k}`} />
|
|
21
21
|
))}
|
|
@@ -27,7 +27,7 @@ stories.add(`default`, () => {
|
|
|
27
27
|
</Nav.Sub>
|
|
28
28
|
<Nav.Item key={3} itemKey={'3'} text={'Option 3'} icon="gift" />
|
|
29
29
|
<Nav.Item key={4} itemKey={'4'} text={'Option 4'} icon="list" />
|
|
30
|
-
<Nav.Sub text={'Group 5'} icon="flag"
|
|
30
|
+
<Nav.Sub text={'Group 5'} icon="flag" itemKey={'5'}>
|
|
31
31
|
{['5-1', '5-2'].map(k => (
|
|
32
32
|
<Nav.Item key={k} itemKey={String(k)} text={'Option ' + k} />
|
|
33
33
|
))}
|
|
@@ -80,7 +80,7 @@ stories.add(`fix 35`, () => {
|
|
|
80
80
|
onSelect={data => console.log('trigger onSelect: ', data)}
|
|
81
81
|
onClick={data => console.log('trigger onClick: ', data)}
|
|
82
82
|
>
|
|
83
|
-
<Nav.Header logo={<img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />} text={'
|
|
83
|
+
<Nav.Header logo={<img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />} text={'Semi 运营后台'} />
|
|
84
84
|
<Nav.Item itemKey={'union'} text={'公会中心'} icon={<IconStar />} />
|
|
85
85
|
<Nav.Sub itemKey={'user'} text="用户管理" icon={<IconUser />}>
|
|
86
86
|
<Nav.Item itemKey={'golder'} text={'金主管理'} />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
17
|
"@douyinfe/semi-animation-react": "2.1.5",
|
|
18
|
-
"@douyinfe/semi-foundation": "2.1.
|
|
19
|
-
"@douyinfe/semi-icons": "2.1.
|
|
18
|
+
"@douyinfe/semi-foundation": "2.1.6-alpha.0",
|
|
19
|
+
"@douyinfe/semi-icons": "2.1.6-alpha.0",
|
|
20
20
|
"@douyinfe/semi-illustrations": "2.1.5",
|
|
21
21
|
"@douyinfe/semi-theme-default": "2.1.5",
|
|
22
22
|
"@types/react-window": "^1.8.2",
|
|
@@ -53,6 +53,14 @@
|
|
|
53
53
|
"pc component",
|
|
54
54
|
"dark mode"
|
|
55
55
|
],
|
|
56
|
+
"homepage": "https://semi.design",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/DouyinFE/semi-design/issues"
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "https://github.com/DouyinFE"
|
|
63
|
+
},
|
|
56
64
|
"_unpkg": true,
|
|
57
65
|
"unpkgFiles": [
|
|
58
66
|
"dist/css",
|
|
@@ -60,13 +68,13 @@
|
|
|
60
68
|
],
|
|
61
69
|
"author": "",
|
|
62
70
|
"license": "MIT",
|
|
63
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "6721f8e4f803913529db3c51d6d0af5dfe616938",
|
|
64
72
|
"devDependencies": {
|
|
65
73
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
66
74
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
67
75
|
"@babel/preset-env": "^7.15.8",
|
|
68
76
|
"@babel/preset-react": "^7.14.5",
|
|
69
|
-
"@douyinfe/semi-scss-compile": "2.1.
|
|
77
|
+
"@douyinfe/semi-scss-compile": "2.1.6-alpha.0",
|
|
70
78
|
"@storybook/addon-knobs": "^6.3.1",
|
|
71
79
|
"@types/lodash": "^4.14.176",
|
|
72
80
|
"babel-loader": "^8.2.2",
|
|
@@ -146,3 +146,14 @@ export const PaginationDynamicUpdatePageSize = () => <DynamicPageSize />;
|
|
|
146
146
|
PaginationDynamicUpdatePageSize.story = {
|
|
147
147
|
name: 'Pagination dynamic update pageSize',
|
|
148
148
|
};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
export const HideOnSingePageAndShowChanger = () => {
|
|
152
|
+
return (
|
|
153
|
+
<Pagination total={10} hideOnSinglePage showSizeChanger style={{ marginBottom: 12 }}></Pagination>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
HideOnSingePageAndShowChanger.story = {
|
|
158
|
+
name: 'hideOnSingelePage & showSizeChanger at same time',
|
|
159
|
+
};
|
package/pagination/index.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import { cssClasses, numbers } from '@douyinfe/semi-foundation/pagination/consta
|
|
|
14
14
|
import '@douyinfe/semi-foundation/pagination/pagination.scss';
|
|
15
15
|
import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/popover/constants';
|
|
16
16
|
import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons';
|
|
17
|
+
import warning from '@douyinfe/semi-foundation/utils/warning';
|
|
17
18
|
|
|
18
19
|
import ConfigContext from '../configProvider/context';
|
|
19
20
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
@@ -127,6 +128,10 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
|
|
|
127
128
|
this.foundation = new PaginationFoundation(this.adapter);
|
|
128
129
|
this.renderDefaultPage = this.renderDefaultPage.bind(this);
|
|
129
130
|
this.renderSmallPage = this.renderSmallPage.bind(this);
|
|
131
|
+
warning(
|
|
132
|
+
Boolean(props.showSizeChanger && props.hideOnSinglePage),
|
|
133
|
+
'[Semi Pagination] You should not use showSizeChanger and hideOnSinglePage in ths same time. At this time, hideOnSinglePage no longer takes effect, otherwise there may be a problem that the switch entry disappears'
|
|
134
|
+
);
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
get adapter(): PaginationAdapter<PaginationProps, PaginationState> {
|
|
@@ -377,11 +382,11 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
|
|
|
377
382
|
}
|
|
378
383
|
|
|
379
384
|
renderSmallPage(locale: PaginationLocale) {
|
|
380
|
-
const { className, style, hideOnSinglePage, hoverShowPageSelect } = this.props;
|
|
385
|
+
const { className, style, hideOnSinglePage, hoverShowPageSelect, showSizeChanger } = this.props;
|
|
381
386
|
const paginationCls = classNames(`${prefixCls}-small`, prefixCls, className);
|
|
382
387
|
const { currentPage, total, pageSize } = this.state;
|
|
383
388
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
384
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
389
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
385
390
|
return null;
|
|
386
391
|
}
|
|
387
392
|
|
|
@@ -410,11 +415,11 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
|
|
|
410
415
|
|
|
411
416
|
renderDefaultPage(locale: PaginationLocale) {
|
|
412
417
|
const { total, pageSize } = this.state;
|
|
413
|
-
const { showTotal, className, style, hideOnSinglePage } = this.props;
|
|
418
|
+
const { showTotal, className, style, hideOnSinglePage, showSizeChanger } = this.props;
|
|
414
419
|
const paginationCls = classNames(className, `${prefixCls}`);
|
|
415
420
|
const showTotalCls = `${prefixCls }-total`;
|
|
416
421
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
417
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
422
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
418
423
|
return null;
|
|
419
424
|
}
|
|
420
425
|
return (
|
|
@@ -1033,12 +1033,12 @@ class CustomRender extends React.Component {
|
|
|
1033
1033
|
};
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
|
-
renderCustomOption(item) {
|
|
1037
|
-
|
|
1036
|
+
renderCustomOption(item, index) {
|
|
1037
|
+
const optionStyle = {
|
|
1038
1038
|
display: 'flex',
|
|
1039
1039
|
};
|
|
1040
1040
|
return (
|
|
1041
|
-
<Option value={item.name} style={optionStyle} showTick={false} {...item}>
|
|
1041
|
+
<Option key={index} value={item.name} style={optionStyle} showTick={false} {...item}>
|
|
1042
1042
|
<Avatar color={item.color} size="small">
|
|
1043
1043
|
{item.abbr}
|
|
1044
1044
|
</Avatar>
|
|
@@ -1098,7 +1098,7 @@ class CustomRender extends React.Component {
|
|
|
1098
1098
|
};
|
|
1099
1099
|
}
|
|
1100
1100
|
|
|
1101
|
-
renderMultipleWithoutTag(optionNode
|
|
1101
|
+
renderMultipleWithoutTag(optionNode) {
|
|
1102
1102
|
let content = (
|
|
1103
1103
|
<div>
|
|
1104
1104
|
<Avatar color={optionNode.color} size="small">
|
|
@@ -1125,7 +1125,7 @@ class CustomRender extends React.Component {
|
|
|
1125
1125
|
defaultValue={'夏可漫'}
|
|
1126
1126
|
renderSelectedItem={this.renderSelectedItem}
|
|
1127
1127
|
>
|
|
1128
|
-
{list.map(item => this.renderCustomOption(item))}
|
|
1128
|
+
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1129
1129
|
</Select>
|
|
1130
1130
|
<Select
|
|
1131
1131
|
style={{
|
|
@@ -1138,7 +1138,7 @@ class CustomRender extends React.Component {
|
|
|
1138
1138
|
multiple
|
|
1139
1139
|
renderSelectedItem={this.renderMultipleSelectedItem}
|
|
1140
1140
|
>
|
|
1141
|
-
{list.map(item => this.renderCustomOption(item))}
|
|
1141
|
+
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1142
1142
|
</Select>
|
|
1143
1143
|
<Select
|
|
1144
1144
|
style={{
|
|
@@ -1151,7 +1151,7 @@ class CustomRender extends React.Component {
|
|
|
1151
1151
|
multiple
|
|
1152
1152
|
renderSelectedItem={this.renderMultipleWithoutTag}
|
|
1153
1153
|
>
|
|
1154
|
-
{list.map(item => this.renderCustomOption(item))}
|
|
1154
|
+
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1155
1155
|
</Select>
|
|
1156
1156
|
</React.Fragment>
|
|
1157
1157
|
);
|
|
@@ -2122,15 +2122,15 @@ class OptionGroupDemo extends React.Component {
|
|
|
2122
2122
|
});
|
|
2123
2123
|
}
|
|
2124
2124
|
|
|
2125
|
-
renderGroup(group) {
|
|
2126
|
-
|
|
2127
|
-
<Select.Option value={option.value} label={option.label} key={option.label}
|
|
2125
|
+
renderGroup(group, index) {
|
|
2126
|
+
const options = group.children.map(option => (
|
|
2127
|
+
<Select.Option value={option.value} label={option.label} key={option.label} />
|
|
2128
2128
|
));
|
|
2129
|
-
return <Select.OptGroup label={group.label}>{options}</Select.OptGroup>;
|
|
2129
|
+
return <Select.OptGroup key={`${index}-${group.label}`} label={group.label}>{options}</Select.OptGroup>;
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
render() {
|
|
2133
|
-
|
|
2133
|
+
const { groups } = this.state;
|
|
2134
2134
|
return (
|
|
2135
2135
|
<>
|
|
2136
2136
|
<Select
|
|
@@ -2142,14 +2142,14 @@ class OptionGroupDemo extends React.Component {
|
|
|
2142
2142
|
onSearch={this.handleSearch}
|
|
2143
2143
|
remote
|
|
2144
2144
|
>
|
|
2145
|
-
{groups.map(group => this.renderGroup(group))}
|
|
2145
|
+
{groups.map((group, index) => this.renderGroup(group, index))}
|
|
2146
2146
|
</Select>
|
|
2147
2147
|
</>
|
|
2148
2148
|
);
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
2151
2151
|
|
|
2152
|
-
export const SelectOptionGroup = () => <OptionGroupDemo
|
|
2152
|
+
export const SelectOptionGroup = () => <OptionGroupDemo />;
|
|
2153
2153
|
|
|
2154
2154
|
SelectOptionGroup.story = {
|
|
2155
2155
|
name: 'Select OptionGroup',
|
package/select/index.tsx
CHANGED
|
@@ -6,22 +6,19 @@ class App extends React.Component {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
const labels = [
|
|
9
|
-
{ text: '
|
|
10
|
-
{ text: '
|
|
11
|
-
{ text: '
|
|
12
|
-
{ text: '
|
|
13
|
-
{ text: '
|
|
14
|
-
{ text: '
|
|
15
|
-
{ text: '
|
|
16
|
-
{ text: '
|
|
17
|
-
{ text: '
|
|
18
|
-
{ text: '
|
|
19
|
-
{ text: '
|
|
20
|
-
{ text: '
|
|
21
|
-
{ text: '
|
|
22
|
-
{ text: '123456789123', value: 24 },
|
|
23
|
-
{ text: '哈哈', value: 23 },
|
|
24
|
-
{ text: '匠子空间mcn签约', value: 7 },
|
|
9
|
+
{ text: '测试数据0', value: 4 },
|
|
10
|
+
{ text: '测试数据1', value: 18 },
|
|
11
|
+
{ text: '测试数据2', value: 3 },
|
|
12
|
+
{ text: '测试数据3', value: 1427 },
|
|
13
|
+
{ text: '测试数据4', value: 1 },
|
|
14
|
+
{ text: '测试数据5', value: 1406 },
|
|
15
|
+
{ text: '测试数据6', value: 1404 },
|
|
16
|
+
{ text: '测试数据7', value: 1401 },
|
|
17
|
+
{ text: '测试数据8', value: 1397 },
|
|
18
|
+
{ text: '测试数据9', value: 1396 },
|
|
19
|
+
{ text: '测试数据10', value: 2 },
|
|
20
|
+
{ text: '测试数据11', value: 24 },
|
|
21
|
+
{ text: '测试数据12', value: 23 },
|
|
25
22
|
];
|
|
26
23
|
this.state = {
|
|
27
24
|
data: datsJson,
|