@douyinfe/semi-ui 2.36.0-alpha.0 → 2.36.0-beta.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 +166 -510
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +247 -277
- 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/lib/cjs/anchor/index.d.ts +3 -2
- package/lib/cjs/anchor/link.js +13 -6
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -1
- package/lib/cjs/button/index.d.ts +1 -1
- package/lib/cjs/calendar/dayCalendar.d.ts +2 -1
- package/lib/cjs/calendar/dayCalendar.js +7 -2
- package/lib/cjs/calendar/index.d.ts +1 -0
- package/lib/cjs/calendar/index.js +1 -0
- package/lib/cjs/calendar/interface.d.ts +2 -0
- package/lib/cjs/calendar/monthCalendar.d.ts +1 -1
- package/lib/cjs/calendar/monthCalendar.js +12 -4
- package/lib/cjs/calendar/rangeCalendar.d.ts +3 -1
- package/lib/cjs/calendar/rangeCalendar.js +23 -9
- package/lib/cjs/calendar/weekCalendar.d.ts +3 -1
- package/lib/cjs/calendar/weekCalendar.js +23 -9
- package/lib/cjs/collapse/item.d.ts +0 -2
- package/lib/cjs/collapse/item.js +2 -3
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +2 -2
- package/lib/cjs/datePicker/datePicker.js +12 -4
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.js +6 -2
- package/lib/cjs/datePicker/yearAndMonth.d.ts +3 -1
- package/lib/cjs/datePicker/yearAndMonth.js +4 -2
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/input/index.d.ts +1 -1
- package/lib/cjs/input/inputGroup.d.ts +1 -1
- package/lib/cjs/input/textarea.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +17 -17
- package/lib/cjs/navigation/Footer.d.ts +3 -0
- package/lib/cjs/navigation/Footer.js +19 -9
- package/lib/cjs/navigation/Item.d.ts +0 -4
- package/lib/cjs/navigation/Item.js +10 -29
- package/lib/cjs/navigation/SubNav.d.ts +1 -18
- package/lib/cjs/navigation/SubNav.js +30 -70
- package/lib/cjs/navigation/index.d.ts +4 -1
- package/lib/cjs/navigation/index.js +7 -1
- package/lib/cjs/rating/index.d.ts +1 -1
- package/lib/cjs/rating/item.d.ts +1 -1
- package/lib/cjs/select/index.d.ts +2 -1
- package/lib/cjs/select/index.js +4 -0
- package/lib/cjs/skeleton/index.d.ts +0 -1
- package/lib/cjs/skeleton/index.js +0 -1
- package/lib/cjs/skeleton/item.d.ts +0 -1
- package/lib/cjs/skeleton/item.js +1 -6
- package/lib/cjs/steps/basicStep.d.ts +0 -3
- package/lib/cjs/steps/basicStep.js +2 -8
- package/lib/cjs/steps/basicSteps.js +1 -2
- package/lib/cjs/steps/fillStep.d.ts +0 -2
- package/lib/cjs/steps/fillStep.js +1 -3
- package/lib/cjs/steps/fillSteps.js +8 -5
- package/lib/cjs/steps/index.d.ts +1 -63
- package/lib/cjs/steps/index.js +0 -9
- package/lib/cjs/steps/navStep.d.ts +0 -3
- package/lib/cjs/steps/navStep.js +2 -6
- package/lib/cjs/steps/navSteps.js +1 -2
- package/lib/cjs/steps/step.d.ts +1 -4
- package/lib/cjs/steps/step.js +0 -1
- package/lib/cjs/switch/index.d.ts +1 -1
- package/lib/cjs/table/Body/index.d.ts +1 -1
- package/lib/cjs/table/ResizableTable.d.ts +1 -1
- package/lib/cjs/table/Table.d.ts +2 -2
- package/lib/cjs/table/TableHeaderRow.js +22 -14
- package/lib/cjs/table/index.d.ts +1 -1
- package/lib/cjs/table/interface.d.ts +5 -1
- package/lib/cjs/tagInput/index.d.ts +1 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +1 -1
- package/lib/cjs/timeline/index.d.ts +1 -2
- package/lib/cjs/timeline/index.js +2 -8
- package/lib/cjs/timeline/item.d.ts +0 -10
- package/lib/cjs/timeline/item.js +3 -42
- package/lib/cjs/typography/base.d.ts +1 -0
- package/lib/cjs/typography/base.js +28 -14
- package/lib/cjs/typography/title.d.ts +2 -0
- package/lib/cjs/typography/title.js +2 -1
- package/lib/es/anchor/index.d.ts +3 -2
- package/lib/es/anchor/link.js +12 -6
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/buttonGroup.d.ts +1 -1
- package/lib/es/button/index.d.ts +1 -1
- package/lib/es/calendar/dayCalendar.d.ts +2 -1
- package/lib/es/calendar/dayCalendar.js +7 -2
- package/lib/es/calendar/index.d.ts +1 -0
- package/lib/es/calendar/index.js +1 -0
- package/lib/es/calendar/interface.d.ts +2 -0
- package/lib/es/calendar/monthCalendar.d.ts +1 -1
- package/lib/es/calendar/monthCalendar.js +12 -4
- package/lib/es/calendar/rangeCalendar.d.ts +3 -1
- package/lib/es/calendar/rangeCalendar.js +19 -9
- package/lib/es/calendar/weekCalendar.d.ts +3 -1
- package/lib/es/calendar/weekCalendar.js +19 -9
- package/lib/es/collapse/item.d.ts +0 -2
- package/lib/es/collapse/item.js +2 -3
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +2 -2
- package/lib/es/datePicker/datePicker.js +12 -4
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.js +6 -2
- package/lib/es/datePicker/yearAndMonth.d.ts +3 -1
- package/lib/es/datePicker/yearAndMonth.js +4 -2
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/input/index.d.ts +1 -1
- package/lib/es/input/inputGroup.d.ts +1 -1
- package/lib/es/input/textarea.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +17 -17
- package/lib/es/navigation/Footer.d.ts +3 -0
- package/lib/es/navigation/Footer.js +16 -7
- package/lib/es/navigation/Item.d.ts +0 -4
- package/lib/es/navigation/Item.js +10 -28
- package/lib/es/navigation/SubNav.d.ts +1 -18
- package/lib/es/navigation/SubNav.js +31 -72
- package/lib/es/navigation/index.d.ts +4 -1
- package/lib/es/navigation/index.js +7 -1
- package/lib/es/rating/index.d.ts +1 -1
- package/lib/es/rating/item.d.ts +1 -1
- package/lib/es/select/index.d.ts +2 -1
- package/lib/es/select/index.js +4 -0
- package/lib/es/skeleton/index.d.ts +0 -1
- package/lib/es/skeleton/index.js +0 -1
- package/lib/es/skeleton/item.d.ts +0 -1
- package/lib/es/skeleton/item.js +1 -6
- package/lib/es/steps/basicStep.d.ts +0 -3
- package/lib/es/steps/basicStep.js +2 -8
- package/lib/es/steps/basicSteps.js +1 -2
- package/lib/es/steps/fillStep.d.ts +0 -2
- package/lib/es/steps/fillStep.js +1 -3
- package/lib/es/steps/fillSteps.js +8 -6
- package/lib/es/steps/index.d.ts +1 -63
- package/lib/es/steps/index.js +0 -6
- package/lib/es/steps/navStep.d.ts +0 -3
- package/lib/es/steps/navStep.js +2 -6
- package/lib/es/steps/navSteps.js +1 -2
- package/lib/es/steps/step.d.ts +1 -4
- package/lib/es/steps/step.js +0 -1
- package/lib/es/switch/index.d.ts +1 -1
- package/lib/es/table/Body/index.d.ts +1 -1
- package/lib/es/table/ResizableTable.d.ts +1 -1
- package/lib/es/table/Table.d.ts +2 -2
- package/lib/es/table/TableHeaderRow.js +22 -14
- package/lib/es/table/index.d.ts +1 -1
- package/lib/es/table/interface.d.ts +5 -1
- package/lib/es/tagInput/index.d.ts +1 -1
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +1 -1
- package/lib/es/timeline/index.d.ts +1 -2
- package/lib/es/timeline/index.js +2 -7
- package/lib/es/timeline/item.d.ts +0 -10
- package/lib/es/timeline/item.js +3 -41
- package/lib/es/typography/base.d.ts +1 -0
- package/lib/es/typography/base.js +28 -14
- package/lib/es/typography/title.d.ts +2 -0
- package/lib/es/typography/title.js +2 -1
- package/package.json +8 -9
- package/lib/cjs/timeline/context.d.ts +0 -8
- package/lib/cjs/timeline/context.js +0 -15
- package/lib/es/timeline/context.d.ts +0 -8
- package/lib/es/timeline/context.js +0 -3
package/lib/es/steps/step.js
CHANGED
package/lib/es/switch/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ declare class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
|
45
45
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
46
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
47
|
style: PropTypes.Requireable<object>;
|
|
48
|
-
size: PropTypes.Requireable<"
|
|
48
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
49
49
|
uncheckedText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
50
50
|
id: PropTypes.Requireable<string>;
|
|
51
51
|
};
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { FlattenData, GroupFlattenData } from '@douyinfe/semi-foundation/lib/es/table/bodyFoundation';
|
|
3
3
|
import Store from '@douyinfe/semi-foundation/lib/es/utils/Store';
|
|
4
4
|
import { BaseProps } from '../../_base/baseComponent';
|
|
5
|
-
import { ExpandedRowRender, Virtualized, GetVirtualizedListRef, ColumnProps, Size, BodyScrollEvent, Scroll, Fixed, TableComponents, RowExpandable, VirtualizedOnScroll, RowKey } from '../interface';
|
|
5
|
+
import type { ExpandedRowRender, Virtualized, GetVirtualizedListRef, ColumnProps, Size, BodyScrollEvent, Scroll, Fixed, TableComponents, RowExpandable, VirtualizedOnScroll, RowKey } from '../interface';
|
|
6
6
|
export interface BodyProps extends BaseProps {
|
|
7
7
|
tableLayout?: 'fixed' | 'auto';
|
|
8
8
|
anyColumnFixed?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Table from './Table';
|
|
3
|
-
import { TableProps } from './interface';
|
|
3
|
+
import type { TableProps } from './interface';
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<TableProps<any> & React.RefAttributes<Table<any>>>;
|
|
5
5
|
export default _default;
|
package/lib/es/table/Table.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
60
60
|
components: PropTypes.Requireable<any>;
|
|
61
61
|
bordered: PropTypes.Requireable<boolean>;
|
|
62
62
|
loading: PropTypes.Requireable<boolean>;
|
|
63
|
-
size: PropTypes.Requireable<"
|
|
63
|
+
size: PropTypes.Requireable<"default" | "small" | "middle">;
|
|
64
64
|
tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
|
|
65
65
|
columns: PropTypes.Requireable<PropTypes.InferProps<{
|
|
66
66
|
align: PropTypes.Requireable<"left" | "right" | "center">;
|
|
@@ -297,7 +297,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
297
297
|
showTotal?: boolean;
|
|
298
298
|
pageSize?: number;
|
|
299
299
|
pageSizeOpts?: number[];
|
|
300
|
-
size?: "
|
|
300
|
+
size?: "default" | "small";
|
|
301
301
|
currentPage?: number;
|
|
302
302
|
defaultCurrentPage?: number;
|
|
303
303
|
onPageChange?: (currentPage: number) => void;
|
|
@@ -169,22 +169,30 @@ export default class TableHeaderRow extends BaseComponent {
|
|
|
169
169
|
return null;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
return (
|
|
173
|
+
/*#__PURE__*/
|
|
174
|
+
// @ts-ignore no need to do complex ts type checking and qualification
|
|
175
|
+
React.createElement(HeaderCell, Object.assign({
|
|
176
|
+
role: "columnheader",
|
|
177
|
+
"aria-colindex": cellIndex + 1
|
|
178
|
+
}, props, {
|
|
179
|
+
style: cellStyle,
|
|
180
|
+
key: column.key || column.dataIndex || cellIndex
|
|
181
|
+
}))
|
|
182
|
+
);
|
|
179
183
|
});
|
|
180
184
|
|
|
181
|
-
return
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
return (
|
|
186
|
+
/*#__PURE__*/
|
|
187
|
+
// @ts-ignore no need to do complex ts type checking and qualification
|
|
188
|
+
React.createElement(HeaderRow, Object.assign({
|
|
189
|
+
role: "row",
|
|
190
|
+
"aria-rowindex": index + 1
|
|
191
|
+
}, rowProps, {
|
|
192
|
+
style: style,
|
|
193
|
+
ref: this.cacheRef
|
|
194
|
+
}), cells)
|
|
195
|
+
);
|
|
188
196
|
}
|
|
189
197
|
|
|
190
198
|
}
|
package/lib/es/table/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
|
|
|
16
16
|
components: PropTypes.Requireable<any>;
|
|
17
17
|
bordered: PropTypes.Requireable<boolean>;
|
|
18
18
|
loading: PropTypes.Requireable<boolean>;
|
|
19
|
-
size: PropTypes.Requireable<"
|
|
19
|
+
size: PropTypes.Requireable<"default" | "small" | "middle">;
|
|
20
20
|
tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
|
|
21
21
|
columns: PropTypes.Requireable<PropTypes.InferProps<{
|
|
22
22
|
align: PropTypes.Requireable<"left" | "right" | "center">;
|
|
@@ -262,8 +262,12 @@ export declare type VirtualizedOnScrollArgs = {
|
|
|
262
262
|
scrollOffset?: number;
|
|
263
263
|
scrollUpdateWasRequested?: boolean;
|
|
264
264
|
};
|
|
265
|
+
export declare type VirtualizeItemSizeRow = {
|
|
266
|
+
sectionRow?: boolean;
|
|
267
|
+
expandedRow?: boolean;
|
|
268
|
+
};
|
|
265
269
|
export declare type VirtualizedMode = 'list' | 'grid';
|
|
266
|
-
export declare type VirtualizedItemSizeFn = (index?: number) => number;
|
|
270
|
+
export declare type VirtualizedItemSizeFn = (index?: number, row?: VirtualizeItemSizeRow) => number;
|
|
267
271
|
export declare type VirtualizedItemSize = number | VirtualizedItemSizeFn;
|
|
268
272
|
export declare type VirtualizedOnScroll = (object: VirtualizedOnScrollArgs) => void;
|
|
269
273
|
export interface VirtualizedProps {
|
|
@@ -96,7 +96,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
96
96
|
onAdd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
97
97
|
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
98
98
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
99
|
-
size: PropTypes.Requireable<"
|
|
99
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
100
100
|
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
101
101
|
prefix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
102
102
|
suffix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -132,7 +132,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
132
132
|
secondStep: PropTypes.Requireable<number>;
|
|
133
133
|
focusOnOpen: PropTypes.Requireable<boolean>;
|
|
134
134
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
135
|
-
size: PropTypes.Requireable<"
|
|
135
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
136
136
|
panels: PropTypes.Requireable<PropTypes.InferProps<{
|
|
137
137
|
panelHeader: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
138
138
|
panelFooter: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -49,7 +49,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
49
49
|
secondStep: import("prop-types").Requireable<number>;
|
|
50
50
|
focusOnOpen: import("prop-types").Requireable<boolean>;
|
|
51
51
|
autoFocus: import("prop-types").Requireable<boolean>;
|
|
52
|
-
size: import("prop-types").Requireable<"
|
|
52
|
+
size: import("prop-types").Requireable<"default" | "small" | "large">;
|
|
53
53
|
panels: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
54
54
|
panelHeader: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
|
|
55
55
|
panelFooter: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
|
|
@@ -2,13 +2,12 @@ import React, { PureComponent } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
|
|
4
4
|
import Item, { TimelineItemProps } from './item';
|
|
5
|
-
import { ModeType } from './context';
|
|
6
5
|
export type { TimelineItemProps } from './item';
|
|
7
6
|
export interface Data extends TimelineItemProps {
|
|
8
7
|
content: React.ReactNode;
|
|
9
8
|
}
|
|
10
9
|
export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'> {
|
|
11
|
-
mode?:
|
|
10
|
+
mode?: 'left' | 'right' | 'center' | 'alternate';
|
|
12
11
|
className?: string;
|
|
13
12
|
style?: React.CSSProperties;
|
|
14
13
|
dataSource?: Data[];
|
package/lib/es/timeline/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
|
|
|
5
5
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/timeline/constants';
|
|
6
6
|
import ConfigContext from '../configProvider/context';
|
|
7
7
|
import Item from './item';
|
|
8
|
-
import Context from './context';
|
|
9
8
|
const prefixCls = cssClasses.PREFIX;
|
|
10
9
|
|
|
11
10
|
class Timeline extends PureComponent {
|
|
@@ -77,15 +76,11 @@ class Timeline extends PureComponent {
|
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
const items = childrenList || this.addClassName(children);
|
|
80
|
-
return /*#__PURE__*/React.createElement(
|
|
81
|
-
value: {
|
|
82
|
-
mode
|
|
83
|
-
}
|
|
84
|
-
}, /*#__PURE__*/React.createElement("ul", {
|
|
79
|
+
return /*#__PURE__*/React.createElement("ul", {
|
|
85
80
|
"aria-label": this.props['aria-label'],
|
|
86
81
|
style: style,
|
|
87
82
|
className: classString
|
|
88
|
-
}, items)
|
|
83
|
+
}, items);
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
|
|
4
|
-
import { ModeType, TimelineContextValue } from './context';
|
|
5
4
|
export interface TimelineItemProps {
|
|
6
5
|
color?: string;
|
|
7
6
|
children?: React.ReactNode;
|
|
@@ -13,13 +12,8 @@ export interface TimelineItemProps {
|
|
|
13
12
|
className?: string;
|
|
14
13
|
style?: React.CSSProperties;
|
|
15
14
|
onClick?: React.MouseEventHandler<HTMLLIElement>;
|
|
16
|
-
mode?: ModeType;
|
|
17
|
-
odd?: boolean;
|
|
18
|
-
usedInC2D?: boolean;
|
|
19
15
|
}
|
|
20
16
|
export default class Item extends PureComponent<TimelineItemProps> {
|
|
21
|
-
static contextType: React.Context<TimelineContextValue>;
|
|
22
|
-
static elementType: string;
|
|
23
17
|
static propTypes: {
|
|
24
18
|
color: PropTypes.Requireable<string>;
|
|
25
19
|
time: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -30,15 +24,11 @@ export default class Item extends PureComponent<TimelineItemProps> {
|
|
|
30
24
|
className: PropTypes.Requireable<string>;
|
|
31
25
|
style: PropTypes.Requireable<object>;
|
|
32
26
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
|
-
mode: PropTypes.Requireable<string>;
|
|
34
|
-
lastChild: PropTypes.Requireable<boolean>;
|
|
35
27
|
};
|
|
36
|
-
context: TimelineContextValue;
|
|
37
28
|
static defaultProps: {
|
|
38
29
|
type: string;
|
|
39
30
|
time: string;
|
|
40
31
|
onClick: (...args: any[]) => void;
|
|
41
32
|
};
|
|
42
|
-
getC2DCls: () => string;
|
|
43
33
|
render(): JSX.Element;
|
|
44
34
|
}
|
package/lib/es/timeline/item.js
CHANGED
|
@@ -4,42 +4,8 @@ import cls from 'classnames';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/timeline/constants';
|
|
6
6
|
import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
|
|
7
|
-
import Context from './context';
|
|
8
7
|
const prefixCls = cssClasses.ITEM;
|
|
9
8
|
export default class Item extends PureComponent {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments); // getC2DCls is used in C2D, it does not work in non-C2D scenes
|
|
12
|
-
|
|
13
|
-
this.getC2DCls = () => {
|
|
14
|
-
let c2dCls = '';
|
|
15
|
-
const {
|
|
16
|
-
mode,
|
|
17
|
-
odd,
|
|
18
|
-
usedInC2D
|
|
19
|
-
} = this.props;
|
|
20
|
-
|
|
21
|
-
if (usedInC2D) {
|
|
22
|
-
switch (mode) {
|
|
23
|
-
case 'center':
|
|
24
|
-
c2dCls = `${prefixCls}-center ${prefixCls}-left`;
|
|
25
|
-
break;
|
|
26
|
-
|
|
27
|
-
case 'alternate':
|
|
28
|
-
c2dCls = `${prefixCls}-alternate ${prefixCls}-${odd ? 'left' : 'right'}`;
|
|
29
|
-
break;
|
|
30
|
-
|
|
31
|
-
default:
|
|
32
|
-
c2dCls = `${prefixCls}-${mode} ${mode === 'right' ? `${prefixCls}-mode-right` : ''}`;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
c2dCls += ` ${prefixCls}-not-last-child`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return c2dCls;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
9
|
render() {
|
|
44
10
|
const {
|
|
45
11
|
className,
|
|
@@ -52,7 +18,7 @@ export default class Item extends PureComponent {
|
|
|
52
18
|
extra,
|
|
53
19
|
onClick
|
|
54
20
|
} = this.props;
|
|
55
|
-
const itemCls = cls(prefixCls, className
|
|
21
|
+
const itemCls = cls(prefixCls, className);
|
|
56
22
|
const dotCls = cls({
|
|
57
23
|
[`${prefixCls}-head`]: true,
|
|
58
24
|
[`${prefixCls}-head-custom`]: dot,
|
|
@@ -83,7 +49,6 @@ export default class Item extends PureComponent {
|
|
|
83
49
|
}
|
|
84
50
|
|
|
85
51
|
}
|
|
86
|
-
Item.contextType = Context;
|
|
87
52
|
Item.propTypes = {
|
|
88
53
|
color: PropTypes.string,
|
|
89
54
|
time: PropTypes.node,
|
|
@@ -93,13 +58,10 @@ Item.propTypes = {
|
|
|
93
58
|
position: PropTypes.oneOf(strings.ITEM_POS),
|
|
94
59
|
className: PropTypes.string,
|
|
95
60
|
style: PropTypes.object,
|
|
96
|
-
onClick: PropTypes.func
|
|
97
|
-
mode: PropTypes.string,
|
|
98
|
-
lastChild: PropTypes.bool
|
|
61
|
+
onClick: PropTypes.func
|
|
99
62
|
};
|
|
100
63
|
Item.defaultProps = {
|
|
101
64
|
type: 'default',
|
|
102
65
|
time: '',
|
|
103
66
|
onClick: _noop
|
|
104
|
-
};
|
|
105
|
-
Item.elementType = 'Timeline.Item';
|
|
67
|
+
};
|
|
@@ -76,7 +76,7 @@ export default class Base extends Component {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
this.rafId = window.requestAnimationFrame(this.getEllipsisState.bind(this));
|
|
79
|
-
}; // if
|
|
79
|
+
}; // if it needs to use js overflowed:
|
|
80
80
|
// 1. text is expandable 2. expandText need to be shown 3. has extra operation 4. text need to ellipse from mid
|
|
81
81
|
|
|
82
82
|
|
|
@@ -419,10 +419,7 @@ export default class Base extends Component {
|
|
|
419
419
|
const {
|
|
420
420
|
expanded
|
|
421
421
|
} = this.state;
|
|
422
|
-
const canUseCSSEllipsis = this.canUseCSSEllipsis(); //
|
|
423
|
-
// both css truncation and js truncation should throw a warning
|
|
424
|
-
|
|
425
|
-
warning('children' in this.props && typeof children !== 'string', "[Semi Typography] 'Only children with pure text could be used with ellipsis at this moment."); // If children is null, css/js truncated flag isTruncate is false
|
|
422
|
+
const canUseCSSEllipsis = this.canUseCSSEllipsis(); // If children is null, css/js truncated flag isTruncate is false
|
|
426
423
|
|
|
427
424
|
if (_isNull(children)) {
|
|
428
425
|
this.setState({
|
|
@@ -430,7 +427,11 @@ export default class Base extends Component {
|
|
|
430
427
|
isOverflowed: false
|
|
431
428
|
});
|
|
432
429
|
return undefined;
|
|
433
|
-
}
|
|
430
|
+
} // Currently only text truncation is supported, if there is non-text,
|
|
431
|
+
// both css truncation and js truncation should throw a warning
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
warning('children' in this.props && typeof children !== 'string', "[Semi Typography] Only children with pure text could be used with ellipsis at this moment.");
|
|
434
435
|
|
|
435
436
|
if (!rows || rows < 0 || expanded) {
|
|
436
437
|
return undefined;
|
|
@@ -539,9 +540,10 @@ export default class Base extends Component {
|
|
|
539
540
|
icon,
|
|
540
541
|
size,
|
|
541
542
|
link,
|
|
542
|
-
heading
|
|
543
|
+
heading,
|
|
544
|
+
weight
|
|
543
545
|
} = _a,
|
|
544
|
-
rest = __rest(_a, ["component", "children", "className", "type", "spacing", "disabled", "style", "ellipsis", "icon", "size", "link", "heading"]);
|
|
546
|
+
rest = __rest(_a, ["component", "children", "className", "type", "spacing", "disabled", "style", "ellipsis", "icon", "size", "link", "heading", "weight"]);
|
|
545
547
|
|
|
546
548
|
const textProps = _omit(rest, ['strong', 'editable', 'mark', 'copyable', 'underline', 'code', // 'link',
|
|
547
549
|
'delete']);
|
|
@@ -561,6 +563,7 @@ export default class Base extends Component {
|
|
|
561
563
|
className: linkCls
|
|
562
564
|
}, textNode) : textNode));
|
|
563
565
|
const hTagReg = /^h[1-6]$/;
|
|
566
|
+
const isHeader = _isString(heading) && hTagReg.test(heading);
|
|
564
567
|
const wrapperCls = cls(className, ellipsisCls, {
|
|
565
568
|
// [`${prefixCls}-primary`]: !type || type === 'primary',
|
|
566
569
|
[`${prefixCls}-${type}`]: type && !link,
|
|
@@ -568,11 +571,15 @@ export default class Base extends Component {
|
|
|
568
571
|
[`${prefixCls}-link`]: link,
|
|
569
572
|
[`${prefixCls}-disabled`]: disabled,
|
|
570
573
|
[`${prefixCls}-${spacing}`]: spacing,
|
|
571
|
-
[`${prefixCls}-${heading}`]:
|
|
574
|
+
[`${prefixCls}-${heading}`]: isHeader,
|
|
575
|
+
[`${prefixCls}-${heading}-weight-${weight}`]: isHeader && isNaN(Number(weight))
|
|
572
576
|
});
|
|
577
|
+
const textStyle = Object.assign(Object.assign({}, isNaN(Number(weight)) ? {} : {
|
|
578
|
+
fontWeight: weight
|
|
579
|
+
}), style);
|
|
573
580
|
return /*#__PURE__*/React.createElement(Typography, Object.assign({
|
|
574
581
|
className: wrapperCls,
|
|
575
|
-
style: Object.assign(Object.assign({},
|
|
582
|
+
style: Object.assign(Object.assign({}, textStyle), ellipsisStyle),
|
|
576
583
|
component: component,
|
|
577
584
|
forwardRef: this.wrapperRef
|
|
578
585
|
}, textProps), textNode, this.renderOperations());
|
|
@@ -608,15 +615,22 @@ export default class Base extends Component {
|
|
|
608
615
|
}
|
|
609
616
|
|
|
610
617
|
render() {
|
|
611
|
-
|
|
612
|
-
onResize: this.onResize
|
|
613
|
-
}, /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
618
|
+
const content = /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
614
619
|
componentName: "Typography"
|
|
615
620
|
}, locale => {
|
|
616
621
|
this.expandStr = locale.expand;
|
|
617
622
|
this.collapseStr = locale.collapse;
|
|
618
623
|
return this.renderTipWrapper();
|
|
619
|
-
})
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
if (this.props.ellipsis) {
|
|
627
|
+
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
628
|
+
onResize: this.onResize,
|
|
629
|
+
observeParent: true
|
|
630
|
+
}, content);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
return content;
|
|
620
634
|
}
|
|
621
635
|
|
|
622
636
|
}
|
|
@@ -26,6 +26,7 @@ export interface TitleProps extends Omit<React.HTMLAttributes<HTMLHeadingElement
|
|
|
26
26
|
style?: React.CSSProperties;
|
|
27
27
|
type?: TypographyBaseType;
|
|
28
28
|
underline?: boolean;
|
|
29
|
+
weight?: ArrayElement<typeof strings.WEIGHT> | number;
|
|
29
30
|
}
|
|
30
31
|
export default class Title extends PureComponent<TitleProps> {
|
|
31
32
|
static propTypes: {
|
|
@@ -42,6 +43,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
42
43
|
style: PropTypes.Requireable<object>;
|
|
43
44
|
className: PropTypes.Requireable<string>;
|
|
44
45
|
component: PropTypes.Requireable<string>;
|
|
46
|
+
weight: PropTypes.Requireable<NonNullable<number | "default" | "bold" | "medium" | "light" | "regular" | "semibold">>;
|
|
45
47
|
};
|
|
46
48
|
static defaultProps: {
|
|
47
49
|
copyable: boolean;
|
|
@@ -44,7 +44,8 @@ Title.propTypes = {
|
|
|
44
44
|
heading: PropTypes.oneOf(strings.HEADING),
|
|
45
45
|
style: PropTypes.object,
|
|
46
46
|
className: PropTypes.string,
|
|
47
|
-
component: PropTypes.string
|
|
47
|
+
component: PropTypes.string,
|
|
48
|
+
weight: PropTypes.oneOfType([PropTypes.oneOf(strings.WEIGHT), PropTypes.number])
|
|
48
49
|
};
|
|
49
50
|
Title.defaultProps = {
|
|
50
51
|
copyable: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.36.0-
|
|
3
|
+
"version": "2.36.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"lib/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@douyinfe/semi-animation": "2.36.0-
|
|
21
|
-
"@douyinfe/semi-animation-react": "2.36.0-
|
|
22
|
-
"@douyinfe/semi-foundation": "2.36.0-
|
|
23
|
-
"@douyinfe/semi-icons": "2.36.0-
|
|
24
|
-
"@douyinfe/semi-illustrations": "2.36.0-
|
|
25
|
-
"@douyinfe/semi-theme-default": "2.36.0-
|
|
20
|
+
"@douyinfe/semi-animation": "2.36.0-beta.0",
|
|
21
|
+
"@douyinfe/semi-animation-react": "2.36.0-beta.0",
|
|
22
|
+
"@douyinfe/semi-foundation": "2.36.0-beta.0",
|
|
23
|
+
"@douyinfe/semi-icons": "2.36.0-beta.0",
|
|
24
|
+
"@douyinfe/semi-illustrations": "2.36.0-beta.0",
|
|
25
|
+
"@douyinfe/semi-theme-default": "2.36.0-beta.0",
|
|
26
26
|
"async-validator": "^3.5.0",
|
|
27
27
|
"classnames": "^2.2.6",
|
|
28
28
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -69,14 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "e973ed0dc3b8cd37e9c737f1548e386d814f787b",
|
|
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
78
|
"@douyinfe/semi-scss-compile": "2.23.2",
|
|
79
|
-
"@storybook/addon-knobs": "^6.3.1",
|
|
80
79
|
"@types/lodash": "^4.14.176",
|
|
81
80
|
"@types/react": ">=16.0.0",
|
|
82
81
|
"@types/react-dom": ">=16.0.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare type ModeType = 'left' | 'right' | 'center' | 'alternate';
|
|
3
|
-
export interface TimelineContextValue {
|
|
4
|
-
mode?: ModeType;
|
|
5
|
-
sum?: number;
|
|
6
|
-
}
|
|
7
|
-
declare const Context: React.Context<TimelineContextValue>;
|
|
8
|
-
export default Context;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const Context = /*#__PURE__*/_react.default.createContext(null);
|
|
13
|
-
|
|
14
|
-
var _default = Context;
|
|
15
|
-
exports.default = _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare type ModeType = 'left' | 'right' | 'center' | 'alternate';
|
|
3
|
-
export interface TimelineContextValue {
|
|
4
|
-
mode?: ModeType;
|
|
5
|
-
sum?: number;
|
|
6
|
-
}
|
|
7
|
-
declare const Context: React.Context<TimelineContextValue>;
|
|
8
|
-
export default Context;
|