@douyinfe/semi-ui 2.10.2-alpha.1 → 2.10.4
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/cascader/index.tsx +4 -2
- package/datePicker/__test__/datePicker.test.js +1 -0
- package/datePicker/_story/v2/FixTriggerRender.tsx +36 -0
- package/datePicker/_story/v2/index.js +1 -0
- package/dist/css/semi.css +0 -1
- package/dist/umd/semi-ui.js +5103 -3512
- 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.js +4 -2
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +5 -5
- package/lib/cjs/select/index.js +27 -24
- package/lib/cjs/table/HeadTable.d.ts +2 -1
- package/lib/cjs/table/HeadTable.js +2 -1
- package/lib/cjs/table/Table.d.ts +1 -1
- package/lib/cjs/table/Table.js +2 -0
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/cascader/index.js +4 -2
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +5 -5
- package/lib/es/select/index.js +23 -21
- package/lib/es/table/HeadTable.d.ts +2 -1
- package/lib/es/table/HeadTable.js +2 -1
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/table/Table.js +2 -0
- package/lib/es/typography/title.d.ts +1 -1
- package/package.json +9 -9
- package/scrollList/_story/ScrollList/index.js +1 -1
- package/select/index.tsx +3 -1
- package/table/HeadTable.tsx +3 -1
- package/table/Table.tsx +2 -0
- package/table/_story/v2/FixedOnHeaderRow/index.jsx +134 -0
- package/table/_story/v2/index.js +2 -1
- package/upload/_story/upload.stories.js +1 -0
- package/yarn-error.log +26235 -0
|
@@ -800,13 +800,15 @@ class Cascader extends _baseComponent.default {
|
|
|
800
800
|
if ((0, _isArray.default)(realValue)) {
|
|
801
801
|
normallizedValue = (0, _isArray.default)(realValue[0]) ? realValue : [realValue];
|
|
802
802
|
} else {
|
|
803
|
-
|
|
803
|
+
if (realValue !== undefined) {
|
|
804
|
+
normallizedValue = [[realValue]];
|
|
805
|
+
}
|
|
804
806
|
} // formatValuePath is used to save value of valuePath
|
|
805
807
|
|
|
806
808
|
|
|
807
809
|
const formatValuePath = [];
|
|
808
810
|
(0, _forEach.default)(normallizedValue).call(normallizedValue, valueItem => {
|
|
809
|
-
const formatItem = onChangeWithObject ? (0, _map.default)(valueItem).call(valueItem, i => i.value) : valueItem;
|
|
811
|
+
const formatItem = onChangeWithObject ? (0, _map.default)(valueItem).call(valueItem, i => i === null || i === void 0 ? void 0 : i.value) : valueItem;
|
|
810
812
|
formatValuePath.push(formatItem);
|
|
811
813
|
}); // formatKeys is used to save key of value
|
|
812
814
|
|
|
@@ -125,7 +125,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
125
125
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
126
126
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
127
127
|
children?: React.ReactNode;
|
|
128
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
128
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
129
129
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
130
130
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
131
131
|
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
|
@@ -73,7 +73,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
73
73
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
74
74
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
75
75
|
children?: import("react").ReactNode;
|
|
76
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
76
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
77
77
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
78
78
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
79
79
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
@@ -15,7 +15,7 @@ export declare function withInfo(props: ModalReactProps): {
|
|
|
15
15
|
bodyStyle?: React.CSSProperties;
|
|
16
16
|
maskStyle?: React.CSSProperties;
|
|
17
17
|
style?: React.CSSProperties;
|
|
18
|
-
icon:
|
|
18
|
+
icon: React.ReactNode | JSX.Element;
|
|
19
19
|
closeIcon?: React.ReactNode;
|
|
20
20
|
title?: React.ReactNode;
|
|
21
21
|
content?: React.ReactNode;
|
|
@@ -57,7 +57,7 @@ export declare function withSuccess(props: ModalReactProps): {
|
|
|
57
57
|
bodyStyle?: React.CSSProperties;
|
|
58
58
|
maskStyle?: React.CSSProperties;
|
|
59
59
|
style?: React.CSSProperties;
|
|
60
|
-
icon:
|
|
60
|
+
icon: React.ReactNode | JSX.Element;
|
|
61
61
|
closeIcon?: React.ReactNode;
|
|
62
62
|
title?: React.ReactNode;
|
|
63
63
|
content?: React.ReactNode;
|
|
@@ -99,7 +99,7 @@ export declare function withWarning(props: ModalReactProps): {
|
|
|
99
99
|
bodyStyle?: React.CSSProperties;
|
|
100
100
|
maskStyle?: React.CSSProperties;
|
|
101
101
|
style?: React.CSSProperties;
|
|
102
|
-
icon:
|
|
102
|
+
icon: React.ReactNode | JSX.Element;
|
|
103
103
|
closeIcon?: React.ReactNode;
|
|
104
104
|
title?: React.ReactNode;
|
|
105
105
|
content?: React.ReactNode;
|
|
@@ -141,7 +141,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
141
141
|
bodyStyle?: React.CSSProperties;
|
|
142
142
|
maskStyle?: React.CSSProperties;
|
|
143
143
|
style?: React.CSSProperties;
|
|
144
|
-
icon:
|
|
144
|
+
icon: React.ReactNode | JSX.Element;
|
|
145
145
|
closeIcon?: React.ReactNode;
|
|
146
146
|
title?: React.ReactNode;
|
|
147
147
|
content?: React.ReactNode;
|
|
@@ -183,7 +183,7 @@ export declare function withConfirm(props: ModalReactProps): {
|
|
|
183
183
|
bodyStyle?: React.CSSProperties;
|
|
184
184
|
maskStyle?: React.CSSProperties;
|
|
185
185
|
style?: React.CSSProperties;
|
|
186
|
-
icon:
|
|
186
|
+
icon: React.ReactNode | JSX.Element;
|
|
187
187
|
closeIcon?: React.ReactNode;
|
|
188
188
|
title?: React.ReactNode;
|
|
189
189
|
content?: React.ReactNode;
|
package/lib/cjs/select/index.js
CHANGED
|
@@ -16,8 +16,6 @@ exports.default = void 0;
|
|
|
16
16
|
|
|
17
17
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
|
|
18
18
|
|
|
19
|
-
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
20
|
-
|
|
21
19
|
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
22
20
|
|
|
23
21
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
@@ -34,6 +32,8 @@ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
34
32
|
|
|
35
33
|
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
36
34
|
|
|
35
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
36
|
+
|
|
37
37
|
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
38
38
|
|
|
39
39
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/values"));
|
|
@@ -56,7 +56,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
56
56
|
|
|
57
57
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
58
58
|
|
|
59
|
-
var
|
|
59
|
+
var _context15 = _interopRequireDefault(require("../configProvider/context"));
|
|
60
60
|
|
|
61
61
|
var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/select/foundation"));
|
|
62
62
|
|
|
@@ -96,6 +96,8 @@ var _utils2 = require("../_utils");
|
|
|
96
96
|
|
|
97
97
|
var _warning = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/warning"));
|
|
98
98
|
|
|
99
|
+
var _uuid = require("@douyinfe/semi-foundation/lib/cjs/utils/uuid");
|
|
100
|
+
|
|
99
101
|
require("@douyinfe/semi-foundation/lib/cjs/select/select.css");
|
|
100
102
|
|
|
101
103
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -110,7 +112,7 @@ const key = 0; // Notes: Use the label of the option as the identifier, that is,
|
|
|
110
112
|
|
|
111
113
|
class Select extends _baseComponent.default {
|
|
112
114
|
constructor(props) {
|
|
113
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7
|
|
115
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7;
|
|
114
116
|
|
|
115
117
|
super(props);
|
|
116
118
|
|
|
@@ -132,19 +134,19 @@ class Select extends _baseComponent.default {
|
|
|
132
134
|
};
|
|
133
135
|
/* Generate random string */
|
|
134
136
|
|
|
135
|
-
this.selectOptionListID =
|
|
137
|
+
this.selectOptionListID = '';
|
|
136
138
|
this.virtualizeListRef = /*#__PURE__*/_react.default.createRef();
|
|
137
139
|
this.inputRef = /*#__PURE__*/_react.default.createRef();
|
|
138
140
|
this.triggerRef = /*#__PURE__*/_react.default.createRef();
|
|
139
141
|
this.optionsRef = /*#__PURE__*/_react.default.createRef();
|
|
140
142
|
this.clickOutsideHandler = null;
|
|
141
|
-
this.onSelect = (0, _bind.default)(
|
|
142
|
-
this.onClear = (0, _bind.default)(
|
|
143
|
-
this.onMouseEnter = (0, _bind.default)(
|
|
144
|
-
this.onMouseLeave = (0, _bind.default)(
|
|
145
|
-
this.renderOption = (0, _bind.default)(
|
|
146
|
-
this.onKeyPress = (0, _bind.default)(
|
|
147
|
-
this.onClearBtnEnterPress = (0, _bind.default)(
|
|
143
|
+
this.onSelect = (0, _bind.default)(_context = this.onSelect).call(_context, this);
|
|
144
|
+
this.onClear = (0, _bind.default)(_context2 = this.onClear).call(_context2, this);
|
|
145
|
+
this.onMouseEnter = (0, _bind.default)(_context3 = this.onMouseEnter).call(_context3, this);
|
|
146
|
+
this.onMouseLeave = (0, _bind.default)(_context4 = this.onMouseLeave).call(_context4, this);
|
|
147
|
+
this.renderOption = (0, _bind.default)(_context5 = this.renderOption).call(_context5, this);
|
|
148
|
+
this.onKeyPress = (0, _bind.default)(_context6 = this.onKeyPress).call(_context6, this);
|
|
149
|
+
this.onClearBtnEnterPress = (0, _bind.default)(_context7 = this.onClearBtnEnterPress).call(_context7, this);
|
|
148
150
|
this.foundation = new _foundation.default(this.adapter);
|
|
149
151
|
(0, _warning.default)('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
|
|
150
152
|
(0, _warning.default)('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
|
|
@@ -348,18 +350,18 @@ class Select extends _baseComponent.default {
|
|
|
348
350
|
} catch (error) {}
|
|
349
351
|
},
|
|
350
352
|
updateScrollTop: index => {
|
|
351
|
-
var
|
|
353
|
+
var _context9, _context10;
|
|
352
354
|
|
|
353
355
|
// eslint-disable-next-line max-len
|
|
354
356
|
let optionClassName = ".".concat(prefixcls, "-option-selected");
|
|
355
357
|
|
|
356
358
|
if (index !== undefined) {
|
|
357
|
-
var
|
|
359
|
+
var _context8;
|
|
358
360
|
|
|
359
|
-
optionClassName = (0, _concat.default)(
|
|
361
|
+
optionClassName = (0, _concat.default)(_context8 = ".".concat(prefixcls, "-option:nth-child(")).call(_context8, index, ")");
|
|
360
362
|
}
|
|
361
363
|
|
|
362
|
-
let destNode = document.querySelector((0, _concat.default)(
|
|
364
|
+
let destNode = document.querySelector((0, _concat.default)(_context9 = (0, _concat.default)(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " ")).call(_context9, optionClassName));
|
|
363
365
|
|
|
364
366
|
if ((0, _isArray.default)(destNode)) {
|
|
365
367
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -380,6 +382,7 @@ class Select extends _baseComponent.default {
|
|
|
380
382
|
|
|
381
383
|
componentDidMount() {
|
|
382
384
|
this.foundation.init();
|
|
385
|
+
this.selectOptionListID = (0, _uuid.getUuidShort)();
|
|
383
386
|
}
|
|
384
387
|
|
|
385
388
|
componentWillUnmount() {
|
|
@@ -387,10 +390,10 @@ class Select extends _baseComponent.default {
|
|
|
387
390
|
}
|
|
388
391
|
|
|
389
392
|
componentDidUpdate(prevProps, prevState) {
|
|
390
|
-
var
|
|
393
|
+
var _context11, _context12;
|
|
391
394
|
|
|
392
|
-
const prevChildrenKeys = (0, _map2.default)(
|
|
393
|
-
const nowChildrenKeys = (0, _map2.default)(
|
|
395
|
+
const prevChildrenKeys = (0, _map2.default)(_context11 = _react.default.Children.toArray(prevProps.children)).call(_context11, child => child.key);
|
|
396
|
+
const nowChildrenKeys = (0, _map2.default)(_context12 = _react.default.Children.toArray(this.props.children)).call(_context12, child => child.key);
|
|
394
397
|
let isOptionsChanged = false;
|
|
395
398
|
|
|
396
399
|
if (!(0, _isEqual2.default)(prevChildrenKeys, nowChildrenKeys) || !(0, _isEqual2.default)(prevProps.optionList, this.props.optionList)) {
|
|
@@ -631,7 +634,7 @@ class Select extends _baseComponent.default {
|
|
|
631
634
|
}
|
|
632
635
|
|
|
633
636
|
renderOptions(children) {
|
|
634
|
-
var
|
|
637
|
+
var _context13;
|
|
635
638
|
|
|
636
639
|
const {
|
|
637
640
|
dropdownMinWidth,
|
|
@@ -667,7 +670,7 @@ class Select extends _baseComponent.default {
|
|
|
667
670
|
});
|
|
668
671
|
const isEmpty = !options.length || !(0, _some.default)(options).call(options, item => item._show);
|
|
669
672
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
670
|
-
id: (0, _concat.default)(
|
|
673
|
+
id: (0, _concat.default)(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
|
|
671
674
|
className: dropdownClassName,
|
|
672
675
|
style: style
|
|
673
676
|
}, outerTopSlot, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -898,7 +901,7 @@ class Select extends _baseComponent.default {
|
|
|
898
901
|
}
|
|
899
902
|
|
|
900
903
|
renderSelection() {
|
|
901
|
-
var
|
|
904
|
+
var _context14;
|
|
902
905
|
|
|
903
906
|
const {
|
|
904
907
|
disabled,
|
|
@@ -982,7 +985,7 @@ class Select extends _baseComponent.default {
|
|
|
982
985
|
role: "combobox",
|
|
983
986
|
"aria-disabled": disabled,
|
|
984
987
|
"aria-expanded": isOpen,
|
|
985
|
-
"aria-controls": (0, _concat.default)(
|
|
988
|
+
"aria-controls": (0, _concat.default)(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
|
|
986
989
|
"aria-haspopup": "listbox",
|
|
987
990
|
"aria-label": "select value",
|
|
988
991
|
"aria-invalid": this.props['aria-invalid'],
|
|
@@ -1049,7 +1052,7 @@ class Select extends _baseComponent.default {
|
|
|
1049
1052
|
|
|
1050
1053
|
}
|
|
1051
1054
|
|
|
1052
|
-
Select.contextType =
|
|
1055
|
+
Select.contextType = _context15.default;
|
|
1053
1056
|
Select.Option = _option.default;
|
|
1054
1057
|
Select.OptGroup = _optionGroup.default;
|
|
1055
1058
|
Select.propTypes = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
|
|
2
|
+
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
|
|
3
3
|
export interface HeadTableProps {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
anyColumnFixed?: boolean;
|
|
@@ -15,6 +15,7 @@ export interface HeadTableProps {
|
|
|
15
15
|
selectedRowKeysSet: Set<any>;
|
|
16
16
|
showHeader?: boolean;
|
|
17
17
|
onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
|
|
18
|
+
onHeaderRow?: OnHeaderRow<any>;
|
|
18
19
|
}
|
|
19
20
|
declare const _default: React.ForwardRefExoticComponent<Pick<HeadTableProps, keyof HeadTableProps> & React.RefAttributes<HTMLDivElement>>;
|
|
20
21
|
export default _default;
|
|
@@ -116,7 +116,8 @@ HeadTable.propTypes = {
|
|
|
116
116
|
}),
|
|
117
117
|
selectedRowKeysSet: _propTypes.default.instanceOf(_set.default).isRequired,
|
|
118
118
|
showHeader: _propTypes.default.bool,
|
|
119
|
-
onDidUpdate: _propTypes.default.func
|
|
119
|
+
onDidUpdate: _propTypes.default.func,
|
|
120
|
+
onHeaderRow: _propTypes.default.func
|
|
120
121
|
};
|
|
121
122
|
HeadTable.defaultProps = {
|
|
122
123
|
handleBodyScroll: _noop2.default
|
package/lib/cjs/table/Table.d.ts
CHANGED
|
@@ -294,7 +294,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
294
294
|
defaultCurrentPage?: number;
|
|
295
295
|
onPageChange?: (currentPage: number) => void;
|
|
296
296
|
onPageSizeChange?: (newPageSize: number) => void;
|
|
297
|
-
onChange: (currentPage: number, pageSize: number) => void;
|
|
297
|
+
onChange: ((currentPage: number, pageSize: number) => void) | ((currentPage: number, currentPageSize: number) => void);
|
|
298
298
|
prevText?: React.ReactNode;
|
|
299
299
|
nextText?: React.ReactNode;
|
|
300
300
|
showSizeChanger?: boolean;
|
package/lib/cjs/table/Table.js
CHANGED
|
@@ -718,6 +718,7 @@ class Table extends _baseComponent.default {
|
|
|
718
718
|
components,
|
|
719
719
|
headerRef,
|
|
720
720
|
bodyRef,
|
|
721
|
+
onHeaderRow,
|
|
721
722
|
rowSelection,
|
|
722
723
|
dataSource,
|
|
723
724
|
bodyHasScrollBar,
|
|
@@ -736,6 +737,7 @@ class Table extends _baseComponent.default {
|
|
|
736
737
|
scroll: scroll,
|
|
737
738
|
showHeader: showHeader,
|
|
738
739
|
selectedRowKeysSet: selectedRowKeysSet,
|
|
740
|
+
onHeaderRow: onHeaderRow,
|
|
739
741
|
dataSource: dataSource,
|
|
740
742
|
bodyHasScrollBar: bodyHasScrollBar
|
|
741
743
|
}) : null;
|
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<
|
|
40
|
+
heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -741,14 +741,16 @@ class Cascader extends BaseComponent {
|
|
|
741
741
|
if (_Array$isArray(realValue)) {
|
|
742
742
|
normallizedValue = _Array$isArray(realValue[0]) ? realValue : [realValue];
|
|
743
743
|
} else {
|
|
744
|
-
|
|
744
|
+
if (realValue !== undefined) {
|
|
745
|
+
normallizedValue = [[realValue]];
|
|
746
|
+
}
|
|
745
747
|
} // formatValuePath is used to save value of valuePath
|
|
746
748
|
|
|
747
749
|
|
|
748
750
|
const formatValuePath = [];
|
|
749
751
|
|
|
750
752
|
_forEachInstanceProperty(normallizedValue).call(normallizedValue, valueItem => {
|
|
751
|
-
const formatItem = onChangeWithObject ? _mapInstanceProperty(valueItem).call(valueItem, i => i.value) : valueItem;
|
|
753
|
+
const formatItem = onChangeWithObject ? _mapInstanceProperty(valueItem).call(valueItem, i => i === null || i === void 0 ? void 0 : i.value) : valueItem;
|
|
752
754
|
formatValuePath.push(formatItem);
|
|
753
755
|
}); // formatKeys is used to save key of value
|
|
754
756
|
|
|
@@ -125,7 +125,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
125
125
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
126
126
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
127
127
|
children?: React.ReactNode;
|
|
128
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
128
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
129
129
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
130
130
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
131
131
|
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
|
@@ -73,7 +73,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
73
73
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
74
74
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
75
75
|
children?: import("react").ReactNode;
|
|
76
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
76
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
77
77
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
78
78
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
79
79
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
@@ -15,7 +15,7 @@ export declare function withInfo(props: ModalReactProps): {
|
|
|
15
15
|
bodyStyle?: React.CSSProperties;
|
|
16
16
|
maskStyle?: React.CSSProperties;
|
|
17
17
|
style?: React.CSSProperties;
|
|
18
|
-
icon:
|
|
18
|
+
icon: React.ReactNode | JSX.Element;
|
|
19
19
|
closeIcon?: React.ReactNode;
|
|
20
20
|
title?: React.ReactNode;
|
|
21
21
|
content?: React.ReactNode;
|
|
@@ -57,7 +57,7 @@ export declare function withSuccess(props: ModalReactProps): {
|
|
|
57
57
|
bodyStyle?: React.CSSProperties;
|
|
58
58
|
maskStyle?: React.CSSProperties;
|
|
59
59
|
style?: React.CSSProperties;
|
|
60
|
-
icon:
|
|
60
|
+
icon: React.ReactNode | JSX.Element;
|
|
61
61
|
closeIcon?: React.ReactNode;
|
|
62
62
|
title?: React.ReactNode;
|
|
63
63
|
content?: React.ReactNode;
|
|
@@ -99,7 +99,7 @@ export declare function withWarning(props: ModalReactProps): {
|
|
|
99
99
|
bodyStyle?: React.CSSProperties;
|
|
100
100
|
maskStyle?: React.CSSProperties;
|
|
101
101
|
style?: React.CSSProperties;
|
|
102
|
-
icon:
|
|
102
|
+
icon: React.ReactNode | JSX.Element;
|
|
103
103
|
closeIcon?: React.ReactNode;
|
|
104
104
|
title?: React.ReactNode;
|
|
105
105
|
content?: React.ReactNode;
|
|
@@ -141,7 +141,7 @@ export declare function withError(props: ModalReactProps): {
|
|
|
141
141
|
bodyStyle?: React.CSSProperties;
|
|
142
142
|
maskStyle?: React.CSSProperties;
|
|
143
143
|
style?: React.CSSProperties;
|
|
144
|
-
icon:
|
|
144
|
+
icon: React.ReactNode | JSX.Element;
|
|
145
145
|
closeIcon?: React.ReactNode;
|
|
146
146
|
title?: React.ReactNode;
|
|
147
147
|
content?: React.ReactNode;
|
|
@@ -183,7 +183,7 @@ export declare function withConfirm(props: ModalReactProps): {
|
|
|
183
183
|
bodyStyle?: React.CSSProperties;
|
|
184
184
|
maskStyle?: React.CSSProperties;
|
|
185
185
|
style?: React.CSSProperties;
|
|
186
|
-
icon:
|
|
186
|
+
icon: React.ReactNode | JSX.Element;
|
|
187
187
|
closeIcon?: React.ReactNode;
|
|
188
188
|
title?: React.ReactNode;
|
|
189
189
|
content?: React.ReactNode;
|
package/lib/es/select/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import _noop from "lodash/noop";
|
|
|
4
4
|
import _isString from "lodash/isString";
|
|
5
5
|
import _isEqual from "lodash/isEqual";
|
|
6
6
|
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
7
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
8
7
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
9
8
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
10
9
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
@@ -13,6 +12,7 @@ import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array
|
|
|
13
12
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
14
13
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
15
14
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
15
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
16
16
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
17
17
|
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
18
18
|
|
|
@@ -43,13 +43,14 @@ import Trigger from '../trigger';
|
|
|
43
43
|
import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
|
|
44
44
|
import { isSemiIcon } from '../_utils';
|
|
45
45
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
46
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
46
47
|
import '@douyinfe/semi-foundation/lib/es/select/select.css';
|
|
47
48
|
const prefixcls = cssClasses.PREFIX;
|
|
48
49
|
const key = 0; // Notes: Use the label of the option as the identifier, that is, the option in Select, the value is allowed to be the same, but the label must be unique
|
|
49
50
|
|
|
50
51
|
class Select extends BaseComponent {
|
|
51
52
|
constructor(props) {
|
|
52
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7
|
|
53
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7;
|
|
53
54
|
|
|
54
55
|
super(props);
|
|
55
56
|
|
|
@@ -71,19 +72,19 @@ class Select extends BaseComponent {
|
|
|
71
72
|
};
|
|
72
73
|
/* Generate random string */
|
|
73
74
|
|
|
74
|
-
this.selectOptionListID =
|
|
75
|
+
this.selectOptionListID = '';
|
|
75
76
|
this.virtualizeListRef = /*#__PURE__*/React.createRef();
|
|
76
77
|
this.inputRef = /*#__PURE__*/React.createRef();
|
|
77
78
|
this.triggerRef = /*#__PURE__*/React.createRef();
|
|
78
79
|
this.optionsRef = /*#__PURE__*/React.createRef();
|
|
79
80
|
this.clickOutsideHandler = null;
|
|
80
|
-
this.onSelect = _bindInstanceProperty(
|
|
81
|
-
this.onClear = _bindInstanceProperty(
|
|
82
|
-
this.onMouseEnter = _bindInstanceProperty(
|
|
83
|
-
this.onMouseLeave = _bindInstanceProperty(
|
|
84
|
-
this.renderOption = _bindInstanceProperty(
|
|
85
|
-
this.onKeyPress = _bindInstanceProperty(
|
|
86
|
-
this.onClearBtnEnterPress = _bindInstanceProperty(
|
|
81
|
+
this.onSelect = _bindInstanceProperty(_context = this.onSelect).call(_context, this);
|
|
82
|
+
this.onClear = _bindInstanceProperty(_context2 = this.onClear).call(_context2, this);
|
|
83
|
+
this.onMouseEnter = _bindInstanceProperty(_context3 = this.onMouseEnter).call(_context3, this);
|
|
84
|
+
this.onMouseLeave = _bindInstanceProperty(_context4 = this.onMouseLeave).call(_context4, this);
|
|
85
|
+
this.renderOption = _bindInstanceProperty(_context5 = this.renderOption).call(_context5, this);
|
|
86
|
+
this.onKeyPress = _bindInstanceProperty(_context6 = this.onKeyPress).call(_context6, this);
|
|
87
|
+
this.onClearBtnEnterPress = _bindInstanceProperty(_context7 = this.onClearBtnEnterPress).call(_context7, this);
|
|
87
88
|
this.foundation = new SelectFoundation(this.adapter);
|
|
88
89
|
warning('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
|
|
89
90
|
warning('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
|
|
@@ -286,18 +287,18 @@ class Select extends BaseComponent {
|
|
|
286
287
|
} catch (error) {}
|
|
287
288
|
},
|
|
288
289
|
updateScrollTop: index => {
|
|
289
|
-
var
|
|
290
|
+
var _context9, _context10;
|
|
290
291
|
|
|
291
292
|
// eslint-disable-next-line max-len
|
|
292
293
|
let optionClassName = ".".concat(prefixcls, "-option-selected");
|
|
293
294
|
|
|
294
295
|
if (index !== undefined) {
|
|
295
|
-
var
|
|
296
|
+
var _context8;
|
|
296
297
|
|
|
297
|
-
optionClassName = _concatInstanceProperty(
|
|
298
|
+
optionClassName = _concatInstanceProperty(_context8 = ".".concat(prefixcls, "-option:nth-child(")).call(_context8, index, ")");
|
|
298
299
|
}
|
|
299
300
|
|
|
300
|
-
let destNode = document.querySelector(_concatInstanceProperty(
|
|
301
|
+
let destNode = document.querySelector(_concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " ")).call(_context9, optionClassName));
|
|
301
302
|
|
|
302
303
|
if (_Array$isArray(destNode)) {
|
|
303
304
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -318,6 +319,7 @@ class Select extends BaseComponent {
|
|
|
318
319
|
|
|
319
320
|
componentDidMount() {
|
|
320
321
|
this.foundation.init();
|
|
322
|
+
this.selectOptionListID = getUuidShort();
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
componentWillUnmount() {
|
|
@@ -325,11 +327,11 @@ class Select extends BaseComponent {
|
|
|
325
327
|
}
|
|
326
328
|
|
|
327
329
|
componentDidUpdate(prevProps, prevState) {
|
|
328
|
-
var
|
|
330
|
+
var _context11, _context12;
|
|
329
331
|
|
|
330
|
-
const prevChildrenKeys = _mapInstanceProperty(
|
|
332
|
+
const prevChildrenKeys = _mapInstanceProperty(_context11 = React.Children.toArray(prevProps.children)).call(_context11, child => child.key);
|
|
331
333
|
|
|
332
|
-
const nowChildrenKeys = _mapInstanceProperty(
|
|
334
|
+
const nowChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(this.props.children)).call(_context12, child => child.key);
|
|
333
335
|
|
|
334
336
|
let isOptionsChanged = false;
|
|
335
337
|
|
|
@@ -575,7 +577,7 @@ class Select extends BaseComponent {
|
|
|
575
577
|
}
|
|
576
578
|
|
|
577
579
|
renderOptions(children) {
|
|
578
|
-
var
|
|
580
|
+
var _context13;
|
|
579
581
|
|
|
580
582
|
const {
|
|
581
583
|
dropdownMinWidth,
|
|
@@ -613,7 +615,7 @@ class Select extends BaseComponent {
|
|
|
613
615
|
});
|
|
614
616
|
const isEmpty = !options.length || !_someInstanceProperty(options).call(options, item => item._show);
|
|
615
617
|
return /*#__PURE__*/React.createElement("div", {
|
|
616
|
-
id: _concatInstanceProperty(
|
|
618
|
+
id: _concatInstanceProperty(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
|
|
617
619
|
className: dropdownClassName,
|
|
618
620
|
style: style
|
|
619
621
|
}, outerTopSlot, /*#__PURE__*/React.createElement("div", {
|
|
@@ -847,7 +849,7 @@ class Select extends BaseComponent {
|
|
|
847
849
|
}
|
|
848
850
|
|
|
849
851
|
renderSelection() {
|
|
850
|
-
var
|
|
852
|
+
var _context14;
|
|
851
853
|
|
|
852
854
|
const {
|
|
853
855
|
disabled,
|
|
@@ -931,7 +933,7 @@ class Select extends BaseComponent {
|
|
|
931
933
|
role: "combobox",
|
|
932
934
|
"aria-disabled": disabled,
|
|
933
935
|
"aria-expanded": isOpen,
|
|
934
|
-
"aria-controls": _concatInstanceProperty(
|
|
936
|
+
"aria-controls": _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
|
|
935
937
|
"aria-haspopup": "listbox",
|
|
936
938
|
"aria-label": "select value",
|
|
937
939
|
"aria-invalid": this.props['aria-invalid'],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
|
|
2
|
+
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
|
|
3
3
|
export interface HeadTableProps {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
anyColumnFixed?: boolean;
|
|
@@ -15,6 +15,7 @@ export interface HeadTableProps {
|
|
|
15
15
|
selectedRowKeysSet: Set<any>;
|
|
16
16
|
showHeader?: boolean;
|
|
17
17
|
onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
|
|
18
|
+
onHeaderRow?: OnHeaderRow<any>;
|
|
18
19
|
}
|
|
19
20
|
declare const _default: React.ForwardRefExoticComponent<Pick<HeadTableProps, keyof HeadTableProps> & React.RefAttributes<HTMLDivElement>>;
|
|
20
21
|
export default _default;
|
|
@@ -96,7 +96,8 @@ HeadTable.propTypes = {
|
|
|
96
96
|
}),
|
|
97
97
|
selectedRowKeysSet: PropTypes.instanceOf(_Set).isRequired,
|
|
98
98
|
showHeader: PropTypes.bool,
|
|
99
|
-
onDidUpdate: PropTypes.func
|
|
99
|
+
onDidUpdate: PropTypes.func,
|
|
100
|
+
onHeaderRow: PropTypes.func
|
|
100
101
|
};
|
|
101
102
|
HeadTable.defaultProps = {
|
|
102
103
|
handleBodyScroll: _noop
|
package/lib/es/table/Table.d.ts
CHANGED
|
@@ -294,7 +294,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
|
|
|
294
294
|
defaultCurrentPage?: number;
|
|
295
295
|
onPageChange?: (currentPage: number) => void;
|
|
296
296
|
onPageSizeChange?: (newPageSize: number) => void;
|
|
297
|
-
onChange: (currentPage: number, pageSize: number) => void;
|
|
297
|
+
onChange: ((currentPage: number, pageSize: number) => void) | ((currentPage: number, currentPageSize: number) => void);
|
|
298
298
|
prevText?: React.ReactNode;
|
|
299
299
|
nextText?: React.ReactNode;
|
|
300
300
|
showSizeChanger?: boolean;
|
package/lib/es/table/Table.js
CHANGED
|
@@ -658,6 +658,7 @@ class Table extends BaseComponent {
|
|
|
658
658
|
components,
|
|
659
659
|
headerRef,
|
|
660
660
|
bodyRef,
|
|
661
|
+
onHeaderRow,
|
|
661
662
|
rowSelection,
|
|
662
663
|
dataSource,
|
|
663
664
|
bodyHasScrollBar,
|
|
@@ -678,6 +679,7 @@ class Table extends BaseComponent {
|
|
|
678
679
|
scroll: scroll,
|
|
679
680
|
showHeader: showHeader,
|
|
680
681
|
selectedRowKeysSet: selectedRowKeysSet,
|
|
682
|
+
onHeaderRow: onHeaderRow,
|
|
681
683
|
dataSource: dataSource,
|
|
682
684
|
bodyHasScrollBar: bodyHasScrollBar
|
|
683
685
|
}) : null;
|
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<
|
|
40
|
+
heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|