@douyinfe/semi-ui 2.45.3-alpha.0 → 2.45.3
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/umd/semi-ui.js +45 -34
- 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/cascader/index.d.ts +2 -0
- package/lib/cjs/cascader/index.js +14 -0
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/form/baseForm.d.ts +2 -2
- package/lib/cjs/form/field.d.ts +2 -2
- package/lib/cjs/modal/confirm.d.ts +9 -9
- package/lib/cjs/select/index.js +1 -1
- package/lib/cjs/select/utils.js +5 -1
- package/lib/cjs/treeSelect/index.d.ts +1 -1
- package/lib/cjs/treeSelect/index.js +2 -2
- package/lib/cjs/typography/base.d.ts +2 -1
- package/lib/cjs/typography/base.js +5 -16
- package/lib/cjs/typography/interface.d.ts +1 -2
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/cascader/index.d.ts +2 -0
- package/lib/es/cascader/index.js +14 -0
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +2 -2
- package/lib/es/form/field.d.ts +2 -2
- package/lib/es/modal/confirm.d.ts +9 -9
- package/lib/es/select/index.js +1 -1
- package/lib/es/select/utils.js +5 -1
- package/lib/es/treeSelect/index.d.ts +1 -1
- package/lib/es/treeSelect/index.js +2 -2
- package/lib/es/typography/base.d.ts +2 -1
- package/lib/es/typography/base.js +5 -16
- package/lib/es/typography/interface.d.ts +1 -2
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +8 -8
|
@@ -182,6 +182,8 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
182
182
|
clickOutsideHandler: any;
|
|
183
183
|
mergeType: string;
|
|
184
184
|
context: ContextValue;
|
|
185
|
+
loadingKeysRef: React.RefObject<Set<string> | null>;
|
|
186
|
+
loadedKeysRef: React.RefObject<Set<string> | null>;
|
|
185
187
|
constructor(props: CascaderProps);
|
|
186
188
|
get adapter(): CascaderAdapter;
|
|
187
189
|
static getDerivedStateFromProps(props: CascaderProps, prevState: CascaderState): Partial<CascaderState>;
|
|
@@ -516,6 +516,8 @@ class Cascader extends _baseComponent.default {
|
|
|
516
516
|
this.optionsRef = /*#__PURE__*/_react.default.createRef();
|
|
517
517
|
this.clickOutsideHandler = null;
|
|
518
518
|
this.foundation = new _foundation.default(this.adapter);
|
|
519
|
+
this.loadingKeysRef = /*#__PURE__*/_react.default.createRef();
|
|
520
|
+
this.loadedKeysRef = /*#__PURE__*/_react.default.createRef();
|
|
519
521
|
}
|
|
520
522
|
get adapter() {
|
|
521
523
|
var _this = this;
|
|
@@ -661,6 +663,18 @@ class Cascader extends _baseComponent.default {
|
|
|
661
663
|
this.setState({
|
|
662
664
|
isFocus
|
|
663
665
|
});
|
|
666
|
+
},
|
|
667
|
+
updateLoadingKeyRefValue: keys => {
|
|
668
|
+
this.loadingKeysRef.current = keys;
|
|
669
|
+
},
|
|
670
|
+
getLoadingKeyRefValue: () => {
|
|
671
|
+
return this.loadingKeysRef.current;
|
|
672
|
+
},
|
|
673
|
+
updateLoadedKeyRefValue: keys => {
|
|
674
|
+
this.loadedKeysRef.current = keys;
|
|
675
|
+
},
|
|
676
|
+
getLoadedKeyRefValue: () => {
|
|
677
|
+
return this.loadedKeysRef.current;
|
|
664
678
|
}
|
|
665
679
|
});
|
|
666
680
|
}
|
|
@@ -86,7 +86,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
86
86
|
renderMonth(month: Date, panelType: PanelType): JSX.Element;
|
|
87
87
|
handleWeeksRowNumChange: (weeksRowNum: number, panelType: PanelType) => void;
|
|
88
88
|
reselect: () => void;
|
|
89
|
-
getYAMOpenType: () => "
|
|
89
|
+
getYAMOpenType: () => "both" | "none" | "left" | "right";
|
|
90
90
|
renderTimePicker(panelType: PanelType, panelDetail: MonthInfo): JSX.Element;
|
|
91
91
|
renderYearAndMonth(panelType: PanelType, panelDetail: MonthInfo): JSX.Element;
|
|
92
92
|
renderSwitch(panelType: PanelType): JSX.Element;
|
|
@@ -86,7 +86,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
86
86
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
87
87
|
zIndex?: number;
|
|
88
88
|
position?: "left" | "right" | "top" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
89
|
-
onSearch?: (value: string, event: React.
|
|
89
|
+
onSearch?: (value: string, event: React.KeyboardEvent<Element> | React.MouseEvent<Element, MouseEvent>) => void;
|
|
90
90
|
dropdownClassName?: string;
|
|
91
91
|
dropdownStyle?: React.CSSProperties;
|
|
92
92
|
dropdownMargin?: number | {
|
|
@@ -140,7 +140,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
140
140
|
preventScroll?: boolean;
|
|
141
141
|
showRestTagsPopover?: boolean;
|
|
142
142
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
143
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
143
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
144
144
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
145
145
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
146
146
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
32
32
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
33
33
|
zIndex?: number;
|
|
34
34
|
position?: "left" | "right" | "top" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
35
|
-
onSearch?: (value: string, event: import("react").
|
|
35
|
+
onSearch?: (value: string, event: import("react").KeyboardEvent<Element> | import("react").MouseEvent<Element, MouseEvent>) => void;
|
|
36
36
|
dropdownClassName?: string;
|
|
37
37
|
dropdownStyle?: import("react").CSSProperties;
|
|
38
38
|
dropdownMargin?: number | {
|
|
@@ -86,7 +86,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
86
86
|
preventScroll?: boolean;
|
|
87
87
|
showRestTagsPopover?: boolean;
|
|
88
88
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
89
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
89
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
90
90
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
91
91
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
92
92
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
@@ -140,19 +140,19 @@ export declare function withWarning(props: ModalReactProps): {
|
|
|
140
140
|
type: "warning";
|
|
141
141
|
};
|
|
142
142
|
export declare function withError(props: ModalReactProps): {
|
|
143
|
+
title?: React.ReactNode;
|
|
143
144
|
children?: React.ReactNode;
|
|
145
|
+
size?: import("@douyinfe/semi-foundation/lib/cjs/modal/modalFoundation").Size;
|
|
144
146
|
style?: React.CSSProperties;
|
|
145
147
|
className?: string;
|
|
148
|
+
motion?: boolean;
|
|
146
149
|
getPopupContainer?: () => HTMLElement;
|
|
147
150
|
footer?: React.ReactNode;
|
|
148
151
|
header?: React.ReactNode;
|
|
149
|
-
title?: React.ReactNode;
|
|
150
152
|
direction?: any;
|
|
151
153
|
mask?: boolean;
|
|
152
154
|
visible?: boolean;
|
|
153
155
|
zIndex?: number;
|
|
154
|
-
size?: import("@douyinfe/semi-foundation/lib/cjs/modal/modalFoundation").Size;
|
|
155
|
-
motion?: boolean;
|
|
156
156
|
width?: string | number;
|
|
157
157
|
height?: string | number;
|
|
158
158
|
content?: React.ReactNode;
|
|
@@ -201,10 +201,13 @@ export declare function withError(props: ModalReactProps): {
|
|
|
201
201
|
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
|
|
202
202
|
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
|
|
203
203
|
'aria-label'?: string;
|
|
204
|
+
title?: string;
|
|
205
|
+
name?: string;
|
|
204
206
|
value?: string | number | readonly string[];
|
|
207
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
208
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
205
209
|
form?: string;
|
|
206
210
|
slot?: string;
|
|
207
|
-
title?: string;
|
|
208
211
|
prefix?: string;
|
|
209
212
|
dangerouslySetInnerHTML?: {
|
|
210
213
|
__html: string | TrustedHTML;
|
|
@@ -359,9 +362,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
359
362
|
onScrollCapture?: React.UIEventHandler<HTMLButtonElement>;
|
|
360
363
|
onWheel?: React.WheelEventHandler<HTMLButtonElement>;
|
|
361
364
|
onWheelCapture?: React.WheelEventHandler<HTMLButtonElement>;
|
|
362
|
-
onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
363
365
|
onAnimationStartCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
364
|
-
onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
365
366
|
onAnimationEndCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
366
367
|
onAnimationIteration?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
367
368
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
@@ -375,7 +376,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
375
376
|
suppressHydrationWarning?: boolean;
|
|
376
377
|
accessKey?: string;
|
|
377
378
|
autoFocus?: boolean;
|
|
378
|
-
name?: string;
|
|
379
379
|
content?: string;
|
|
380
380
|
formAction?: string;
|
|
381
381
|
formEncType?: string;
|
|
@@ -389,7 +389,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
389
389
|
translate?: "no" | "yes";
|
|
390
390
|
role?: React.AriaRole;
|
|
391
391
|
contentEditable?: "inherit" | (boolean | "true" | "false");
|
|
392
|
-
inputMode?: "search" | "
|
|
392
|
+
inputMode?: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal";
|
|
393
393
|
nonce?: string;
|
|
394
394
|
tabIndex?: number;
|
|
395
395
|
'aria-expanded'?: boolean | "true" | "false";
|
|
@@ -422,7 +422,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
422
422
|
is?: string;
|
|
423
423
|
'aria-activedescendant'?: string;
|
|
424
424
|
'aria-atomic'?: boolean | "true" | "false";
|
|
425
|
-
'aria-autocomplete'?: "
|
|
425
|
+
'aria-autocomplete'?: "both" | "none" | "list" | "inline";
|
|
426
426
|
'aria-busy'?: boolean | "true" | "false";
|
|
427
427
|
'aria-checked'?: boolean | "true" | "false" | "mixed";
|
|
428
428
|
'aria-colcount'?: number;
|
package/lib/cjs/select/index.js
CHANGED
|
@@ -530,7 +530,7 @@ class Select extends _baseComponent.default {
|
|
|
530
530
|
focused: isFocused,
|
|
531
531
|
onMouseEnter: () => this.onOptionHover(optionIndex),
|
|
532
532
|
style: optionStyle,
|
|
533
|
-
key: option.
|
|
533
|
+
key: option._keyInOptionList || option._keyInJsx || option.label + option.value + optionIndex,
|
|
534
534
|
renderOptionItem: renderOptionItem,
|
|
535
535
|
inputValue: inputValue,
|
|
536
536
|
semiOptionId: `${this.selectID}-option-${optionIndex}`
|
package/lib/cjs/select/utils.js
CHANGED
|
@@ -22,7 +22,7 @@ const generateOption = (child, parent, index) => {
|
|
|
22
22
|
}
|
|
23
23
|
const option = Object.assign(Object.assign({
|
|
24
24
|
value: childProps.value,
|
|
25
|
-
//
|
|
25
|
+
// Dropdown menu rendering priority label value, children, value in turn downgrade
|
|
26
26
|
label: childProps.label || childProps.children || childProps.value,
|
|
27
27
|
_show: true,
|
|
28
28
|
_selected: false,
|
|
@@ -30,6 +30,10 @@ const generateOption = (child, parent, index) => {
|
|
|
30
30
|
}, childProps), {
|
|
31
31
|
_parentGroup: parent
|
|
32
32
|
});
|
|
33
|
+
// Props are collected from ReactNode, after React.Children.toArray
|
|
34
|
+
// no need to determine whether the key exists in child
|
|
35
|
+
// Even if the user does not explicitly declare it, React will always generate a key.
|
|
36
|
+
option._keyInJsx = child.key;
|
|
33
37
|
return option;
|
|
34
38
|
};
|
|
35
39
|
exports.generateOption = generateOption;
|
|
@@ -228,7 +228,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
228
228
|
renderArrow: () => JSX.Element;
|
|
229
229
|
renderClearBtn: () => JSX.Element;
|
|
230
230
|
renderSelection: () => JSX.Element;
|
|
231
|
-
renderTagItem: (key: string, idx: number) =>
|
|
231
|
+
renderTagItem: (key: string, idx: number) => any;
|
|
232
232
|
renderTagInput: () => JSX.Element;
|
|
233
233
|
renderInput: () => JSX.Element;
|
|
234
234
|
renderEmpty: () => JSX.Element;
|
|
@@ -200,7 +200,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
200
200
|
} = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
|
|
201
201
|
index,
|
|
202
202
|
onClose
|
|
203
|
-
}) :
|
|
203
|
+
}) : {};
|
|
204
204
|
if ((0, _isNull2.default)(content) || (0, _isUndefined2.default)(content)) {
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
@@ -496,7 +496,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
496
496
|
} = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
|
|
497
497
|
index: idx,
|
|
498
498
|
onClose
|
|
499
|
-
}) :
|
|
499
|
+
}) : {};
|
|
500
500
|
if (isRenderInTag) {
|
|
501
501
|
return /*#__PURE__*/_react.default.createElement(_index.default, Object.assign({}, tagProps), content);
|
|
502
502
|
} else {
|
|
@@ -132,6 +132,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
|
|
|
132
132
|
shouldTruncated: (rows: number) => boolean;
|
|
133
133
|
showTooltip: () => boolean | ShowTooltip | {
|
|
134
134
|
type: string;
|
|
135
|
+
opts: {};
|
|
135
136
|
};
|
|
136
137
|
getEllipsisState(): boolean;
|
|
137
138
|
/**
|
|
@@ -190,7 +191,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
|
|
|
190
191
|
renderCopy(): JSX.Element;
|
|
191
192
|
renderIcon(): JSX.Element;
|
|
192
193
|
renderContent(): JSX.Element;
|
|
193
|
-
renderTipWrapper():
|
|
194
|
+
renderTipWrapper(): JSX.Element;
|
|
194
195
|
render(): JSX.Element;
|
|
195
196
|
}
|
|
196
197
|
export {};
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
8
7
|
var _isNull2 = _interopRequireDefault(require("lodash/isNull"));
|
|
9
8
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
10
9
|
var _merge2 = _interopRequireDefault(require("lodash/merge"));
|
|
@@ -103,7 +102,6 @@ class Base extends _react.Component {
|
|
|
103
102
|
return updateOverflow;
|
|
104
103
|
};
|
|
105
104
|
this.showTooltip = () => {
|
|
106
|
-
var _a, _b;
|
|
107
105
|
const {
|
|
108
106
|
isOverflowed,
|
|
109
107
|
isTruncated,
|
|
@@ -121,7 +119,8 @@ class Base extends _react.Component {
|
|
|
121
119
|
return show;
|
|
122
120
|
}
|
|
123
121
|
const defaultOpts = {
|
|
124
|
-
type: 'tooltip'
|
|
122
|
+
type: 'tooltip',
|
|
123
|
+
opts: {}
|
|
125
124
|
};
|
|
126
125
|
if (typeof showTooltip === 'object') {
|
|
127
126
|
if (showTooltip.type && showTooltip.type.toLowerCase() === 'popover') {
|
|
@@ -130,14 +129,7 @@ class Base extends _react.Component {
|
|
|
130
129
|
// style: { width: '240px' },
|
|
131
130
|
showArrow: true
|
|
132
131
|
}
|
|
133
|
-
}, showTooltip
|
|
134
|
-
opts: {
|
|
135
|
-
className: (0, _classnames.default)({
|
|
136
|
-
[`${prefixCls}-ellipsis-popover`]: true,
|
|
137
|
-
[(_a = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _a === void 0 ? void 0 : _a.className]: Boolean((_b = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _b === void 0 ? void 0 : _b.className)
|
|
138
|
-
})
|
|
139
|
-
}
|
|
140
|
-
});
|
|
132
|
+
}, showTooltip);
|
|
141
133
|
}
|
|
142
134
|
return Object.assign(Object.assign({}, defaultOpts), showTooltip);
|
|
143
135
|
}
|
|
@@ -539,12 +531,9 @@ class Base extends _react.Component {
|
|
|
539
531
|
if (showTooltip) {
|
|
540
532
|
const {
|
|
541
533
|
type,
|
|
542
|
-
opts
|
|
543
|
-
renderTooltip
|
|
534
|
+
opts
|
|
544
535
|
} = showTooltip;
|
|
545
|
-
if (
|
|
546
|
-
return renderTooltip(children, content);
|
|
547
|
-
} else if (type.toLowerCase() === 'popover') {
|
|
536
|
+
if (type.toLowerCase() === 'popover') {
|
|
548
537
|
return /*#__PURE__*/_react.default.createElement(_index2.default, Object.assign({
|
|
549
538
|
content: children,
|
|
550
539
|
position: "top"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PopoverProps } from '../popover';
|
|
3
3
|
import { TooltipProps } from '../tooltip';
|
|
4
4
|
import { ArrayElement } from '../_base/base';
|
|
@@ -7,7 +7,6 @@ export type EllipsisPos = 'end' | 'middle';
|
|
|
7
7
|
export type ShowTooltip = {
|
|
8
8
|
type?: string;
|
|
9
9
|
opts?: Partial<PopoverProps> & Partial<TooltipProps>;
|
|
10
|
-
renderTooltip?: (content: TooltipProps['content'], children: ReactNode) => ReactNode;
|
|
11
10
|
};
|
|
12
11
|
export type Ellipsis = {
|
|
13
12
|
collapseText?: string;
|
|
@@ -60,7 +60,7 @@ 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" | "tertiary" | "secondary" | "danger" | "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>;
|
|
@@ -182,6 +182,8 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
182
182
|
clickOutsideHandler: any;
|
|
183
183
|
mergeType: string;
|
|
184
184
|
context: ContextValue;
|
|
185
|
+
loadingKeysRef: React.RefObject<Set<string> | null>;
|
|
186
|
+
loadedKeysRef: React.RefObject<Set<string> | null>;
|
|
185
187
|
constructor(props: CascaderProps);
|
|
186
188
|
get adapter(): CascaderAdapter;
|
|
187
189
|
static getDerivedStateFromProps(props: CascaderProps, prevState: CascaderState): Partial<CascaderState>;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -507,6 +507,8 @@ class Cascader extends BaseComponent {
|
|
|
507
507
|
this.optionsRef = /*#__PURE__*/React.createRef();
|
|
508
508
|
this.clickOutsideHandler = null;
|
|
509
509
|
this.foundation = new CascaderFoundation(this.adapter);
|
|
510
|
+
this.loadingKeysRef = /*#__PURE__*/React.createRef();
|
|
511
|
+
this.loadedKeysRef = /*#__PURE__*/React.createRef();
|
|
510
512
|
}
|
|
511
513
|
get adapter() {
|
|
512
514
|
var _this = this;
|
|
@@ -652,6 +654,18 @@ class Cascader extends BaseComponent {
|
|
|
652
654
|
this.setState({
|
|
653
655
|
isFocus
|
|
654
656
|
});
|
|
657
|
+
},
|
|
658
|
+
updateLoadingKeyRefValue: keys => {
|
|
659
|
+
this.loadingKeysRef.current = keys;
|
|
660
|
+
},
|
|
661
|
+
getLoadingKeyRefValue: () => {
|
|
662
|
+
return this.loadingKeysRef.current;
|
|
663
|
+
},
|
|
664
|
+
updateLoadedKeyRefValue: keys => {
|
|
665
|
+
this.loadedKeysRef.current = keys;
|
|
666
|
+
},
|
|
667
|
+
getLoadedKeyRefValue: () => {
|
|
668
|
+
return this.loadedKeysRef.current;
|
|
655
669
|
}
|
|
656
670
|
});
|
|
657
671
|
}
|
|
@@ -86,7 +86,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
86
86
|
renderMonth(month: Date, panelType: PanelType): JSX.Element;
|
|
87
87
|
handleWeeksRowNumChange: (weeksRowNum: number, panelType: PanelType) => void;
|
|
88
88
|
reselect: () => void;
|
|
89
|
-
getYAMOpenType: () => "
|
|
89
|
+
getYAMOpenType: () => "both" | "none" | "left" | "right";
|
|
90
90
|
renderTimePicker(panelType: PanelType, panelDetail: MonthInfo): JSX.Element;
|
|
91
91
|
renderYearAndMonth(panelType: PanelType, panelDetail: MonthInfo): JSX.Element;
|
|
92
92
|
renderSwitch(panelType: PanelType): JSX.Element;
|
|
@@ -86,7 +86,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
86
86
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
87
87
|
zIndex?: number;
|
|
88
88
|
position?: "left" | "right" | "top" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
89
|
-
onSearch?: (value: string, event: React.
|
|
89
|
+
onSearch?: (value: string, event: React.KeyboardEvent<Element> | React.MouseEvent<Element, MouseEvent>) => void;
|
|
90
90
|
dropdownClassName?: string;
|
|
91
91
|
dropdownStyle?: React.CSSProperties;
|
|
92
92
|
dropdownMargin?: number | {
|
|
@@ -140,7 +140,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
140
140
|
preventScroll?: boolean;
|
|
141
141
|
showRestTagsPopover?: boolean;
|
|
142
142
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
143
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
143
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
144
144
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
145
145
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
146
146
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
32
32
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
33
33
|
zIndex?: number;
|
|
34
34
|
position?: "left" | "right" | "top" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
35
|
-
onSearch?: (value: string, event: import("react").
|
|
35
|
+
onSearch?: (value: string, event: import("react").KeyboardEvent<Element> | import("react").MouseEvent<Element, MouseEvent>) => void;
|
|
36
36
|
dropdownClassName?: string;
|
|
37
37
|
dropdownStyle?: import("react").CSSProperties;
|
|
38
38
|
dropdownMargin?: number | {
|
|
@@ -86,7 +86,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
86
86
|
preventScroll?: boolean;
|
|
87
87
|
showRestTagsPopover?: boolean;
|
|
88
88
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
89
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
89
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
90
90
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
91
91
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
92
92
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
@@ -140,19 +140,19 @@ export declare function withWarning(props: ModalReactProps): {
|
|
|
140
140
|
type: "warning";
|
|
141
141
|
};
|
|
142
142
|
export declare function withError(props: ModalReactProps): {
|
|
143
|
+
title?: React.ReactNode;
|
|
143
144
|
children?: React.ReactNode;
|
|
145
|
+
size?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").Size;
|
|
144
146
|
style?: React.CSSProperties;
|
|
145
147
|
className?: string;
|
|
148
|
+
motion?: boolean;
|
|
146
149
|
getPopupContainer?: () => HTMLElement;
|
|
147
150
|
footer?: React.ReactNode;
|
|
148
151
|
header?: React.ReactNode;
|
|
149
|
-
title?: React.ReactNode;
|
|
150
152
|
direction?: any;
|
|
151
153
|
mask?: boolean;
|
|
152
154
|
visible?: boolean;
|
|
153
155
|
zIndex?: number;
|
|
154
|
-
size?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").Size;
|
|
155
|
-
motion?: boolean;
|
|
156
156
|
width?: string | number;
|
|
157
157
|
height?: string | number;
|
|
158
158
|
content?: React.ReactNode;
|
|
@@ -201,10 +201,13 @@ export declare function withError(props: ModalReactProps): {
|
|
|
201
201
|
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
|
|
202
202
|
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
|
|
203
203
|
'aria-label'?: string;
|
|
204
|
+
title?: string;
|
|
205
|
+
name?: string;
|
|
204
206
|
value?: string | number | readonly string[];
|
|
207
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
208
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
205
209
|
form?: string;
|
|
206
210
|
slot?: string;
|
|
207
|
-
title?: string;
|
|
208
211
|
prefix?: string;
|
|
209
212
|
dangerouslySetInnerHTML?: {
|
|
210
213
|
__html: string | TrustedHTML;
|
|
@@ -359,9 +362,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
359
362
|
onScrollCapture?: React.UIEventHandler<HTMLButtonElement>;
|
|
360
363
|
onWheel?: React.WheelEventHandler<HTMLButtonElement>;
|
|
361
364
|
onWheelCapture?: React.WheelEventHandler<HTMLButtonElement>;
|
|
362
|
-
onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
363
365
|
onAnimationStartCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
364
|
-
onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
365
366
|
onAnimationEndCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
366
367
|
onAnimationIteration?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
367
368
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
@@ -375,7 +376,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
375
376
|
suppressHydrationWarning?: boolean;
|
|
376
377
|
accessKey?: string;
|
|
377
378
|
autoFocus?: boolean;
|
|
378
|
-
name?: string;
|
|
379
379
|
content?: string;
|
|
380
380
|
formAction?: string;
|
|
381
381
|
formEncType?: string;
|
|
@@ -389,7 +389,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
389
389
|
translate?: "no" | "yes";
|
|
390
390
|
role?: React.AriaRole;
|
|
391
391
|
contentEditable?: "inherit" | (boolean | "true" | "false");
|
|
392
|
-
inputMode?: "search" | "
|
|
392
|
+
inputMode?: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal";
|
|
393
393
|
nonce?: string;
|
|
394
394
|
tabIndex?: number;
|
|
395
395
|
'aria-expanded'?: boolean | "true" | "false";
|
|
@@ -422,7 +422,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
422
422
|
is?: string;
|
|
423
423
|
'aria-activedescendant'?: string;
|
|
424
424
|
'aria-atomic'?: boolean | "true" | "false";
|
|
425
|
-
'aria-autocomplete'?: "
|
|
425
|
+
'aria-autocomplete'?: "both" | "none" | "list" | "inline";
|
|
426
426
|
'aria-busy'?: boolean | "true" | "false";
|
|
427
427
|
'aria-checked'?: boolean | "true" | "false" | "mixed";
|
|
428
428
|
'aria-colcount'?: number;
|
package/lib/es/select/index.js
CHANGED
|
@@ -521,7 +521,7 @@ class Select extends BaseComponent {
|
|
|
521
521
|
focused: isFocused,
|
|
522
522
|
onMouseEnter: () => this.onOptionHover(optionIndex),
|
|
523
523
|
style: optionStyle,
|
|
524
|
-
key: option.
|
|
524
|
+
key: option._keyInOptionList || option._keyInJsx || option.label + option.value + optionIndex,
|
|
525
525
|
renderOptionItem: renderOptionItem,
|
|
526
526
|
inputValue: inputValue,
|
|
527
527
|
semiOptionId: `${this.selectID}-option-${optionIndex}`
|
package/lib/es/select/utils.js
CHANGED
|
@@ -15,7 +15,7 @@ const generateOption = (child, parent, index) => {
|
|
|
15
15
|
}
|
|
16
16
|
const option = Object.assign(Object.assign({
|
|
17
17
|
value: childProps.value,
|
|
18
|
-
//
|
|
18
|
+
// Dropdown menu rendering priority label value, children, value in turn downgrade
|
|
19
19
|
label: childProps.label || childProps.children || childProps.value,
|
|
20
20
|
_show: true,
|
|
21
21
|
_selected: false,
|
|
@@ -23,6 +23,10 @@ const generateOption = (child, parent, index) => {
|
|
|
23
23
|
}, childProps), {
|
|
24
24
|
_parentGroup: parent
|
|
25
25
|
});
|
|
26
|
+
// Props are collected from ReactNode, after React.Children.toArray
|
|
27
|
+
// no need to determine whether the key exists in child
|
|
28
|
+
// Even if the user does not explicitly declare it, React will always generate a key.
|
|
29
|
+
option._keyInJsx = child.key;
|
|
26
30
|
return option;
|
|
27
31
|
};
|
|
28
32
|
const getOptionsFromGroup = selectChildren => {
|
|
@@ -228,7 +228,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
228
228
|
renderArrow: () => JSX.Element;
|
|
229
229
|
renderClearBtn: () => JSX.Element;
|
|
230
230
|
renderSelection: () => JSX.Element;
|
|
231
|
-
renderTagItem: (key: string, idx: number) =>
|
|
231
|
+
renderTagItem: (key: string, idx: number) => any;
|
|
232
232
|
renderTagInput: () => JSX.Element;
|
|
233
233
|
renderInput: () => JSX.Element;
|
|
234
234
|
renderEmpty: () => JSX.Element;
|
|
@@ -191,7 +191,7 @@ class TreeSelect extends BaseComponent {
|
|
|
191
191
|
} = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
|
|
192
192
|
index,
|
|
193
193
|
onClose
|
|
194
|
-
}) :
|
|
194
|
+
}) : {};
|
|
195
195
|
if (_isNull(content) || _isUndefined(content)) {
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
@@ -487,7 +487,7 @@ class TreeSelect extends BaseComponent {
|
|
|
487
487
|
} = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
|
|
488
488
|
index: idx,
|
|
489
489
|
onClose
|
|
490
|
-
}) :
|
|
490
|
+
}) : {};
|
|
491
491
|
if (isRenderInTag) {
|
|
492
492
|
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, tagProps), content);
|
|
493
493
|
} else {
|
|
@@ -132,6 +132,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
|
|
|
132
132
|
shouldTruncated: (rows: number) => boolean;
|
|
133
133
|
showTooltip: () => boolean | ShowTooltip | {
|
|
134
134
|
type: string;
|
|
135
|
+
opts: {};
|
|
135
136
|
};
|
|
136
137
|
getEllipsisState(): boolean;
|
|
137
138
|
/**
|
|
@@ -190,7 +191,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
|
|
|
190
191
|
renderCopy(): JSX.Element;
|
|
191
192
|
renderIcon(): JSX.Element;
|
|
192
193
|
renderContent(): JSX.Element;
|
|
193
|
-
renderTipWrapper():
|
|
194
|
+
renderTipWrapper(): JSX.Element;
|
|
194
195
|
render(): JSX.Element;
|
|
195
196
|
}
|
|
196
197
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _isFunction from "lodash/isFunction";
|
|
2
1
|
import _isNull from "lodash/isNull";
|
|
3
2
|
import _isString from "lodash/isString";
|
|
4
3
|
import _merge from "lodash/merge";
|
|
@@ -94,7 +93,6 @@ export default class Base extends Component {
|
|
|
94
93
|
return updateOverflow;
|
|
95
94
|
};
|
|
96
95
|
this.showTooltip = () => {
|
|
97
|
-
var _a, _b;
|
|
98
96
|
const {
|
|
99
97
|
isOverflowed,
|
|
100
98
|
isTruncated,
|
|
@@ -112,7 +110,8 @@ export default class Base extends Component {
|
|
|
112
110
|
return show;
|
|
113
111
|
}
|
|
114
112
|
const defaultOpts = {
|
|
115
|
-
type: 'tooltip'
|
|
113
|
+
type: 'tooltip',
|
|
114
|
+
opts: {}
|
|
116
115
|
};
|
|
117
116
|
if (typeof showTooltip === 'object') {
|
|
118
117
|
if (showTooltip.type && showTooltip.type.toLowerCase() === 'popover') {
|
|
@@ -121,14 +120,7 @@ export default class Base extends Component {
|
|
|
121
120
|
// style: { width: '240px' },
|
|
122
121
|
showArrow: true
|
|
123
122
|
}
|
|
124
|
-
}, showTooltip
|
|
125
|
-
opts: {
|
|
126
|
-
className: cls({
|
|
127
|
-
[`${prefixCls}-ellipsis-popover`]: true,
|
|
128
|
-
[(_a = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _a === void 0 ? void 0 : _a.className]: Boolean((_b = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _b === void 0 ? void 0 : _b.className)
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
});
|
|
123
|
+
}, showTooltip);
|
|
132
124
|
}
|
|
133
125
|
return Object.assign(Object.assign({}, defaultOpts), showTooltip);
|
|
134
126
|
}
|
|
@@ -530,12 +522,9 @@ export default class Base extends Component {
|
|
|
530
522
|
if (showTooltip) {
|
|
531
523
|
const {
|
|
532
524
|
type,
|
|
533
|
-
opts
|
|
534
|
-
renderTooltip
|
|
525
|
+
opts
|
|
535
526
|
} = showTooltip;
|
|
536
|
-
if (
|
|
537
|
-
return renderTooltip(children, content);
|
|
538
|
-
} else if (type.toLowerCase() === 'popover') {
|
|
527
|
+
if (type.toLowerCase() === 'popover') {
|
|
539
528
|
return /*#__PURE__*/React.createElement(Popover, Object.assign({
|
|
540
529
|
content: children,
|
|
541
530
|
position: "top"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PopoverProps } from '../popover';
|
|
3
3
|
import { TooltipProps } from '../tooltip';
|
|
4
4
|
import { ArrayElement } from '../_base/base';
|
|
@@ -7,7 +7,6 @@ export type EllipsisPos = 'end' | 'middle';
|
|
|
7
7
|
export type ShowTooltip = {
|
|
8
8
|
type?: string;
|
|
9
9
|
opts?: Partial<PopoverProps> & Partial<TooltipProps>;
|
|
10
|
-
renderTooltip?: (content: TooltipProps['content'], children: ReactNode) => ReactNode;
|
|
11
10
|
};
|
|
12
11
|
export type Ellipsis = {
|
|
13
12
|
collapseText?: string;
|