@douyinfe/semi-ui 2.24.0-beta.1 → 2.24.1-alpha.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/umd/semi-ui.js +778 -305
- 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 +2 -2
- package/lib/cjs/button/buttonGroup.d.ts +1 -1
- package/lib/cjs/button/index.d.ts +2 -2
- package/lib/cjs/cascader/index.js +8 -7
- package/lib/cjs/cascader/item.d.ts +1 -0
- package/lib/cjs/cascader/item.js +7 -5
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +2 -2
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +16 -6
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/image/preview.js +1 -1
- package/lib/cjs/input/index.d.ts +3 -1
- package/lib/cjs/input/index.js +32 -12
- package/lib/cjs/input/inputGroup.d.ts +1 -1
- package/lib/cjs/popover/index.d.ts +1 -1
- 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/tabs/TabBar.js +1 -2
- 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/tooltip/index.d.ts +1 -1
- package/lib/cjs/treeSelect/index.js +40 -6
- package/lib/cjs/typography/base.d.ts +1 -1
- package/lib/cjs/typography/numeral.d.ts +1 -1
- package/lib/cjs/typography/paragraph.d.ts +1 -1
- package/lib/cjs/typography/text.d.ts +1 -1
- 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 +2 -2
- package/lib/es/button/buttonGroup.d.ts +1 -1
- package/lib/es/button/index.d.ts +2 -2
- package/lib/es/cascader/index.js +6 -4
- package/lib/es/cascader/item.d.ts +1 -0
- package/lib/es/cascader/item.js +7 -5
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +2 -2
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.js +17 -7
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/image/preview.js +1 -1
- package/lib/es/input/index.d.ts +3 -1
- package/lib/es/input/index.js +31 -12
- package/lib/es/input/inputGroup.d.ts +1 -1
- package/lib/es/popover/index.d.ts +1 -1
- 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/tabs/TabBar.js +1 -2
- 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/tooltip/index.d.ts +1 -1
- package/lib/es/treeSelect/index.js +40 -6
- package/lib/es/typography/base.d.ts +1 -1
- package/lib/es/typography/numeral.d.ts +1 -1
- package/lib/es/typography/paragraph.d.ts +1 -1
- package/lib/es/typography/text.d.ts +1 -1
- package/lib/es/typography/title.d.ts +2 -2
- package/package.json +8 -8
|
@@ -39,7 +39,7 @@ declare class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
39
39
|
static contextType: React.Context<ContextValue>;
|
|
40
40
|
static Link: typeof Link;
|
|
41
41
|
static PropTypes: {
|
|
42
|
-
size: PropTypes.Requireable<"
|
|
42
|
+
size: PropTypes.Requireable<"small" | "default">;
|
|
43
43
|
railTheme: PropTypes.Requireable<"primary" | "tertiary" | "muted">;
|
|
44
44
|
className: PropTypes.Requireable<string>;
|
|
45
45
|
style: PropTypes.Requireable<object>;
|
|
@@ -123,7 +123,7 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
123
123
|
renderSelectedItem: PropTypes.Requireable<(...args: any[]) => any>;
|
|
124
124
|
suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
125
125
|
showClear: PropTypes.Requireable<boolean>;
|
|
126
|
-
size: PropTypes.Requireable<"
|
|
126
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
127
127
|
style: PropTypes.Requireable<object>;
|
|
128
128
|
stopPropagation: PropTypes.Requireable<NonNullable<string | boolean>>;
|
|
129
129
|
maxHeight: PropTypes.Requireable<NonNullable<string | number>>;
|
|
@@ -47,8 +47,8 @@ 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<"
|
|
51
|
-
type: PropTypes.Requireable<"warning" | "primary" | "
|
|
50
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
51
|
+
type: PropTypes.Requireable<"warning" | "primary" | "secondary" | "tertiary" | "danger">;
|
|
52
52
|
block: PropTypes.Requireable<boolean>;
|
|
53
53
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
54
|
onMouseDown: 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<"small" | "default" | "large">;
|
|
22
22
|
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
23
23
|
'aria-label': PropTypes.Requireable<string>;
|
|
24
24
|
};
|
|
@@ -22,8 +22,8 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
22
22
|
onMouseEnter: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
23
23
|
onMouseLeave: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
24
24
|
disabled: import("prop-types").Requireable<boolean>;
|
|
25
|
-
size: import("prop-types").Requireable<"
|
|
26
|
-
type: import("prop-types").Requireable<"warning" | "primary" | "
|
|
25
|
+
size: import("prop-types").Requireable<"small" | "default" | "large">;
|
|
26
|
+
type: import("prop-types").Requireable<"warning" | "primary" | "secondary" | "tertiary" | "danger">;
|
|
27
27
|
block: import("prop-types").Requireable<boolean>;
|
|
28
28
|
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
29
29
|
onMouseDown: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
@@ -41,8 +41,6 @@ var _semiIcons = require("@douyinfe/semi-icons");
|
|
|
41
41
|
|
|
42
42
|
var _util = require("@douyinfe/semi-foundation/lib/cjs/cascader/util");
|
|
43
43
|
|
|
44
|
-
var _treeUtil = require("@douyinfe/semi-foundation/lib/cjs/tree/treeUtil");
|
|
45
|
-
|
|
46
44
|
var _context = _interopRequireDefault(require("../configProvider/context"));
|
|
47
45
|
|
|
48
46
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
@@ -67,6 +65,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
67
65
|
|
|
68
66
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
69
67
|
|
|
68
|
+
// import { calcCheckedKeys, normalizeKeyList, calcDisabledKeys } from '@douyinfe/semi-foundation/tree/treeUtil';
|
|
70
69
|
const prefixcls = _constants.cssClasses.PREFIX;
|
|
71
70
|
const resetkey = 0;
|
|
72
71
|
|
|
@@ -148,7 +147,8 @@ class Cascader extends _baseComponent.default {
|
|
|
148
147
|
checkedKeys,
|
|
149
148
|
halfCheckedKeys,
|
|
150
149
|
loadedKeys,
|
|
151
|
-
loadingKeys
|
|
150
|
+
loadingKeys,
|
|
151
|
+
keyEntities
|
|
152
152
|
} = this.state;
|
|
153
153
|
const {
|
|
154
154
|
filterTreeNode,
|
|
@@ -188,7 +188,8 @@ class Cascader extends _baseComponent.default {
|
|
|
188
188
|
data: renderData,
|
|
189
189
|
multiple: multiple,
|
|
190
190
|
checkedKeys: checkedKeys,
|
|
191
|
-
halfCheckedKeys: halfCheckedKeys
|
|
191
|
+
halfCheckedKeys: halfCheckedKeys,
|
|
192
|
+
keyEntities: keyEntities
|
|
192
193
|
}), bottomSlot);
|
|
193
194
|
|
|
194
195
|
return content;
|
|
@@ -830,12 +831,12 @@ class Cascader extends _baseComponent.default {
|
|
|
830
831
|
realKeys = [...realKeys];
|
|
831
832
|
}
|
|
832
833
|
|
|
833
|
-
const calRes = (0,
|
|
834
|
+
const calRes = (0, _util.calcCheckedKeys)((0, _flatten2.default)(realKeys), keyEntities);
|
|
834
835
|
const checkedKeys = new Set(calRes.checkedKeys);
|
|
835
836
|
const halfCheckedKeys = new Set(calRes.halfCheckedKeys); // disableStrictly
|
|
836
837
|
|
|
837
838
|
if (props.disableStrictly) {
|
|
838
|
-
newState.disabledKeys = (0,
|
|
839
|
+
newState.disabledKeys = (0, _util.calcDisabledKeys)(keyEntities);
|
|
839
840
|
}
|
|
840
841
|
|
|
841
842
|
const isLeafOnlyMerge = (0, _util.calcMergeType)(autoMergeValue, leafOnly) === _constants.strings.LEAF_ONLY_MERGE_TYPE;
|
|
@@ -843,7 +844,7 @@ class Cascader extends _baseComponent.default {
|
|
|
843
844
|
newState.prevProps = props;
|
|
844
845
|
newState.checkedKeys = checkedKeys;
|
|
845
846
|
newState.halfCheckedKeys = halfCheckedKeys;
|
|
846
|
-
newState.resolvedCheckedKeys = new Set((0,
|
|
847
|
+
newState.resolvedCheckedKeys = new Set((0, _util.normalizeKeyList)(checkedKeys, keyEntities, isLeafOnlyMerge));
|
|
847
848
|
}
|
|
848
849
|
}
|
|
849
850
|
|
|
@@ -38,6 +38,7 @@ export interface CascaderItemProps {
|
|
|
38
38
|
multiple: boolean;
|
|
39
39
|
checkedKeys: Set<string>;
|
|
40
40
|
halfCheckedKeys: Set<string>;
|
|
41
|
+
keyEntities: Entities;
|
|
41
42
|
}
|
|
42
43
|
export default class Item extends PureComponent<CascaderItemProps> {
|
|
43
44
|
static contextType: React.Context<ContextValue>;
|
package/lib/cjs/cascader/item.js
CHANGED
|
@@ -229,7 +229,8 @@ class Item extends _react.PureComponent {
|
|
|
229
229
|
const {
|
|
230
230
|
multiple,
|
|
231
231
|
checkedKeys,
|
|
232
|
-
halfCheckedKeys
|
|
232
|
+
halfCheckedKeys,
|
|
233
|
+
keyEntities
|
|
233
234
|
} = this.props;
|
|
234
235
|
let showChildItem;
|
|
235
236
|
const ind = content.length;
|
|
@@ -242,10 +243,10 @@ class Item extends _react.PureComponent {
|
|
|
242
243
|
const {
|
|
243
244
|
data,
|
|
244
245
|
key,
|
|
245
|
-
parentKey
|
|
246
|
+
parentKey,
|
|
247
|
+
childrenKeys
|
|
246
248
|
} = item;
|
|
247
249
|
const {
|
|
248
|
-
children,
|
|
249
250
|
label,
|
|
250
251
|
disabled,
|
|
251
252
|
isLeaf
|
|
@@ -255,7 +256,7 @@ class Item extends _react.PureComponent {
|
|
|
255
256
|
selected,
|
|
256
257
|
loading
|
|
257
258
|
} = this.getItemStatus(key);
|
|
258
|
-
const hasChild = Boolean(
|
|
259
|
+
const hasChild = Boolean(childrenKeys) && childrenKeys.length;
|
|
259
260
|
const showExpand = hasChild || this.props.loadData && !isLeaf;
|
|
260
261
|
|
|
261
262
|
if (active && hasChild) {
|
|
@@ -298,7 +299,8 @@ class Item extends _react.PureComponent {
|
|
|
298
299
|
})));
|
|
299
300
|
|
|
300
301
|
if (showChildItem) {
|
|
301
|
-
|
|
302
|
+
const childItem = showChildItem.childrenKeys.map(key => keyEntities[key]);
|
|
303
|
+
content.concat(this.renderItem(childItem, content));
|
|
302
304
|
}
|
|
303
305
|
|
|
304
306
|
return content;
|
|
@@ -26,7 +26,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
26
26
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
27
|
value: PropTypes.Requireable<any[]>;
|
|
28
28
|
disabled: PropTypes.Requireable<boolean>;
|
|
29
|
-
type: PropTypes.Requireable<"
|
|
29
|
+
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "dateTimeRange">;
|
|
30
30
|
showClear: PropTypes.Requireable<boolean>;
|
|
31
31
|
format: PropTypes.Requireable<string>;
|
|
32
32
|
inputStyle: PropTypes.Requireable<object>;
|
|
@@ -43,8 +43,8 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
43
43
|
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
44
44
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
45
45
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
46
|
-
type: PropTypes.Requireable<"
|
|
47
|
-
size: PropTypes.Requireable<"
|
|
46
|
+
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "dateTimeRange">;
|
|
47
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
48
48
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
49
49
|
defaultValue: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
50
50
|
value: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
@@ -19,7 +19,7 @@ export interface MonthsGridProps extends MonthsGridFoundationProps, BaseProps {
|
|
|
19
19
|
export declare type MonthsGridState = MonthsGridFoundationState;
|
|
20
20
|
export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGridState> {
|
|
21
21
|
static propTypes: {
|
|
22
|
-
type: PropTypes.Requireable<"
|
|
22
|
+
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "dateTimeRange">;
|
|
23
23
|
defaultValue: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
24
24
|
defaultPickerValue: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
25
25
|
multiple: PropTypes.Requireable<boolean>;
|
|
@@ -96,9 +96,9 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
96
96
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
97
97
|
// updateYears: years => this.setState({ years }),
|
|
98
98
|
// updateMonths: months => this.setState({ months }),
|
|
99
|
-
setCurrentYear: currentYear => this.setState({
|
|
99
|
+
setCurrentYear: (currentYear, cb) => this.setState({
|
|
100
100
|
currentYear
|
|
101
|
-
}),
|
|
101
|
+
}, cb),
|
|
102
102
|
setCurrentMonth: currentMonth => this.setState({
|
|
103
103
|
currentMonth
|
|
104
104
|
}),
|
|
@@ -133,7 +133,8 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
133
133
|
const {
|
|
134
134
|
years,
|
|
135
135
|
currentYear,
|
|
136
|
-
currentMonth
|
|
136
|
+
currentMonth,
|
|
137
|
+
months
|
|
137
138
|
} = this.state;
|
|
138
139
|
const {
|
|
139
140
|
disabledDate,
|
|
@@ -147,10 +148,19 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
147
148
|
value,
|
|
148
149
|
year
|
|
149
150
|
} = _ref;
|
|
151
|
+
const isAllMonthDisabled = months.every(_ref2 => {
|
|
152
|
+
let {
|
|
153
|
+
month
|
|
154
|
+
} = _ref2;
|
|
155
|
+
return disabledDate((0, _dateFns.set)(currentDate, {
|
|
156
|
+
year,
|
|
157
|
+
month: month - 1
|
|
158
|
+
}));
|
|
159
|
+
});
|
|
150
160
|
return {
|
|
151
161
|
year,
|
|
152
162
|
value,
|
|
153
|
-
disabled:
|
|
163
|
+
disabled: isAllMonthDisabled
|
|
154
164
|
};
|
|
155
165
|
});
|
|
156
166
|
|
|
@@ -197,11 +207,11 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
197
207
|
} // i18n
|
|
198
208
|
|
|
199
209
|
|
|
200
|
-
const list = months.map(
|
|
210
|
+
const list = months.map(_ref3 => {
|
|
201
211
|
let {
|
|
202
212
|
value,
|
|
203
213
|
month
|
|
204
|
-
} =
|
|
214
|
+
} = _ref3;
|
|
205
215
|
return {
|
|
206
216
|
month,
|
|
207
217
|
disabled: disabledDate((0, _dateFns.setMonth)(currentDate, month - 1)),
|
|
@@ -128,7 +128,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
128
128
|
preventScroll?: boolean;
|
|
129
129
|
showRestTagsPopover?: boolean;
|
|
130
130
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
131
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
131
|
+
} & Pick<import("../tooltip").TooltipProps, "motion" | "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
132
132
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
133
133
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
134
134
|
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
|
@@ -76,7 +76,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
76
76
|
preventScroll?: boolean;
|
|
77
77
|
showRestTagsPopover?: boolean;
|
|
78
78
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
79
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
79
|
+
} & Pick<import("../tooltip").TooltipProps, "motion" | "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
80
80
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
81
81
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
82
82
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
package/lib/cjs/image/preview.js
CHANGED
|
@@ -178,7 +178,7 @@ class Preview extends _baseComponent.default {
|
|
|
178
178
|
const finalSrcList = [...srcArr, ...srcListInChildren];
|
|
179
179
|
return /*#__PURE__*/_react.default.createElement(_previewContext.PreviewContext.Provider, {
|
|
180
180
|
value: {
|
|
181
|
-
isGroup:
|
|
181
|
+
isGroup: true,
|
|
182
182
|
previewSrc: finalSrcList,
|
|
183
183
|
titles: titles,
|
|
184
184
|
currentIndex,
|
package/lib/cjs/input/index.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
81
81
|
showClear: PropTypes.Requireable<boolean>;
|
|
82
82
|
hideSuffix: PropTypes.Requireable<boolean>;
|
|
83
83
|
placeholder: PropTypes.Requireable<any>;
|
|
84
|
-
size: PropTypes.Requireable<"
|
|
84
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
85
85
|
className: PropTypes.Requireable<string>;
|
|
86
86
|
style: PropTypes.Requireable<object>;
|
|
87
87
|
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
@@ -132,6 +132,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
132
132
|
setValue: (value: string) => void;
|
|
133
133
|
setEyeClosed: (value: boolean) => void;
|
|
134
134
|
toggleFocusing: (isFocus: boolean) => void;
|
|
135
|
+
focusInput: () => void;
|
|
135
136
|
toggleHovering: (isHovering: boolean) => void;
|
|
136
137
|
getIfFocusing: () => boolean;
|
|
137
138
|
notifyChange: (cbValue: string, e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -178,6 +179,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
178
179
|
renderPrefix(): JSX.Element;
|
|
179
180
|
showClearBtn(): boolean;
|
|
180
181
|
renderSuffix(suffixAllowClear: boolean): JSX.Element;
|
|
182
|
+
getInputRef(): React.RefObject<HTMLInputElement> | React.MutableRefObject<any> | ((node: HTMLInputElement) => void);
|
|
181
183
|
render(): JSX.Element;
|
|
182
184
|
}
|
|
183
185
|
declare const ForwardInput: React.ForwardRefExoticComponent<Omit<InputProps, "forwardRef"> & React.RefAttributes<HTMLInputElement>>;
|
package/lib/cjs/input/index.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.Input = void 0;
|
|
7
7
|
|
|
8
|
+
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
9
|
+
|
|
8
10
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
9
11
|
|
|
10
12
|
var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
@@ -126,21 +128,17 @@ class Input extends _baseComponent.default {
|
|
|
126
128
|
eyeClosed: value
|
|
127
129
|
}),
|
|
128
130
|
toggleFocusing: isFocus => {
|
|
131
|
+
this.setState({
|
|
132
|
+
isFocus
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
focusInput: () => {
|
|
129
136
|
const {
|
|
130
137
|
preventScroll
|
|
131
138
|
} = this.props;
|
|
132
139
|
const input = this.inputRef && this.inputRef.current;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
input && input.focus({
|
|
136
|
-
preventScroll
|
|
137
|
-
});
|
|
138
|
-
} else {
|
|
139
|
-
input && input.blur();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
this.setState({
|
|
143
|
-
isFocus
|
|
140
|
+
input && input.focus({
|
|
141
|
+
preventScroll
|
|
144
142
|
});
|
|
145
143
|
},
|
|
146
144
|
toggleHovering: isHovering => this.setState({
|
|
@@ -344,6 +342,28 @@ class Input extends _baseComponent.default {
|
|
|
344
342
|
);
|
|
345
343
|
}
|
|
346
344
|
|
|
345
|
+
getInputRef() {
|
|
346
|
+
const {
|
|
347
|
+
forwardRef
|
|
348
|
+
} = this.props;
|
|
349
|
+
|
|
350
|
+
if (!(0, _isUndefined2.default)(forwardRef)) {
|
|
351
|
+
if (typeof forwardRef === 'function') {
|
|
352
|
+
return node => {
|
|
353
|
+
forwardRef(node);
|
|
354
|
+
this.inputRef = {
|
|
355
|
+
current: node
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
} else if (Object.prototype.toString.call(forwardRef) === '[object Object]') {
|
|
359
|
+
this.inputRef = forwardRef;
|
|
360
|
+
return forwardRef;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return this.inputRef;
|
|
365
|
+
}
|
|
366
|
+
|
|
347
367
|
render() {
|
|
348
368
|
const _a = this.props,
|
|
349
369
|
{
|
|
@@ -383,7 +403,7 @@ class Input extends _baseComponent.default {
|
|
|
383
403
|
} = this.state;
|
|
384
404
|
const suffixAllowClear = this.showClearBtn();
|
|
385
405
|
const suffixIsIcon = (0, _utils.isSemiIcon)(suffix);
|
|
386
|
-
const ref =
|
|
406
|
+
const ref = this.getInputRef();
|
|
387
407
|
const wrapperPrefix = "".concat(prefixCls, "-wrapper");
|
|
388
408
|
const wrapperCls = (0, _classnames.default)(wrapperPrefix, className, {
|
|
389
409
|
["".concat(prefixCls, "-wrapper__with-prefix")]: prefix || insetLabel,
|
|
@@ -21,7 +21,7 @@ export default class inputGroup extends BaseComponent<InputGroupProps, InputGrou
|
|
|
21
21
|
static propTypes: {
|
|
22
22
|
className: PropTypes.Requireable<string>;
|
|
23
23
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
24
|
-
size: PropTypes.Requireable<"
|
|
24
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
25
25
|
style: PropTypes.Requireable<object>;
|
|
26
26
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
27
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -56,7 +56,7 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
56
56
|
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
57
57
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
58
58
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
|
59
|
-
trigger: PropTypes.Validator<NonNullable<"
|
|
59
|
+
trigger: PropTypes.Validator<NonNullable<"custom" | "hover" | "focus" | "click">>;
|
|
60
60
|
contentClassName: PropTypes.Requireable<NonNullable<string | any[]>>;
|
|
61
61
|
onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
62
62
|
onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -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 | "small" | "default">>;
|
|
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 | "small" | "default">>;
|
|
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<"small" | "default" | "large">;
|
|
49
49
|
uncheckedText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
50
50
|
id: PropTypes.Requireable<string>;
|
|
51
51
|
};
|
package/lib/cjs/table/Table.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
52
52
|
components: PropTypes.Requireable<any>;
|
|
53
53
|
bordered: PropTypes.Requireable<boolean>;
|
|
54
54
|
loading: PropTypes.Requireable<boolean>;
|
|
55
|
-
size: PropTypes.Requireable<"
|
|
55
|
+
size: PropTypes.Requireable<"small" | "default" | "middle">;
|
|
56
56
|
tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
|
|
57
57
|
columns: PropTypes.Requireable<PropTypes.InferProps<{
|
|
58
58
|
align: PropTypes.Requireable<"left" | "right" | "center">;
|
|
@@ -289,7 +289,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
289
289
|
showTotal?: boolean;
|
|
290
290
|
pageSize?: number;
|
|
291
291
|
pageSizeOpts?: number[];
|
|
292
|
-
size?: "
|
|
292
|
+
size?: "small" | "default";
|
|
293
293
|
currentPage?: number;
|
|
294
294
|
defaultCurrentPage?: number;
|
|
295
295
|
onPageChange?: (currentPage: number) => void;
|
package/lib/cjs/table/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
|
|
|
15
15
|
components: PropTypes.Requireable<any>;
|
|
16
16
|
bordered: PropTypes.Requireable<boolean>;
|
|
17
17
|
loading: PropTypes.Requireable<boolean>;
|
|
18
|
-
size: PropTypes.Requireable<"
|
|
18
|
+
size: PropTypes.Requireable<"small" | "default" | "middle">;
|
|
19
19
|
tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
|
|
20
20
|
columns: PropTypes.Requireable<PropTypes.InferProps<{
|
|
21
21
|
align: PropTypes.Requireable<"left" | "right" | "center">;
|
package/lib/cjs/tabs/TabBar.js
CHANGED
|
@@ -112,7 +112,6 @@ class TabBar extends _react.default.Component {
|
|
|
112
112
|
this.renderTabComponents = list => list.map(panel => this.renderTabItem(panel));
|
|
113
113
|
|
|
114
114
|
this.handleArrowClick = (items, pos) => {
|
|
115
|
-
const inline = pos === 'start' ? 'end' : 'start';
|
|
116
115
|
const lastItem = pos === 'start' ? items.pop() : items.shift();
|
|
117
116
|
|
|
118
117
|
if (!lastItem) {
|
|
@@ -126,7 +125,7 @@ class TabBar extends _react.default.Component {
|
|
|
126
125
|
tabItem.scrollIntoView({
|
|
127
126
|
behavior: 'smooth',
|
|
128
127
|
block: 'nearest',
|
|
129
|
-
inline
|
|
128
|
+
inline: 'nearest'
|
|
130
129
|
});
|
|
131
130
|
};
|
|
132
131
|
|
|
@@ -89,7 +89,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
89
89
|
onAdd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
90
90
|
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
91
91
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
92
|
-
size: PropTypes.Requireable<"
|
|
92
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
93
93
|
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
94
94
|
prefix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
95
95
|
suffix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -125,7 +125,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
125
125
|
secondStep: PropTypes.Requireable<number>;
|
|
126
126
|
focusOnOpen: PropTypes.Requireable<boolean>;
|
|
127
127
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
128
|
-
size: PropTypes.Requireable<"
|
|
128
|
+
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
129
129
|
panels: PropTypes.Requireable<PropTypes.InferProps<{
|
|
130
130
|
panelHeader: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
131
131
|
panelFooter: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
@@ -46,7 +46,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
46
46
|
secondStep: import("prop-types").Requireable<number>;
|
|
47
47
|
focusOnOpen: import("prop-types").Requireable<boolean>;
|
|
48
48
|
autoFocus: import("prop-types").Requireable<boolean>;
|
|
49
|
-
size: import("prop-types").Requireable<"
|
|
49
|
+
size: import("prop-types").Requireable<"small" | "default" | "large">;
|
|
50
50
|
panels: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
51
51
|
panelHeader: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
|
|
52
52
|
panelFooter: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
|
|
@@ -90,7 +90,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
90
90
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
91
91
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
92
92
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
|
93
|
-
trigger: PropTypes.Validator<NonNullable<"
|
|
93
|
+
trigger: PropTypes.Validator<NonNullable<"custom" | "hover" | "focus" | "click">>;
|
|
94
94
|
className: PropTypes.Requireable<string>;
|
|
95
95
|
wrapperClassName: PropTypes.Requireable<string>;
|
|
96
96
|
clickToHide: PropTypes.Requireable<boolean>;
|
|
@@ -586,7 +586,9 @@ class TreeSelect extends _baseComponent.default {
|
|
|
586
586
|
maxTagCount,
|
|
587
587
|
checkRelation,
|
|
588
588
|
showRestTagsPopover,
|
|
589
|
-
restTagsPopoverProps
|
|
589
|
+
restTagsPopoverProps,
|
|
590
|
+
searchPosition,
|
|
591
|
+
filterTreeNode
|
|
590
592
|
} = this.props;
|
|
591
593
|
const {
|
|
592
594
|
keyEntities,
|
|
@@ -600,8 +602,16 @@ class TreeSelect extends _baseComponent.default {
|
|
|
600
602
|
keyList = (0, _treeUtil.normalizeKeyList)(checkedKeys, keyEntities, leafOnly);
|
|
601
603
|
} else if (checkRelation === 'unRelated') {
|
|
602
604
|
keyList = [...realCheckedKeys];
|
|
603
|
-
}
|
|
605
|
+
} // auto focus search input divide into two parts
|
|
606
|
+
// 1. filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER
|
|
607
|
+
// Implemented by passing autofocus to the underlying input's autofocus
|
|
608
|
+
// 2. filterTreeNode && searchPosition === strings.SEARCH_POSITION_DROPDOWN
|
|
609
|
+
// Due to the off-screen rendering in the tooltip implementation mechanism, if it is implemented through the
|
|
610
|
+
// autofocus of the input, when the option panel is opened, the page will scroll to top, so it is necessary
|
|
611
|
+
// to call the focus method through ref in the onVisibleChange callback of the Popover to achieve focus
|
|
612
|
+
|
|
604
613
|
|
|
614
|
+
const autoFocus = filterTreeNode && searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER ? searchAutoFocus : undefined;
|
|
605
615
|
return /*#__PURE__*/_react.default.createElement(_tagInput.default, {
|
|
606
616
|
maxTagCount: maxTagCount,
|
|
607
617
|
disabled: disabled,
|
|
@@ -614,7 +624,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
614
624
|
showRestTagsPopover: showRestTagsPopover,
|
|
615
625
|
restTagsPopoverProps: restTagsPopoverProps,
|
|
616
626
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
617
|
-
autoFocus:
|
|
627
|
+
autoFocus: autoFocus,
|
|
618
628
|
renderTagItem: (itemKey, index) => this.renderTagItem(itemKey, index),
|
|
619
629
|
onRemove: itemKey => this.removeTag(itemKey),
|
|
620
630
|
expandRestTagsOnClick: false
|
|
@@ -650,6 +660,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
650
660
|
prefix: /*#__PURE__*/_react.default.createElement(_semiIcons.IconSearch, null)
|
|
651
661
|
};
|
|
652
662
|
const inputTriggerProps = {
|
|
663
|
+
autofocus: searchAutoFocus,
|
|
653
664
|
onFocus: e => this.foundation.handleInputTriggerFocus(),
|
|
654
665
|
onBlur: e => this.foundation.handleInputTriggerBlur(),
|
|
655
666
|
disabled
|
|
@@ -681,7 +692,6 @@ class TreeSelect extends _baseComponent.default {
|
|
|
681
692
|
return /*#__PURE__*/_react.default.createElement(_index2.default, Object.assign({
|
|
682
693
|
"aria-label": 'Filter TreeSelect item',
|
|
683
694
|
ref: this.inputRef,
|
|
684
|
-
autofocus: searchAutoFocus,
|
|
685
695
|
placeholder: placeholder
|
|
686
696
|
}, baseInputProps, realInputProps));
|
|
687
697
|
}));
|
|
@@ -755,12 +765,18 @@ class TreeSelect extends _baseComponent.default {
|
|
|
755
765
|
|
|
756
766
|
this.handlePopoverClose = isVisible => {
|
|
757
767
|
const {
|
|
758
|
-
filterTreeNode
|
|
768
|
+
filterTreeNode,
|
|
769
|
+
searchAutoFocus,
|
|
770
|
+
searchPosition
|
|
759
771
|
} = this.props;
|
|
760
772
|
|
|
761
773
|
if (isVisible === false && Boolean(filterTreeNode)) {
|
|
762
774
|
this.foundation.clearInput();
|
|
763
775
|
}
|
|
776
|
+
|
|
777
|
+
if (filterTreeNode && searchPosition === _constants.strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
|
|
778
|
+
this.foundation.focusInput(true);
|
|
779
|
+
}
|
|
764
780
|
};
|
|
765
781
|
|
|
766
782
|
this.renderTreeNode = (treeNode, ind, style) => {
|
|
@@ -1225,7 +1241,25 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1225
1241
|
isHovering: bool
|
|
1226
1242
|
});
|
|
1227
1243
|
},
|
|
1228
|
-
updateInputFocus: bool => {
|
|
1244
|
+
updateInputFocus: bool => {
|
|
1245
|
+
if (bool) {
|
|
1246
|
+
if (this.inputRef && this.inputRef.current) {
|
|
1247
|
+
this.inputRef.current.focus();
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
if (this.tagInputRef && this.tagInputRef.current) {
|
|
1251
|
+
this.tagInputRef.current.focus();
|
|
1252
|
+
}
|
|
1253
|
+
} else {
|
|
1254
|
+
if (this.inputRef && this.inputRef.current) {
|
|
1255
|
+
this.inputRef.current.blur();
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
if (this.tagInputRef && this.tagInputRef.current) {
|
|
1259
|
+
this.tagInputRef.current.blur();
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
} // eslint-disable-line
|
|
1229
1263
|
|
|
1230
1264
|
});
|
|
1231
1265
|
}
|