@douyinfe/semi-ui 2.11.0-beta.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/navigation/Item.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/navigation/Item.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/navigation/Item.tsx +1 -1
- 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
package/lib/es/select/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import _noop from "lodash/noop";
|
|
|
4
4
|
import _isString from "lodash/isString";
|
|
5
5
|
import _isEqual from "lodash/isEqual";
|
|
6
6
|
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
7
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
8
7
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
9
8
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
10
9
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
@@ -13,6 +12,7 @@ import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array
|
|
|
13
12
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
14
13
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
15
14
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
15
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
16
16
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
17
17
|
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
18
18
|
|
|
@@ -43,13 +43,14 @@ import Trigger from '../trigger';
|
|
|
43
43
|
import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
|
|
44
44
|
import { isSemiIcon } from '../_utils';
|
|
45
45
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
46
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
46
47
|
import '@douyinfe/semi-foundation/lib/es/select/select.css';
|
|
47
48
|
const prefixcls = cssClasses.PREFIX;
|
|
48
49
|
const key = 0; // Notes: Use the label of the option as the identifier, that is, the option in Select, the value is allowed to be the same, but the label must be unique
|
|
49
50
|
|
|
50
51
|
class Select extends BaseComponent {
|
|
51
52
|
constructor(props) {
|
|
52
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7
|
|
53
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7;
|
|
53
54
|
|
|
54
55
|
super(props);
|
|
55
56
|
|
|
@@ -71,19 +72,19 @@ class Select extends BaseComponent {
|
|
|
71
72
|
};
|
|
72
73
|
/* Generate random string */
|
|
73
74
|
|
|
74
|
-
this.selectOptionListID =
|
|
75
|
+
this.selectOptionListID = '';
|
|
75
76
|
this.virtualizeListRef = /*#__PURE__*/React.createRef();
|
|
76
77
|
this.inputRef = /*#__PURE__*/React.createRef();
|
|
77
78
|
this.triggerRef = /*#__PURE__*/React.createRef();
|
|
78
79
|
this.optionsRef = /*#__PURE__*/React.createRef();
|
|
79
80
|
this.clickOutsideHandler = null;
|
|
80
|
-
this.onSelect = _bindInstanceProperty(
|
|
81
|
-
this.onClear = _bindInstanceProperty(
|
|
82
|
-
this.onMouseEnter = _bindInstanceProperty(
|
|
83
|
-
this.onMouseLeave = _bindInstanceProperty(
|
|
84
|
-
this.renderOption = _bindInstanceProperty(
|
|
85
|
-
this.onKeyPress = _bindInstanceProperty(
|
|
86
|
-
this.onClearBtnEnterPress = _bindInstanceProperty(
|
|
81
|
+
this.onSelect = _bindInstanceProperty(_context = this.onSelect).call(_context, this);
|
|
82
|
+
this.onClear = _bindInstanceProperty(_context2 = this.onClear).call(_context2, this);
|
|
83
|
+
this.onMouseEnter = _bindInstanceProperty(_context3 = this.onMouseEnter).call(_context3, this);
|
|
84
|
+
this.onMouseLeave = _bindInstanceProperty(_context4 = this.onMouseLeave).call(_context4, this);
|
|
85
|
+
this.renderOption = _bindInstanceProperty(_context5 = this.renderOption).call(_context5, this);
|
|
86
|
+
this.onKeyPress = _bindInstanceProperty(_context6 = this.onKeyPress).call(_context6, this);
|
|
87
|
+
this.onClearBtnEnterPress = _bindInstanceProperty(_context7 = this.onClearBtnEnterPress).call(_context7, this);
|
|
87
88
|
this.foundation = new SelectFoundation(this.adapter);
|
|
88
89
|
warning('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
|
|
89
90
|
warning('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
|
|
@@ -286,18 +287,18 @@ class Select extends BaseComponent {
|
|
|
286
287
|
} catch (error) {}
|
|
287
288
|
},
|
|
288
289
|
updateScrollTop: index => {
|
|
289
|
-
var
|
|
290
|
+
var _context9, _context10;
|
|
290
291
|
|
|
291
292
|
// eslint-disable-next-line max-len
|
|
292
293
|
let optionClassName = ".".concat(prefixcls, "-option-selected");
|
|
293
294
|
|
|
294
295
|
if (index !== undefined) {
|
|
295
|
-
var
|
|
296
|
+
var _context8;
|
|
296
297
|
|
|
297
|
-
optionClassName = _concatInstanceProperty(
|
|
298
|
+
optionClassName = _concatInstanceProperty(_context8 = ".".concat(prefixcls, "-option:nth-child(")).call(_context8, index, ")");
|
|
298
299
|
}
|
|
299
300
|
|
|
300
|
-
let destNode = document.querySelector(_concatInstanceProperty(
|
|
301
|
+
let destNode = document.querySelector(_concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " ")).call(_context9, optionClassName));
|
|
301
302
|
|
|
302
303
|
if (_Array$isArray(destNode)) {
|
|
303
304
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -318,6 +319,7 @@ class Select extends BaseComponent {
|
|
|
318
319
|
|
|
319
320
|
componentDidMount() {
|
|
320
321
|
this.foundation.init();
|
|
322
|
+
this.selectOptionListID = getUuidShort();
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
componentWillUnmount() {
|
|
@@ -325,11 +327,11 @@ class Select extends BaseComponent {
|
|
|
325
327
|
}
|
|
326
328
|
|
|
327
329
|
componentDidUpdate(prevProps, prevState) {
|
|
328
|
-
var
|
|
330
|
+
var _context11, _context12;
|
|
329
331
|
|
|
330
|
-
const prevChildrenKeys = _mapInstanceProperty(
|
|
332
|
+
const prevChildrenKeys = _mapInstanceProperty(_context11 = React.Children.toArray(prevProps.children)).call(_context11, child => child.key);
|
|
331
333
|
|
|
332
|
-
const nowChildrenKeys = _mapInstanceProperty(
|
|
334
|
+
const nowChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(this.props.children)).call(_context12, child => child.key);
|
|
333
335
|
|
|
334
336
|
let isOptionsChanged = false;
|
|
335
337
|
|
|
@@ -575,7 +577,7 @@ class Select extends BaseComponent {
|
|
|
575
577
|
}
|
|
576
578
|
|
|
577
579
|
renderOptions(children) {
|
|
578
|
-
var
|
|
580
|
+
var _context13;
|
|
579
581
|
|
|
580
582
|
const {
|
|
581
583
|
dropdownMinWidth,
|
|
@@ -613,7 +615,7 @@ class Select extends BaseComponent {
|
|
|
613
615
|
});
|
|
614
616
|
const isEmpty = !options.length || !_someInstanceProperty(options).call(options, item => item._show);
|
|
615
617
|
return /*#__PURE__*/React.createElement("div", {
|
|
616
|
-
id: _concatInstanceProperty(
|
|
618
|
+
id: _concatInstanceProperty(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
|
|
617
619
|
className: dropdownClassName,
|
|
618
620
|
style: style
|
|
619
621
|
}, outerTopSlot, /*#__PURE__*/React.createElement("div", {
|
|
@@ -847,7 +849,7 @@ class Select extends BaseComponent {
|
|
|
847
849
|
}
|
|
848
850
|
|
|
849
851
|
renderSelection() {
|
|
850
|
-
var
|
|
852
|
+
var _context14;
|
|
851
853
|
|
|
852
854
|
const {
|
|
853
855
|
disabled,
|
|
@@ -931,7 +933,7 @@ class Select extends BaseComponent {
|
|
|
931
933
|
role: "combobox",
|
|
932
934
|
"aria-disabled": disabled,
|
|
933
935
|
"aria-expanded": isOpen,
|
|
934
|
-
"aria-controls": _concatInstanceProperty(
|
|
936
|
+
"aria-controls": _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
|
|
935
937
|
"aria-haspopup": "listbox",
|
|
936
938
|
"aria-label": "select value",
|
|
937
939
|
"aria-invalid": this.props['aria-invalid'],
|
|
@@ -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/navigation/Item.tsx
CHANGED
|
@@ -29,7 +29,7 @@ export interface NavItemProps extends ItemProps, BaseProps {
|
|
|
29
29
|
itemKey?: React.ReactText;
|
|
30
30
|
level?: number;
|
|
31
31
|
link?: string;
|
|
32
|
-
linkOptions?: React.
|
|
32
|
+
linkOptions?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
33
33
|
text?: React.ReactNode;
|
|
34
34
|
tooltipHideDelay?: number;
|
|
35
35
|
tooltipShowDelay?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation": "2.11.
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.11.
|
|
19
|
-
"@douyinfe/semi-foundation": "2.11.
|
|
20
|
-
"@douyinfe/semi-icons": "2.11.
|
|
21
|
-
"@douyinfe/semi-illustrations": "2.11.
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.11.
|
|
17
|
+
"@douyinfe/semi-animation": "2.11.1",
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.11.1",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.11.1",
|
|
20
|
+
"@douyinfe/semi-icons": "2.11.1",
|
|
21
|
+
"@douyinfe/semi-illustrations": "2.11.1",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.11.1",
|
|
23
23
|
"@types/react-window": "^1.8.2",
|
|
24
24
|
"async-validator": "^3.5.0",
|
|
25
25
|
"classnames": "^2.2.6",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "7adb0c73f4d20ffdcf67c489a1dfc88a16249ad8",
|
|
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.
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.11.1",
|
|
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
|
/>
|