@douyinfe/semi-ui 2.53.3-alpha.0 → 2.54.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 +9 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +193 -64
- 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 +1 -1
- 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/cascader/index.d.ts +3 -0
- package/lib/cjs/cascader/index.js +11 -4
- package/lib/cjs/collapsible/index.d.ts +1 -0
- package/lib/cjs/collapsible/index.js +4 -3
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/descriptions/descriptions-context.d.ts +2 -0
- package/lib/cjs/descriptions/index.d.ts +17 -4
- package/lib/cjs/descriptions/index.js +52 -16
- package/lib/cjs/descriptions/item.d.ts +1 -0
- package/lib/cjs/descriptions/item.js +20 -13
- package/lib/cjs/form/baseForm.d.ts +2 -2
- package/lib/cjs/form/field.d.ts +2 -2
- package/lib/cjs/image/interface.d.ts +1 -0
- package/lib/cjs/image/previewInner.js +6 -0
- package/lib/cjs/input/index.d.ts +1 -1
- package/lib/cjs/input/inputGroup.d.ts +1 -1
- package/lib/cjs/modal/Modal.d.ts +4 -4
- package/lib/cjs/modal/Modal.js +12 -11
- package/lib/cjs/modal/confirm.d.ts +9 -9
- package/lib/cjs/rating/index.d.ts +1 -1
- package/lib/cjs/rating/item.d.ts +1 -1
- package/lib/cjs/switch/index.d.ts +1 -1
- package/lib/cjs/table/Table.d.ts +2 -2
- package/lib/cjs/table/index.d.ts +1 -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/toast/index.js +3 -0
- package/lib/cjs/typography/base.js +4 -4
- package/lib/cjs/typography/title.d.ts +2 -2
- package/lib/es/anchor/index.d.ts +1 -1
- 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/cascader/index.d.ts +3 -0
- package/lib/es/cascader/index.js +11 -4
- package/lib/es/collapsible/index.d.ts +1 -0
- package/lib/es/collapsible/index.js +4 -3
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/descriptions/descriptions-context.d.ts +2 -0
- package/lib/es/descriptions/index.d.ts +17 -4
- package/lib/es/descriptions/index.js +52 -14
- package/lib/es/descriptions/item.d.ts +1 -0
- package/lib/es/descriptions/item.js +20 -13
- package/lib/es/form/baseForm.d.ts +2 -2
- package/lib/es/form/field.d.ts +2 -2
- package/lib/es/image/interface.d.ts +1 -0
- package/lib/es/image/previewInner.js +6 -0
- package/lib/es/input/index.d.ts +1 -1
- package/lib/es/input/inputGroup.d.ts +1 -1
- package/lib/es/modal/Modal.d.ts +4 -4
- package/lib/es/modal/Modal.js +12 -11
- package/lib/es/modal/confirm.d.ts +9 -9
- package/lib/es/rating/index.d.ts +1 -1
- package/lib/es/rating/item.d.ts +1 -1
- package/lib/es/switch/index.d.ts +1 -1
- package/lib/es/table/Table.d.ts +2 -2
- package/lib/es/table/index.d.ts +1 -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/toast/index.js +3 -0
- package/lib/es/typography/base.js +4 -4
- package/lib/es/typography/title.d.ts +2 -2
- package/package.json +8 -8
|
@@ -143,19 +143,19 @@ export declare function withWarning(props: ModalReactProps): {
|
|
|
143
143
|
type: "warning";
|
|
144
144
|
};
|
|
145
145
|
export declare function withError(props: ModalReactProps): {
|
|
146
|
+
title?: React.ReactNode;
|
|
146
147
|
children?: React.ReactNode;
|
|
147
|
-
|
|
148
|
+
size?: import("@douyinfe/semi-foundation/lib/cjs/modal/modalFoundation").Size;
|
|
148
149
|
style?: React.CSSProperties;
|
|
149
150
|
className?: string;
|
|
151
|
+
motion?: boolean;
|
|
150
152
|
getPopupContainer?: () => HTMLElement;
|
|
151
153
|
footer?: React.ReactNode;
|
|
152
154
|
header?: React.ReactNode;
|
|
153
|
-
title?: React.ReactNode;
|
|
154
155
|
direction?: any;
|
|
155
156
|
mask?: boolean;
|
|
156
157
|
visible?: boolean;
|
|
157
158
|
zIndex?: number;
|
|
158
|
-
size?: import("@douyinfe/semi-foundation/lib/cjs/modal/modalFoundation").Size;
|
|
159
159
|
width?: string | number;
|
|
160
160
|
height?: string | number;
|
|
161
161
|
content?: React.ReactNode;
|
|
@@ -166,6 +166,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
166
166
|
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
167
167
|
closable?: boolean;
|
|
168
168
|
onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
169
|
+
lazyRender?: boolean;
|
|
169
170
|
bodyStyle?: React.CSSProperties;
|
|
170
171
|
cancelButtonProps?: import("../button").BaseButtonProps;
|
|
171
172
|
cancelText?: string;
|
|
@@ -180,7 +181,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
180
181
|
okType?: import("@douyinfe/semi-foundation/lib/cjs/modal/modalFoundation").OKType;
|
|
181
182
|
onOk?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
182
183
|
closeIcon?: React.ReactNode;
|
|
183
|
-
lazyRender?: boolean;
|
|
184
184
|
fullScreen?: boolean;
|
|
185
185
|
footerFill?: boolean;
|
|
186
186
|
type: "error";
|
|
@@ -205,12 +205,13 @@ export declare function withError(props: ModalReactProps): {
|
|
|
205
205
|
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
|
|
206
206
|
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
|
|
207
207
|
'aria-label'?: string;
|
|
208
|
+
title?: string;
|
|
209
|
+
name?: string;
|
|
210
|
+
value?: string | number | readonly string[];
|
|
208
211
|
onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
209
212
|
onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
210
|
-
value?: string | number | readonly string[];
|
|
211
213
|
form?: string;
|
|
212
214
|
slot?: string;
|
|
213
|
-
title?: string;
|
|
214
215
|
prefix?: string;
|
|
215
216
|
dangerouslySetInnerHTML?: {
|
|
216
217
|
__html: string | TrustedHTML;
|
|
@@ -379,7 +380,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
379
380
|
suppressHydrationWarning?: boolean;
|
|
380
381
|
accessKey?: string;
|
|
381
382
|
autoFocus?: boolean;
|
|
382
|
-
name?: string;
|
|
383
383
|
contextMenu?: string;
|
|
384
384
|
dir?: string;
|
|
385
385
|
draggable?: boolean | "true" | "false";
|
|
@@ -387,7 +387,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
387
387
|
translate?: "no" | "yes";
|
|
388
388
|
role?: React.AriaRole;
|
|
389
389
|
contentEditable?: "inherit" | (boolean | "true" | "false");
|
|
390
|
-
inputMode?: "
|
|
390
|
+
inputMode?: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal";
|
|
391
391
|
nonce?: string;
|
|
392
392
|
tabIndex?: number;
|
|
393
393
|
content?: string;
|
|
@@ -430,7 +430,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
430
430
|
'aria-current'?: boolean | "time" | "true" | "false" | "date" | "location" | "page" | "step";
|
|
431
431
|
'aria-details'?: string;
|
|
432
432
|
'aria-disabled'?: boolean | "true" | "false";
|
|
433
|
-
'aria-dropeffect'?: "
|
|
433
|
+
'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup";
|
|
434
434
|
'aria-errormessage'?: string;
|
|
435
435
|
'aria-flowto'?: string;
|
|
436
436
|
'aria-grabbed'?: boolean | "true" | "false";
|
|
@@ -69,7 +69,7 @@ export default class Rating extends BaseComponent<RatingProps, RatingState> {
|
|
|
69
69
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
70
70
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
71
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
72
|
-
size: PropTypes.Requireable<NonNullable<number | "
|
|
72
|
+
size: PropTypes.Requireable<NonNullable<number | "default" | "small">>;
|
|
73
73
|
tooltips: PropTypes.Requireable<string[]>;
|
|
74
74
|
id: PropTypes.Requireable<string>;
|
|
75
75
|
preventScroll: PropTypes.Requireable<boolean>;
|
package/lib/cjs/rating/item.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export default class Item extends BaseComponent<RatingItemProps, RatingItemState
|
|
|
40
40
|
disabled: PropTypes.Requireable<boolean>;
|
|
41
41
|
count: PropTypes.Requireable<number>;
|
|
42
42
|
ariaLabelPrefix: PropTypes.Requireable<string>;
|
|
43
|
-
size: PropTypes.Requireable<NonNullable<number | "
|
|
43
|
+
size: PropTypes.Requireable<NonNullable<number | "default" | "small">>;
|
|
44
44
|
'aria-describedby': PropTypes.Requireable<string>;
|
|
45
45
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
46
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -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
|
};
|
package/lib/cjs/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<"center" | "left" | "right">;
|
|
@@ -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;
|
package/lib/cjs/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<"center" | "left" | "right">;
|
|
@@ -97,7 +97,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
97
97
|
onAdd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
98
98
|
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
99
99
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
100
|
-
size: PropTypes.Requireable<"
|
|
100
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
101
101
|
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
102
102
|
prefix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
103
103
|
suffix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -133,7 +133,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
133
133
|
secondStep: PropTypes.Requireable<number>;
|
|
134
134
|
focusOnOpen: PropTypes.Requireable<boolean>;
|
|
135
135
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
136
|
-
size: PropTypes.Requireable<"
|
|
136
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
137
137
|
stopPropagation: PropTypes.Requireable<boolean>;
|
|
138
138
|
panels: PropTypes.Requireable<PropTypes.InferProps<{
|
|
139
139
|
panelHeader: 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
|
stopPropagation: import("prop-types").Requireable<boolean>;
|
|
54
54
|
panels: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
55
55
|
panelHeader: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
|
package/lib/cjs/toast/index.js
CHANGED
|
@@ -185,6 +185,9 @@ const createBaseToast = () => {
|
|
|
185
185
|
ToastList.defaultOpts[pos] = opts[pos];
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
+
if (typeof opts.theme === 'string' && _constants.strings.themes.includes(opts.theme)) {
|
|
189
|
+
ToastList.defaultOpts.theme = opts.theme;
|
|
190
|
+
}
|
|
188
191
|
if (typeof opts.zIndex === 'number') {
|
|
189
192
|
ToastList.defaultOpts.zIndex = opts.zIndex;
|
|
190
193
|
}
|
|
@@ -429,11 +429,11 @@ class Base extends _react.Component {
|
|
|
429
429
|
copied: false,
|
|
430
430
|
// ellipsis
|
|
431
431
|
// if text is overflow in container
|
|
432
|
-
isOverflowed:
|
|
432
|
+
isOverflowed: false,
|
|
433
433
|
ellipsisContent: props.children,
|
|
434
434
|
expanded: false,
|
|
435
435
|
// if text is truncated with js
|
|
436
|
-
isTruncated:
|
|
436
|
+
isTruncated: false,
|
|
437
437
|
prevChildren: null
|
|
438
438
|
};
|
|
439
439
|
this.wrapperRef = /*#__PURE__*/_react.default.createRef();
|
|
@@ -454,10 +454,10 @@ class Base extends _react.Component {
|
|
|
454
454
|
newState.prevChildren = props.children;
|
|
455
455
|
if (props.ellipsis && prevChildren !== props.children) {
|
|
456
456
|
// reset ellipsis state if children update
|
|
457
|
-
newState.isOverflowed =
|
|
457
|
+
newState.isOverflowed = false;
|
|
458
458
|
newState.ellipsisContent = props.children;
|
|
459
459
|
newState.expanded = false;
|
|
460
|
-
newState.isTruncated =
|
|
460
|
+
newState.isTruncated = false;
|
|
461
461
|
}
|
|
462
462
|
return newState;
|
|
463
463
|
}
|
|
@@ -60,11 +60,11 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
60
60
|
underline: PropTypes.Requireable<boolean>;
|
|
61
61
|
strong: PropTypes.Requireable<boolean>;
|
|
62
62
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "danger" | "tertiary" | "quaternary">;
|
|
63
|
-
heading: PropTypes.Requireable<
|
|
63
|
+
heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
|
|
64
64
|
style: PropTypes.Requireable<object>;
|
|
65
65
|
className: PropTypes.Requireable<string>;
|
|
66
66
|
component: PropTypes.Requireable<string>;
|
|
67
|
-
weight: PropTypes.Requireable<NonNullable<number | "
|
|
67
|
+
weight: PropTypes.Requireable<NonNullable<number | "default" | "bold" | "medium" | "light" | "regular" | "semibold">>;
|
|
68
68
|
};
|
|
69
69
|
static defaultProps: {
|
|
70
70
|
copyable: boolean;
|
package/lib/es/anchor/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ declare class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
40
40
|
static contextType: React.Context<ContextValue>;
|
|
41
41
|
static Link: typeof Link;
|
|
42
42
|
static PropTypes: {
|
|
43
|
-
size: PropTypes.Requireable<"
|
|
43
|
+
size: PropTypes.Requireable<"default" | "small">;
|
|
44
44
|
railTheme: PropTypes.Requireable<"primary" | "tertiary" | "muted">;
|
|
45
45
|
className: PropTypes.Requireable<string>;
|
|
46
46
|
style: PropTypes.Requireable<object>;
|
|
@@ -125,7 +125,7 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
125
125
|
renderSelectedItem: PropTypes.Requireable<(...args: any[]) => any>;
|
|
126
126
|
suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
127
127
|
showClear: PropTypes.Requireable<boolean>;
|
|
128
|
-
size: PropTypes.Requireable<"
|
|
128
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
129
129
|
style: PropTypes.Requireable<object>;
|
|
130
130
|
stopPropagation: PropTypes.Requireable<NonNullable<string | boolean>>;
|
|
131
131
|
maxHeight: PropTypes.Requireable<NonNullable<string | number>>;
|
|
@@ -47,7 +47,7 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
47
47
|
disabled: PropTypes.Requireable<boolean>;
|
|
48
48
|
prefixCls: PropTypes.Requireable<string>;
|
|
49
49
|
style: PropTypes.Requireable<object>;
|
|
50
|
-
size: PropTypes.Requireable<"
|
|
50
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
51
51
|
type: PropTypes.Requireable<"warning" | "primary" | "secondary" | "danger" | "tertiary">;
|
|
52
52
|
block: PropTypes.Requireable<boolean>;
|
|
53
53
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -18,7 +18,7 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
18
18
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
19
19
|
disabled: PropTypes.Requireable<boolean>;
|
|
20
20
|
type: PropTypes.Requireable<string>;
|
|
21
|
-
size: PropTypes.Requireable<"
|
|
21
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
22
22
|
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
23
23
|
'aria-label': PropTypes.Requireable<string>;
|
|
24
24
|
};
|
package/lib/es/button/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
23
23
|
onMouseEnter: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
24
24
|
onMouseLeave: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
25
25
|
disabled: import("prop-types").Requireable<boolean>;
|
|
26
|
-
size: import("prop-types").Requireable<"
|
|
26
|
+
size: import("prop-types").Requireable<"default" | "small" | "large">;
|
|
27
27
|
type: import("prop-types").Requireable<"warning" | "primary" | "secondary" | "danger" | "tertiary">;
|
|
28
28
|
block: import("prop-types").Requireable<boolean>;
|
|
29
29
|
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
@@ -59,6 +59,7 @@ export interface CascaderProps extends BasicCascaderProps {
|
|
|
59
59
|
onFocus?: (e: MouseEvent) => void;
|
|
60
60
|
validateStatus?: ValidateStatus;
|
|
61
61
|
position?: Position;
|
|
62
|
+
searchPosition?: string;
|
|
62
63
|
}
|
|
63
64
|
export interface CascaderState extends BasicCascaderInnerData {
|
|
64
65
|
keyEntities: Entities;
|
|
@@ -143,6 +144,7 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
143
144
|
enableLeafClick: PropTypes.Requireable<boolean>;
|
|
144
145
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
145
146
|
position: PropTypes.Requireable<string>;
|
|
147
|
+
searchPosition: PropTypes.Requireable<string>;
|
|
146
148
|
};
|
|
147
149
|
static defaultProps: any;
|
|
148
150
|
options: any;
|
|
@@ -161,6 +163,7 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
161
163
|
componentDidMount(): void;
|
|
162
164
|
componentWillUnmount(): void;
|
|
163
165
|
componentDidUpdate(prevProps: CascaderProps): void;
|
|
166
|
+
search: (value: string) => void;
|
|
164
167
|
handleInputChange: (value: string) => void;
|
|
165
168
|
handleTagRemoveInTrigger: (pos: string) => void;
|
|
166
169
|
handleTagClose: (tagChildren: React.ReactNode, e: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -31,6 +31,10 @@ const resetkey = 0;
|
|
|
31
31
|
class Cascader extends BaseComponent {
|
|
32
32
|
constructor(props) {
|
|
33
33
|
super(props);
|
|
34
|
+
// ref method
|
|
35
|
+
this.search = value => {
|
|
36
|
+
this.handleInputChange(value);
|
|
37
|
+
};
|
|
34
38
|
this.handleInputChange = value => {
|
|
35
39
|
this.foundation.handleInputChange(value);
|
|
36
40
|
};
|
|
@@ -217,12 +221,13 @@ class Cascader extends BaseComponent {
|
|
|
217
221
|
const {
|
|
218
222
|
placeholder,
|
|
219
223
|
filterTreeNode,
|
|
220
|
-
multiple
|
|
224
|
+
multiple,
|
|
225
|
+
searchPosition
|
|
221
226
|
} = this.props;
|
|
222
227
|
const {
|
|
223
228
|
checkedKeys
|
|
224
229
|
} = this.state;
|
|
225
|
-
const searchable = Boolean(filterTreeNode);
|
|
230
|
+
const searchable = Boolean(filterTreeNode) && searchPosition === strings.SEARCH_POSITION_TRIGGER;
|
|
226
231
|
if (!searchable) {
|
|
227
232
|
if (multiple) {
|
|
228
233
|
if (checkedKeys.size === 0) {
|
|
@@ -982,7 +987,8 @@ Cascader.propTypes = {
|
|
|
982
987
|
leafOnly: PropTypes.bool,
|
|
983
988
|
enableLeafClick: PropTypes.bool,
|
|
984
989
|
preventScroll: PropTypes.bool,
|
|
985
|
-
position: PropTypes.string
|
|
990
|
+
position: PropTypes.string,
|
|
991
|
+
searchPosition: PropTypes.string
|
|
986
992
|
};
|
|
987
993
|
Cascader.defaultProps = getDefaultPropsFromGlobalConfig(Cascader.__SemiComponentName__, {
|
|
988
994
|
borderless: false,
|
|
@@ -1013,6 +1019,7 @@ Cascader.defaultProps = getDefaultPropsFromGlobalConfig(Cascader.__SemiComponent
|
|
|
1013
1019
|
onDropdownVisibleChange: _noop,
|
|
1014
1020
|
onListScroll: _noop,
|
|
1015
1021
|
enableLeafClick: false,
|
|
1016
|
-
'aria-label': 'Cascader'
|
|
1022
|
+
'aria-label': 'Cascader',
|
|
1023
|
+
searchPosition: strings.SEARCH_POSITION_TRIGGER
|
|
1017
1024
|
});
|
|
1018
1025
|
export default Cascader;
|
|
@@ -22,9 +22,8 @@ class Collapsible extends BaseComponent {
|
|
|
22
22
|
this.isChildrenInRenderTree = () => {
|
|
23
23
|
if (this.domRef.current) {
|
|
24
24
|
return this.domRef.current.offsetHeight > 0;
|
|
25
|
-
} else {
|
|
26
|
-
return false;
|
|
27
25
|
}
|
|
26
|
+
return false;
|
|
28
27
|
};
|
|
29
28
|
this.state = {
|
|
30
29
|
domInRenderTree: false,
|
|
@@ -108,6 +107,7 @@ class Collapsible extends BaseComponent {
|
|
|
108
107
|
const wrapperCls = cls(`${cssClasses.PREFIX}-wrapper`, {
|
|
109
108
|
[`${cssClasses.PREFIX}-transition`]: this.props.motion && this.state.isTransitioning
|
|
110
109
|
}, this.props.className);
|
|
110
|
+
const shouldRender = this.props.keepDOM && !this.props.lazyRender || this.props.collapseHeight !== 0 || this.state.visible || this.props.isOpen;
|
|
111
111
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
112
112
|
className: wrapperCls,
|
|
113
113
|
style: wrapperStyle,
|
|
@@ -126,7 +126,7 @@ class Collapsible extends BaseComponent {
|
|
|
126
126
|
overflow: 'hidden'
|
|
127
127
|
},
|
|
128
128
|
id: this.props.id
|
|
129
|
-
},
|
|
129
|
+
}, shouldRender && this.props.children));
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
Collapsible.__SemiComponentName__ = "Collapsible";
|
|
@@ -135,6 +135,7 @@ Collapsible.defaultProps = getDefaultPropsFromGlobalConfig(Collapsible.__SemiCom
|
|
|
135
135
|
duration: 250,
|
|
136
136
|
motion: true,
|
|
137
137
|
keepDOM: false,
|
|
138
|
+
lazyRender: true,
|
|
138
139
|
collapseHeight: 0,
|
|
139
140
|
fade: false
|
|
140
141
|
});
|
|
@@ -59,7 +59,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
59
59
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
60
60
|
borderless: PropTypes.Requireable<boolean>;
|
|
61
61
|
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
62
|
-
size: PropTypes.Requireable<"
|
|
62
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
63
63
|
clearIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
64
64
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
65
65
|
defaultValue: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type DescriptionsAlign = 'center' | 'justify' | 'left' | 'plain';
|
|
3
|
+
export type DescriptionLayout = 'horizontal' | 'vertical';
|
|
3
4
|
export interface DescriptionsContextValue {
|
|
4
5
|
align?: DescriptionsAlign;
|
|
6
|
+
layout?: DescriptionLayout;
|
|
5
7
|
}
|
|
6
8
|
declare const DescriptionsContext: React.Context<DescriptionsContextValue>;
|
|
7
9
|
export default DescriptionsContext;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import '@douyinfe/semi-foundation/lib/es/descriptions/descriptions.css';
|
|
4
|
-
import { DescriptionsAlign,
|
|
4
|
+
import { DescriptionsAlign, DescriptionLayout } from './descriptions-context';
|
|
5
5
|
import Item from './item';
|
|
6
|
+
import DescriptionsFoundation, { DescriptionsAdapter } from '@douyinfe/semi-foundation/lib/es/descriptions/foundation';
|
|
7
|
+
import BaseComponent from '../_base/baseComponent';
|
|
6
8
|
export type { DescriptionsItemProps } from './item';
|
|
7
9
|
export type DescriptionsSize = 'small' | 'medium' | 'large';
|
|
8
10
|
export interface Data {
|
|
9
11
|
key?: React.ReactNode;
|
|
10
12
|
value?: (() => React.ReactNode) | React.ReactNode;
|
|
11
13
|
hidden?: boolean;
|
|
14
|
+
span?: number;
|
|
12
15
|
}
|
|
13
16
|
export interface DescriptionsProps {
|
|
14
17
|
align?: DescriptionsAlign;
|
|
@@ -18,10 +21,12 @@ export interface DescriptionsProps {
|
|
|
18
21
|
className?: string;
|
|
19
22
|
children?: React.ReactNode;
|
|
20
23
|
data?: Data[];
|
|
24
|
+
layout?: DescriptionLayout;
|
|
25
|
+
column?: number;
|
|
21
26
|
}
|
|
22
|
-
declare class Descriptions extends
|
|
27
|
+
declare class Descriptions extends BaseComponent<DescriptionsProps> {
|
|
23
28
|
static Item: typeof Item;
|
|
24
|
-
static contextType: React.Context<DescriptionsContextValue>;
|
|
29
|
+
static contextType: React.Context<import("./descriptions-context").DescriptionsContextValue>;
|
|
25
30
|
static propTypes: {
|
|
26
31
|
align: PropTypes.Requireable<string>;
|
|
27
32
|
row: PropTypes.Requireable<boolean>;
|
|
@@ -35,13 +40,21 @@ declare class Descriptions extends PureComponent<DescriptionsProps> {
|
|
|
35
40
|
className: PropTypes.Requireable<string>;
|
|
36
41
|
style: PropTypes.Requireable<object>;
|
|
37
42
|
}>[]>;
|
|
43
|
+
layout: PropTypes.Requireable<string>;
|
|
44
|
+
column: PropTypes.Requireable<number>;
|
|
38
45
|
};
|
|
39
46
|
static defaultProps: {
|
|
40
47
|
align: string;
|
|
41
48
|
row: boolean;
|
|
42
49
|
size: string;
|
|
43
50
|
data: Data[];
|
|
51
|
+
layout: string;
|
|
52
|
+
column: number;
|
|
44
53
|
};
|
|
54
|
+
foundation: DescriptionsFoundation;
|
|
55
|
+
constructor(props: DescriptionsProps);
|
|
56
|
+
get adapter(): DescriptionsAdapter<DescriptionsProps>;
|
|
57
|
+
renderChildrenList: () => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | JSX.Element[];
|
|
45
58
|
render(): JSX.Element;
|
|
46
59
|
}
|
|
47
60
|
export default Descriptions;
|
|
@@ -7,7 +7,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
7
7
|
}
|
|
8
8
|
return t;
|
|
9
9
|
};
|
|
10
|
-
import React
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import cls from 'classnames';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
import { strings, cssClasses } from '@douyinfe/semi-foundation/lib/es/descriptions/constants';
|
|
@@ -15,8 +15,43 @@ import '@douyinfe/semi-foundation/lib/es/descriptions/descriptions.css';
|
|
|
15
15
|
import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
|
|
16
16
|
import DescriptionsContext from './descriptions-context';
|
|
17
17
|
import Item from './item';
|
|
18
|
+
import DescriptionsFoundation from '@douyinfe/semi-foundation/lib/es/descriptions/foundation';
|
|
19
|
+
import BaseComponent from '../_base/baseComponent';
|
|
18
20
|
const prefixCls = cssClasses.PREFIX;
|
|
19
|
-
class Descriptions extends
|
|
21
|
+
class Descriptions extends BaseComponent {
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
this.renderChildrenList = () => {
|
|
25
|
+
const props = this.props;
|
|
26
|
+
const {
|
|
27
|
+
layout,
|
|
28
|
+
data,
|
|
29
|
+
children
|
|
30
|
+
} = props;
|
|
31
|
+
if (layout === 'horizontal') {
|
|
32
|
+
const horizontalList = this.foundation.getHorizontalList();
|
|
33
|
+
return horizontalList.map((row, index) => {
|
|
34
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
35
|
+
key: index
|
|
36
|
+
}, row.map((item, itemIndex) => _isPlainObject(item) ? /*#__PURE__*/React.createElement(Item, Object.assign({
|
|
37
|
+
itemKey: item.key
|
|
38
|
+
}, item, {
|
|
39
|
+
key: index + '-' + itemIndex
|
|
40
|
+
}), item.value) : null));
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
return data && data.length ? data.map((item, index) => _isPlainObject(item) ? /*#__PURE__*/React.createElement(Item, Object.assign({
|
|
44
|
+
itemKey: item.key
|
|
45
|
+
}, item, {
|
|
46
|
+
key: index
|
|
47
|
+
}), item.value) : null) : children;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this.foundation = new DescriptionsFoundation(this.adapter);
|
|
51
|
+
}
|
|
52
|
+
get adapter() {
|
|
53
|
+
return Object.assign({}, super.adapter);
|
|
54
|
+
}
|
|
20
55
|
render() {
|
|
21
56
|
const _a = this.props,
|
|
22
57
|
{
|
|
@@ -26,27 +61,26 @@ class Descriptions extends PureComponent {
|
|
|
26
61
|
className,
|
|
27
62
|
style,
|
|
28
63
|
children,
|
|
29
|
-
data
|
|
64
|
+
data,
|
|
65
|
+
layout
|
|
30
66
|
} = _a,
|
|
31
|
-
rest = __rest(_a, ["align", "row", "size", "className", "style", "children", "data"]);
|
|
67
|
+
rest = __rest(_a, ["align", "row", "size", "className", "style", "children", "data", "layout"]);
|
|
32
68
|
const classNames = cls(prefixCls, className, {
|
|
33
69
|
[`${prefixCls}-${align}`]: !row,
|
|
34
70
|
[`${prefixCls}-double`]: row,
|
|
35
|
-
[`${prefixCls}-double-${size}`]: row
|
|
71
|
+
[`${prefixCls}-double-${size}`]: row,
|
|
72
|
+
[`${prefixCls}-horizontal`]: layout === 'horizontal',
|
|
73
|
+
[`${prefixCls}-vertical`]: layout === 'vertical'
|
|
36
74
|
});
|
|
37
|
-
const childrenList = data && data.length ? data.map((item, index) => _isPlainObject(item) ? /*#__PURE__*/React.createElement(Item, Object.assign({
|
|
38
|
-
itemKey: item.key
|
|
39
|
-
}, item, {
|
|
40
|
-
key: index
|
|
41
|
-
}), item.value) : null) : children;
|
|
42
75
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
43
76
|
className: classNames,
|
|
44
77
|
style: style
|
|
45
78
|
}, getDataAttr(rest)), /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(DescriptionsContext.Provider, {
|
|
46
79
|
value: {
|
|
47
|
-
align
|
|
80
|
+
align,
|
|
81
|
+
layout
|
|
48
82
|
}
|
|
49
|
-
},
|
|
83
|
+
}, this.renderChildrenList()))));
|
|
50
84
|
}
|
|
51
85
|
}
|
|
52
86
|
Descriptions.Item = Item;
|
|
@@ -63,12 +97,16 @@ Descriptions.propTypes = {
|
|
|
63
97
|
hidden: PropTypes.bool,
|
|
64
98
|
className: PropTypes.string,
|
|
65
99
|
style: PropTypes.object
|
|
66
|
-
}))
|
|
100
|
+
})),
|
|
101
|
+
layout: PropTypes.oneOf(strings.LAYOUT_SET),
|
|
102
|
+
column: PropTypes.number
|
|
67
103
|
};
|
|
68
104
|
Descriptions.defaultProps = {
|
|
69
105
|
align: 'center',
|
|
70
106
|
row: false,
|
|
71
107
|
size: 'medium',
|
|
72
|
-
data: []
|
|
108
|
+
data: [],
|
|
109
|
+
layout: 'vertical',
|
|
110
|
+
column: 3
|
|
73
111
|
};
|
|
74
112
|
export default Descriptions;
|
|
@@ -8,6 +8,7 @@ export interface DescriptionsItemProps {
|
|
|
8
8
|
children?: React.ReactNode | (() => React.ReactNode);
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
10
|
itemKey?: React.ReactNode;
|
|
11
|
+
span?: number;
|
|
11
12
|
}
|
|
12
13
|
export default class Item extends PureComponent<DescriptionsItemProps> {
|
|
13
14
|
static propTypes: {
|