@douyinfe/semi-ui 2.11.0-beta.1 → 2.11.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/anchor/link.tsx +2 -2
- package/autoComplete/index.tsx +3 -3
- package/avatar/interface.ts +2 -2
- package/badge/index.tsx +1 -1
- package/banner/index.tsx +4 -4
- package/breadcrumb/bread-context.tsx +1 -1
- package/card/cardGroup.tsx +1 -1
- package/card/index.tsx +1 -1
- package/cascader/index.tsx +4 -4
- package/collapse/index.tsx +1 -1
- package/collapse/item.tsx +1 -1
- package/collapsible/index.tsx +1 -1
- package/descriptions/item.tsx +1 -1
- package/dist/umd/semi-ui.js +27 -22
- 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/empty/index.tsx +1 -1
- package/form/errorMessage.tsx +1 -1
- package/form/interface.ts +1 -1
- package/form/label.tsx +1 -1
- package/form/section.tsx +2 -2
- package/form/slot.tsx +1 -1
- package/layout/Sider.tsx +1 -1
- package/lib/cjs/anchor/link.d.ts +2 -2
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.js +1 -1
- package/lib/cjs/avatar/interface.d.ts +2 -2
- package/lib/cjs/badge/index.d.ts +1 -1
- package/lib/cjs/banner/index.d.ts +4 -4
- package/lib/cjs/breadcrumb/bread-context.d.ts +1 -1
- package/lib/cjs/card/cardGroup.d.ts +1 -1
- package/lib/cjs/card/index.d.ts +1 -1
- package/lib/cjs/cascader/index.d.ts +1 -1
- package/lib/cjs/collapse/index.d.ts +1 -1
- package/lib/cjs/collapse/item.d.ts +1 -1
- package/lib/cjs/collapsible/index.d.ts +1 -1
- package/lib/cjs/descriptions/item.d.ts +1 -1
- package/lib/cjs/empty/index.d.ts +1 -1
- package/lib/cjs/form/errorMessage.d.ts +1 -1
- package/lib/cjs/form/interface.d.ts +1 -1
- package/lib/cjs/form/label.d.ts +1 -1
- package/lib/cjs/form/section.d.ts +2 -2
- package/lib/cjs/form/slot.d.ts +1 -1
- package/lib/cjs/layout/Sider.d.ts +1 -1
- package/lib/cjs/list/index.d.ts +1 -1
- package/lib/cjs/list/item.d.ts +1 -1
- package/lib/cjs/modal/Modal.d.ts +5 -5
- package/lib/cjs/modal/ModalContent.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +4 -2
- package/lib/cjs/modal/useModal/index.d.ts +16 -23
- package/lib/cjs/navigation/Footer.d.ts +1 -1
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/select/index.d.ts +1 -1
- package/lib/cjs/select/index.js +27 -24
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -1
- package/lib/cjs/table/HeadTable.d.ts +2 -1
- package/lib/cjs/table/HeadTable.js +2 -1
- package/lib/cjs/table/Table.js +2 -0
- package/lib/cjs/table/interface.d.ts +1 -1
- package/lib/cjs/timeline/index.d.ts +1 -1
- package/lib/cjs/timeline/item.d.ts +1 -1
- package/lib/es/anchor/link.d.ts +2 -2
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/autoComplete/index.js +1 -1
- package/lib/es/avatar/interface.d.ts +2 -2
- package/lib/es/badge/index.d.ts +1 -1
- package/lib/es/banner/index.d.ts +4 -4
- package/lib/es/breadcrumb/bread-context.d.ts +1 -1
- package/lib/es/card/cardGroup.d.ts +1 -1
- package/lib/es/card/index.d.ts +1 -1
- package/lib/es/cascader/index.d.ts +1 -1
- package/lib/es/collapse/index.d.ts +1 -1
- package/lib/es/collapse/item.d.ts +1 -1
- package/lib/es/collapsible/index.d.ts +1 -1
- package/lib/es/descriptions/item.d.ts +1 -1
- package/lib/es/empty/index.d.ts +1 -1
- package/lib/es/form/errorMessage.d.ts +1 -1
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/form/label.d.ts +1 -1
- package/lib/es/form/section.d.ts +2 -2
- package/lib/es/form/slot.d.ts +1 -1
- package/lib/es/layout/Sider.d.ts +1 -1
- package/lib/es/list/index.d.ts +1 -1
- package/lib/es/list/item.d.ts +1 -1
- package/lib/es/modal/Modal.d.ts +5 -5
- package/lib/es/modal/ModalContent.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +4 -2
- package/lib/es/modal/confirm.js +1 -1
- package/lib/es/modal/useModal/index.d.ts +16 -23
- package/lib/es/navigation/Footer.d.ts +1 -1
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/select/index.d.ts +1 -1
- package/lib/es/select/index.js +23 -21
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -1
- package/lib/es/table/HeadTable.d.ts +2 -1
- package/lib/es/table/HeadTable.js +2 -1
- package/lib/es/table/Table.js +2 -0
- package/lib/es/table/interface.d.ts +1 -1
- package/lib/es/timeline/index.d.ts +1 -1
- package/lib/es/timeline/item.d.ts +1 -1
- package/list/index.tsx +1 -1
- package/list/item.tsx +1 -1
- package/modal/Modal.tsx +7 -7
- package/modal/ModalContent.tsx +1 -1
- package/modal/confirm.tsx +10 -11
- package/modal/useModal/index.tsx +9 -1
- package/navigation/Footer.tsx +2 -2
- package/package.json +9 -9
- package/radio/radioGroup.tsx +1 -1
- package/select/index.tsx +4 -2
- package/sideSheet/SideSheetContent.tsx +1 -1
- package/table/HeadTable.tsx +3 -1
- package/table/Table.tsx +2 -0
- package/table/_story/v2/FixedOnHeaderRow/index.jsx +134 -0
- package/table/_story/v2/index.js +2 -1
- package/table/interface.ts +1 -1
- package/timeline/index.tsx +1 -1
- package/timeline/item.tsx +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
|
|
2
|
+
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
|
|
3
3
|
export interface HeadTableProps {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
anyColumnFixed?: boolean;
|
|
@@ -15,6 +15,7 @@ export interface HeadTableProps {
|
|
|
15
15
|
selectedRowKeysSet: Set<any>;
|
|
16
16
|
showHeader?: boolean;
|
|
17
17
|
onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
|
|
18
|
+
onHeaderRow?: OnHeaderRow<any>;
|
|
18
19
|
}
|
|
19
20
|
declare const _default: React.ForwardRefExoticComponent<Pick<HeadTableProps, keyof HeadTableProps> & React.RefAttributes<HTMLDivElement>>;
|
|
20
21
|
export default _default;
|
|
@@ -96,7 +96,8 @@ HeadTable.propTypes = {
|
|
|
96
96
|
}),
|
|
97
97
|
selectedRowKeysSet: PropTypes.instanceOf(_Set).isRequired,
|
|
98
98
|
showHeader: PropTypes.bool,
|
|
99
|
-
onDidUpdate: PropTypes.func
|
|
99
|
+
onDidUpdate: PropTypes.func,
|
|
100
|
+
onHeaderRow: PropTypes.func
|
|
100
101
|
};
|
|
101
102
|
HeadTable.defaultProps = {
|
|
102
103
|
handleBodyScroll: _noop
|
package/lib/es/table/Table.js
CHANGED
|
@@ -658,6 +658,7 @@ class Table extends BaseComponent {
|
|
|
658
658
|
components,
|
|
659
659
|
headerRef,
|
|
660
660
|
bodyRef,
|
|
661
|
+
onHeaderRow,
|
|
661
662
|
rowSelection,
|
|
662
663
|
dataSource,
|
|
663
664
|
bodyHasScrollBar,
|
|
@@ -678,6 +679,7 @@ class Table extends BaseComponent {
|
|
|
678
679
|
scroll: scroll,
|
|
679
680
|
showHeader: showHeader,
|
|
680
681
|
selectedRowKeysSet: selectedRowKeysSet,
|
|
682
|
+
onHeaderRow: onHeaderRow,
|
|
681
683
|
dataSource: dataSource,
|
|
682
684
|
bodyHasScrollBar: bodyHasScrollBar
|
|
683
685
|
}) : null;
|
|
@@ -211,7 +211,7 @@ export declare type GetCheckboxProps<RecordType> = (record: RecordType) => Check
|
|
|
211
211
|
export declare type RowSelectionOnChange<RecordType> = (selectedRowKeys?: (string | number)[], selectedRows?: RecordType[]) => void;
|
|
212
212
|
export declare type RowSelectionOnSelect<RecordType> = (record?: RecordType, selected?: boolean, selectedRows?: RecordType[], nativeEvent?: React.MouseEvent) => void;
|
|
213
213
|
export declare type RowSelectionOnSelectAll<RecordType> = (selected?: boolean, selectedRows?: RecordType[], changedRows?: RecordType[]) => void;
|
|
214
|
-
export declare type ExpandIcon = ((expanded?: boolean) => React.ReactNode) | React.ReactNode
|
|
214
|
+
export declare type ExpandIcon = ((expanded?: boolean) => React.ReactNode) | React.ReactNode;
|
|
215
215
|
export declare type ExpandedRowRender<RecordType> = (record?: RecordType, index?: number, expanded?: boolean) => React.ReactNode;
|
|
216
216
|
export declare type Footer<RecordType> = ReactNode | ((pageData?: RecordType[]) => React.ReactNode);
|
|
217
217
|
export declare type FormatPageText = ((pageInfo?: {
|
|
@@ -11,7 +11,7 @@ export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'>
|
|
|
11
11
|
className?: string;
|
|
12
12
|
style?: React.CSSProperties;
|
|
13
13
|
dataSource?: Data[];
|
|
14
|
-
children?: React.ReactNode
|
|
14
|
+
children?: React.ReactNode;
|
|
15
15
|
}
|
|
16
16
|
declare class Timeline extends PureComponent<TimelineProps> {
|
|
17
17
|
static contextType: React.Context<import("../configProvider/context").ContextValue>;
|
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
|
|
4
4
|
export interface TimelineItemProps {
|
|
5
5
|
color?: string;
|
|
6
|
-
children?: React.ReactNode
|
|
6
|
+
children?: React.ReactNode;
|
|
7
7
|
time?: React.ReactNode;
|
|
8
8
|
type?: 'default' | 'ongoing' | 'success' | 'warning' | 'error';
|
|
9
9
|
dot?: React.ReactNode;
|
package/list/index.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export { ListItemProps } from './item';
|
|
|
17
17
|
export interface ListProps<T> {
|
|
18
18
|
style?: React.CSSProperties;
|
|
19
19
|
className?: string;
|
|
20
|
-
children?: React.ReactNode
|
|
20
|
+
children?: React.ReactNode;
|
|
21
21
|
bordered?: boolean;
|
|
22
22
|
footer?: React.ReactNode;
|
|
23
23
|
header?: React.ReactNode;
|
package/list/item.tsx
CHANGED
|
@@ -12,7 +12,7 @@ export interface ListItemProps {
|
|
|
12
12
|
main?: React.ReactNode;
|
|
13
13
|
align?: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
|
14
14
|
className?: string;
|
|
15
|
-
children?: React.ReactNode
|
|
15
|
+
children?: React.ReactNode;
|
|
16
16
|
style?: React.CSSProperties;
|
|
17
17
|
onClick?: React.MouseEventHandler<HTMLLIElement>;
|
|
18
18
|
onRightClick?: React.MouseEventHandler<HTMLLIElement>;
|
package/modal/Modal.tsx
CHANGED
|
@@ -23,7 +23,7 @@ export type Directions = 'ltr' | 'rtl';
|
|
|
23
23
|
|
|
24
24
|
export interface ModalReactProps extends ModalProps {
|
|
25
25
|
cancelButtonProps?: ButtonProps;
|
|
26
|
-
children?: React.ReactNode
|
|
26
|
+
children?: React.ReactNode;
|
|
27
27
|
okButtonProps?: ButtonProps;
|
|
28
28
|
bodyStyle?: CSSProperties;
|
|
29
29
|
maskStyle?: CSSProperties;
|
|
@@ -50,7 +50,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
50
50
|
centered: PropTypes.bool,
|
|
51
51
|
visible: PropTypes.bool,
|
|
52
52
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
53
|
-
height:
|
|
53
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
54
54
|
confirmLoading: PropTypes.bool,
|
|
55
55
|
cancelLoading: PropTypes.bool,
|
|
56
56
|
okText: PropTypes.string,
|
|
@@ -193,23 +193,23 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
193
193
|
|
|
194
194
|
|
|
195
195
|
static info = function (props: ModalReactProps) {
|
|
196
|
-
return confirm(withInfo(props));
|
|
196
|
+
return confirm<ReturnType<typeof withInfo>>(withInfo(props));
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
static success = function (props: ModalReactProps) {
|
|
200
|
-
return confirm(withSuccess(props));
|
|
200
|
+
return confirm<ReturnType<typeof withSuccess>>(withSuccess(props));
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
static error = function (props: ModalReactProps) {
|
|
204
|
-
return confirm(withError(props));
|
|
204
|
+
return confirm<ReturnType<typeof withError>>(withError(props));
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
static warning = function (props: ModalReactProps) {
|
|
208
|
-
return confirm(withWarning(props));
|
|
208
|
+
return confirm<ReturnType<typeof withWarning>>(withWarning(props));
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
static confirm = function (props: ModalReactProps) {
|
|
212
|
-
return confirm(withConfirm(props));
|
|
212
|
+
return confirm<ReturnType<typeof withConfirm>>(withConfirm(props));
|
|
213
213
|
};
|
|
214
214
|
|
|
215
215
|
static destroyAll = function destroyAllFn() {
|
package/modal/ModalContent.tsx
CHANGED
|
@@ -21,7 +21,7 @@ let uuid = 0;
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
export interface ModalContentReactProps extends ModalContentProps {
|
|
24
|
-
children?: React.ReactNode
|
|
24
|
+
children?: React.ReactNode;
|
|
25
25
|
}
|
|
26
26
|
export default class ModalContent extends BaseComponent<ModalContentReactProps, ModalContentState> {
|
|
27
27
|
static contextType = ConfigContext;
|
package/modal/confirm.tsx
CHANGED
|
@@ -5,14 +5,14 @@ import ConfirmModal from './ConfirmModal';
|
|
|
5
5
|
|
|
6
6
|
import '@douyinfe/semi-foundation/modal/modal.scss';
|
|
7
7
|
import { get } from 'lodash';
|
|
8
|
-
import {
|
|
8
|
+
import { IconAlertCircle, IconAlertTriangle, IconHelpCircle, IconInfoCircle, IconTickCircle } from '@douyinfe/semi-icons';
|
|
9
9
|
import { Motion } from '../_base/base';
|
|
10
10
|
|
|
11
|
-
export interface ConfirmProps extends ModalReactProps{
|
|
11
|
+
export interface ConfirmProps extends ModalReactProps {
|
|
12
12
|
type: 'success' | 'info' | 'warning' | 'error' | 'confirm';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export default function confirm(props: ConfirmProps) {
|
|
15
|
+
export default function confirm<T>(props: ConfirmProps) {
|
|
16
16
|
// create a dom in adapter?
|
|
17
17
|
const div = document.createElement('div');
|
|
18
18
|
document.body.appendChild(div);
|
|
@@ -51,7 +51,7 @@ export default function confirm(props: ConfirmProps) {
|
|
|
51
51
|
} : false;
|
|
52
52
|
|
|
53
53
|
function render(renderProps: ConfirmProps) {
|
|
54
|
-
ReactDOM.render(<ConfirmModal {...renderProps} motion={mergedMotion}
|
|
54
|
+
ReactDOM.render(<ConfirmModal {...renderProps} motion={mergedMotion}/>, div);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function close() {
|
|
@@ -62,7 +62,7 @@ export default function confirm(props: ConfirmProps) {
|
|
|
62
62
|
render(currentConfig);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
function update(newConfig: ConfirmProps) {
|
|
65
|
+
function update(newConfig: T extends { type: Exclude<ConfirmProps['type'], 'confirm'> } ? ModalReactProps : ConfirmProps) {
|
|
66
66
|
currentConfig = {
|
|
67
67
|
...currentConfig,
|
|
68
68
|
...newConfig,
|
|
@@ -79,11 +79,10 @@ export default function confirm(props: ConfirmProps) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
|
|
83
82
|
export function withInfo(props: ModalReactProps) {
|
|
84
83
|
return {
|
|
85
84
|
type: 'info' as const,
|
|
86
|
-
icon: <IconInfoCircle
|
|
85
|
+
icon: <IconInfoCircle/>,
|
|
87
86
|
...props
|
|
88
87
|
};
|
|
89
88
|
}
|
|
@@ -91,7 +90,7 @@ export function withInfo(props: ModalReactProps) {
|
|
|
91
90
|
export function withSuccess(props: ModalReactProps) {
|
|
92
91
|
return {
|
|
93
92
|
type: 'success' as const,
|
|
94
|
-
icon: <IconTickCircle
|
|
93
|
+
icon: <IconTickCircle/>,
|
|
95
94
|
...props
|
|
96
95
|
};
|
|
97
96
|
}
|
|
@@ -99,7 +98,7 @@ export function withSuccess(props: ModalReactProps) {
|
|
|
99
98
|
export function withWarning(props: ModalReactProps) {
|
|
100
99
|
return {
|
|
101
100
|
type: 'warning' as const,
|
|
102
|
-
icon: <IconAlertTriangle
|
|
101
|
+
icon: <IconAlertTriangle/>,
|
|
103
102
|
...props
|
|
104
103
|
};
|
|
105
104
|
}
|
|
@@ -107,7 +106,7 @@ export function withWarning(props: ModalReactProps) {
|
|
|
107
106
|
export function withError(props: ModalReactProps) {
|
|
108
107
|
return {
|
|
109
108
|
type: 'error' as const,
|
|
110
|
-
icon: <IconAlertCircle
|
|
109
|
+
icon: <IconAlertCircle/>,
|
|
111
110
|
...props
|
|
112
111
|
};
|
|
113
112
|
}
|
|
@@ -115,7 +114,7 @@ export function withError(props: ModalReactProps) {
|
|
|
115
114
|
export function withConfirm(props: ModalReactProps) {
|
|
116
115
|
return {
|
|
117
116
|
type: 'confirm' as const,
|
|
118
|
-
icon: <IconHelpCircle
|
|
117
|
+
icon: <IconHelpCircle/>,
|
|
119
118
|
...props
|
|
120
119
|
};
|
|
121
120
|
}
|
package/modal/useModal/index.tsx
CHANGED
|
@@ -19,7 +19,15 @@ function usePatchElement(): ([ReactNode[], (element: ReactNode) => () => void])
|
|
|
19
19
|
return [elements, patchElement];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
type UseModalReturnHooksType = (config: ModalReactProps) => { destroy: () => void, update: (newConfig: ConfirmProps) => void };
|
|
23
|
+
|
|
24
|
+
export default function useModal(): [{
|
|
25
|
+
info: UseModalReturnHooksType,
|
|
26
|
+
success: UseModalReturnHooksType,
|
|
27
|
+
error:UseModalReturnHooksType,
|
|
28
|
+
warning: UseModalReturnHooksType,
|
|
29
|
+
confirm: UseModalReturnHooksType
|
|
30
|
+
}, ReactNode] {
|
|
23
31
|
const [elements, patchElement] = usePatchElement();
|
|
24
32
|
|
|
25
33
|
// eslint-disable-next-line max-len
|
package/navigation/Footer.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import NavContext, { NavContextType } from './nav-context';
|
|
|
10
10
|
import { BaseProps } from '../_base/baseComponent';
|
|
11
11
|
|
|
12
12
|
export interface NavFooterProps extends BaseProps {
|
|
13
|
-
collapseButton?: React.ReactNode
|
|
13
|
+
collapseButton?: React.ReactNode;
|
|
14
14
|
collapseText?: (collapsed?: boolean) => React.ReactNode;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@ export default class NavFooter extends PureComponent<NavFooterProps> {
|
|
|
28
28
|
static defaultProps = {
|
|
29
29
|
collapseButton: false,
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
context: NavContextType;
|
|
33
33
|
|
|
34
34
|
renderCollapseButton = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.11.0
|
|
3
|
+
"version": "2.11.0",
|
|
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.11.0
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.11.0
|
|
19
|
-
"@douyinfe/semi-foundation": "2.11.0
|
|
20
|
-
"@douyinfe/semi-icons": "2.11.0
|
|
21
|
-
"@douyinfe/semi-illustrations": "2.11.0
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.11.0
|
|
17
|
+
"@douyinfe/semi-animation": "2.11.0",
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.11.0",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.11.0",
|
|
20
|
+
"@douyinfe/semi-icons": "2.11.0",
|
|
21
|
+
"@douyinfe/semi-illustrations": "2.11.0",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.11.0",
|
|
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": "f7a5cae3d9190faff4a08c5a4da23927a1ab86e5",
|
|
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.11.0
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.11.0",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@types/lodash": "^4.14.176",
|
|
81
81
|
"babel-loader": "^8.2.2",
|
package/radio/radioGroup.tsx
CHANGED
|
@@ -30,7 +30,7 @@ export type RadioGroupProps = {
|
|
|
30
30
|
value?: string | number;
|
|
31
31
|
onChange?: (event: RadioChangeEvent) => void;
|
|
32
32
|
className?: string;
|
|
33
|
-
children?: React.ReactNode
|
|
33
|
+
children?: React.ReactNode;
|
|
34
34
|
style?: React.CSSProperties;
|
|
35
35
|
direction?: ArrayElement<typeof strings.DIRECTION_SET>;
|
|
36
36
|
mode?: RadioMode;
|
package/select/index.tsx
CHANGED
|
@@ -28,6 +28,7 @@ import { isSemiIcon } from '../_utils';
|
|
|
28
28
|
import { Subtract } from 'utility-types';
|
|
29
29
|
|
|
30
30
|
import warning from '@douyinfe/semi-foundation/utils/warning';
|
|
31
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/utils/uuid';
|
|
31
32
|
|
|
32
33
|
import '@douyinfe/semi-foundation/select/select.scss';
|
|
33
34
|
import { Locale } from '../locale/interface';
|
|
@@ -50,7 +51,7 @@ type ExcludeInputType = {
|
|
|
50
51
|
type OnChangeValueType = string | number | Record<string, any>;
|
|
51
52
|
export interface optionRenderProps {
|
|
52
53
|
key?: any;
|
|
53
|
-
label?:
|
|
54
|
+
label?: React.ReactNode;
|
|
54
55
|
value?: string | number;
|
|
55
56
|
style?: React.CSSProperties;
|
|
56
57
|
className?: string;
|
|
@@ -340,7 +341,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
340
341
|
isHovering: false,
|
|
341
342
|
};
|
|
342
343
|
/* Generate random string */
|
|
343
|
-
this.selectOptionListID =
|
|
344
|
+
this.selectOptionListID = '';
|
|
344
345
|
this.virtualizeListRef = React.createRef();
|
|
345
346
|
this.inputRef = React.createRef();
|
|
346
347
|
this.triggerRef = React.createRef();
|
|
@@ -559,6 +560,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
559
560
|
|
|
560
561
|
componentDidMount() {
|
|
561
562
|
this.foundation.init();
|
|
563
|
+
this.selectOptionListID = getUuidShort();
|
|
562
564
|
}
|
|
563
565
|
|
|
564
566
|
componentWillUnmount() {
|
package/table/HeadTable.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
|
|
7
7
|
import ColGroup from './ColGroup';
|
|
8
8
|
import TableHeader from './TableHeader';
|
|
9
|
-
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
|
|
9
|
+
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
|
|
10
10
|
|
|
11
11
|
export interface HeadTableProps {
|
|
12
12
|
[x: string]: any;
|
|
@@ -23,6 +23,7 @@ export interface HeadTableProps {
|
|
|
23
23
|
selectedRowKeysSet: Set<any>;
|
|
24
24
|
showHeader?: boolean;
|
|
25
25
|
onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
|
|
26
|
+
onHeaderRow?: OnHeaderRow<any>;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -46,6 +47,7 @@ class HeadTable extends React.PureComponent<HeadTableProps> {
|
|
|
46
47
|
selectedRowKeysSet: PropTypes.instanceOf(Set).isRequired, // Useful when update is selected
|
|
47
48
|
showHeader: PropTypes.bool,
|
|
48
49
|
onDidUpdate: PropTypes.func,
|
|
50
|
+
onHeaderRow: PropTypes.func,
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
static defaultProps = {
|
package/table/Table.tsx
CHANGED
|
@@ -1089,6 +1089,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1089
1089
|
components,
|
|
1090
1090
|
headerRef,
|
|
1091
1091
|
bodyRef,
|
|
1092
|
+
onHeaderRow,
|
|
1092
1093
|
rowSelection,
|
|
1093
1094
|
dataSource,
|
|
1094
1095
|
bodyHasScrollBar,
|
|
@@ -1110,6 +1111,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1110
1111
|
scroll={scroll}
|
|
1111
1112
|
showHeader={showHeader}
|
|
1112
1113
|
selectedRowKeysSet={selectedRowKeysSet}
|
|
1114
|
+
onHeaderRow={onHeaderRow}
|
|
1113
1115
|
dataSource={dataSource}
|
|
1114
1116
|
bodyHasScrollBar={bodyHasScrollBar}
|
|
1115
1117
|
/>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React, { useState, useMemo, useEffect } from 'react';
|
|
2
|
+
import { Table, Avatar, Toast } from '@douyinfe/semi-ui';
|
|
3
|
+
import * as dateFns from 'date-fns';
|
|
4
|
+
|
|
5
|
+
App.storyName = 'fix onHeaderRow';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* test with cypress
|
|
9
|
+
*/
|
|
10
|
+
export default function App() {
|
|
11
|
+
const [dataSource, setData] = useState([]);
|
|
12
|
+
const DAY = 24 * 60 * 60 * 1000;
|
|
13
|
+
const figmaIconUrl = 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/figma-icon.png';
|
|
14
|
+
|
|
15
|
+
const columns = [
|
|
16
|
+
{
|
|
17
|
+
title: '标题',
|
|
18
|
+
dataIndex: 'name',
|
|
19
|
+
fixed: true,
|
|
20
|
+
width: 250,
|
|
21
|
+
render: (text, record, index) => {
|
|
22
|
+
return (
|
|
23
|
+
<div>
|
|
24
|
+
<Avatar size="small" shape="square" src={figmaIconUrl} style={{ marginRight: 12 }}></Avatar>
|
|
25
|
+
{text}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
filters: [
|
|
30
|
+
{
|
|
31
|
+
text: 'Semi Design 设计稿',
|
|
32
|
+
value: 'Semi Design 设计稿',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
text: 'Semi Pro 设计稿',
|
|
36
|
+
value: 'Semi Pro 设计稿',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
onFilter: (value, record) => record.name.includes(value),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: '大小',
|
|
43
|
+
dataIndex: 'size',
|
|
44
|
+
width: 200,
|
|
45
|
+
sorter: (a, b) => (a.size - b.size > 0 ? 1 : -1),
|
|
46
|
+
render: text => `${text} KB`,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: '所有者',
|
|
50
|
+
dataIndex: 'owner',
|
|
51
|
+
width: 200,
|
|
52
|
+
render: (text, record, index) => {
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<Avatar size="small" color={record.avatarBg} style={{ marginRight: 4 }}>
|
|
56
|
+
{typeof text === 'string' && text.slice(0, 1)}
|
|
57
|
+
</Avatar>
|
|
58
|
+
{text}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: '更新日期',
|
|
65
|
+
dataIndex: 'updateTime',
|
|
66
|
+
width: 200,
|
|
67
|
+
sorter: (a, b) => (a.updateTime - b.updateTime > 0 ? 1 : -1),
|
|
68
|
+
render: value => {
|
|
69
|
+
return dateFns.format(new Date(value), 'yyyy-MM-dd');
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: '',
|
|
74
|
+
dataIndex: 'operate',
|
|
75
|
+
fixed: 'right',
|
|
76
|
+
align: 'center',
|
|
77
|
+
width: 100,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const scroll = useMemo(() => ({ y: 300, x: 1200 }), []);
|
|
82
|
+
const rowSelection = useMemo(
|
|
83
|
+
() => ({
|
|
84
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
85
|
+
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
|
86
|
+
},
|
|
87
|
+
getCheckboxProps: record => ({
|
|
88
|
+
disabled: record.name === 'Michael James', // Column configuration not to be checked
|
|
89
|
+
name: record.name,
|
|
90
|
+
}),
|
|
91
|
+
fixed: true,
|
|
92
|
+
}),
|
|
93
|
+
[]
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const getData = () => {
|
|
97
|
+
const data = [];
|
|
98
|
+
for (let i = 0; i < 46; i++) {
|
|
99
|
+
const isSemiDesign = i % 2 === 0;
|
|
100
|
+
const randomNumber = (i * 1000) % 199;
|
|
101
|
+
data.push({
|
|
102
|
+
key: '' + i,
|
|
103
|
+
name: isSemiDesign ? `Semi Design 设计稿${i}.fig` : `Semi Pro 设计稿${i}.fig`,
|
|
104
|
+
owner: isSemiDesign ? '姜鹏志' : '郝宣',
|
|
105
|
+
size: randomNumber,
|
|
106
|
+
updateTime: new Date().valueOf() + randomNumber * DAY,
|
|
107
|
+
avatarBg: isSemiDesign ? 'grey' : 'red',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return data;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
const data = getData();
|
|
115
|
+
setData(data);
|
|
116
|
+
}, []);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<Table
|
|
120
|
+
onHeaderRow={(columns, index) => {
|
|
121
|
+
return {
|
|
122
|
+
onClick: event => {
|
|
123
|
+
console.log(event);
|
|
124
|
+
Toast.info('header click');
|
|
125
|
+
}, // 点击表头行
|
|
126
|
+
};
|
|
127
|
+
}}
|
|
128
|
+
columns={columns}
|
|
129
|
+
dataSource={dataSource}
|
|
130
|
+
rowSelection={rowSelection}
|
|
131
|
+
scroll={scroll}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
}
|
package/table/_story/v2/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { default as FixedZIndex } from './FixedZIndex';
|
|
|
4
4
|
export { default as FixedHeaderMerge } from './FixedHeaderMerge';
|
|
5
5
|
export { default as FixedResizable } from './FixedResizable';
|
|
6
6
|
export { default as FixedExpandedRow } from './FixedExpandedRow';
|
|
7
|
-
export { default as FixedMemoryLeak } from './FixedMemoryLeak';
|
|
7
|
+
export { default as FixedMemoryLeak } from './FixedMemoryLeak';
|
|
8
|
+
export { default as FixedOnHeaderRow } from './FixedOnHeaderRow';
|
package/table/interface.ts
CHANGED
|
@@ -240,7 +240,7 @@ export type RowSelectionOnSelect<RecordType> = (
|
|
|
240
240
|
nativeEvent?: React.MouseEvent
|
|
241
241
|
) => void;
|
|
242
242
|
export type RowSelectionOnSelectAll<RecordType> = (selected?: boolean, selectedRows?: RecordType[], changedRows?: RecordType[]) => void;
|
|
243
|
-
export type ExpandIcon = ((expanded?: boolean) => React.ReactNode) | React.ReactNode
|
|
243
|
+
export type ExpandIcon = ((expanded?: boolean) => React.ReactNode) | React.ReactNode;
|
|
244
244
|
export type ExpandedRowRender<RecordType> = (record?: RecordType, index?: number, expanded?: boolean) => React.ReactNode;
|
|
245
245
|
export type Footer<RecordType> = ReactNode | ((pageData?: RecordType[]) => React.ReactNode);
|
|
246
246
|
export type FormatPageText = ((pageInfo?: { currentStart?: number; currentEnd?: number; total?: number }) => React.ReactNode) | boolean;
|
package/timeline/index.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'>
|
|
|
17
17
|
className?: string;
|
|
18
18
|
style?: React.CSSProperties;
|
|
19
19
|
dataSource?: Data[];
|
|
20
|
-
children?: React.ReactNode
|
|
20
|
+
children?: React.ReactNode;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const prefixCls = cssClasses.PREFIX;
|
package/timeline/item.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import '@douyinfe/semi-foundation/timeline/timeline.scss';
|
|
|
7
7
|
|
|
8
8
|
export interface TimelineItemProps {
|
|
9
9
|
color?: string;
|
|
10
|
-
children?: React.ReactNode
|
|
10
|
+
children?: React.ReactNode;
|
|
11
11
|
time?: React.ReactNode;
|
|
12
12
|
type?: 'default' | 'ongoing' | 'success' | 'warning' | 'error';
|
|
13
13
|
dot?: React.ReactNode;
|