@douyinfe/semi-ui 2.10.2-alpha.1 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/semi.css +0 -1
- package/dist/umd/semi-ui.js +350 -344
- 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/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- 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.js +2 -0
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- 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.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
|
@@ -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>;
|
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.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>;
|
|
@@ -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>;
|
package/lib/es/select/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import _noop from "lodash/noop";
|
|
|
4
4
|
import _isString from "lodash/isString";
|
|
5
5
|
import _isEqual from "lodash/isEqual";
|
|
6
6
|
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
7
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
8
7
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
9
8
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
10
9
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
@@ -13,6 +12,7 @@ import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array
|
|
|
13
12
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
14
13
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
15
14
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
15
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
16
16
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
17
17
|
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
18
18
|
|
|
@@ -43,13 +43,14 @@ import Trigger from '../trigger';
|
|
|
43
43
|
import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
|
|
44
44
|
import { isSemiIcon } from '../_utils';
|
|
45
45
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
46
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
46
47
|
import '@douyinfe/semi-foundation/lib/es/select/select.css';
|
|
47
48
|
const prefixcls = cssClasses.PREFIX;
|
|
48
49
|
const key = 0; // Notes: Use the label of the option as the identifier, that is, the option in Select, the value is allowed to be the same, but the label must be unique
|
|
49
50
|
|
|
50
51
|
class Select extends BaseComponent {
|
|
51
52
|
constructor(props) {
|
|
52
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7
|
|
53
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7;
|
|
53
54
|
|
|
54
55
|
super(props);
|
|
55
56
|
|
|
@@ -71,19 +72,19 @@ class Select extends BaseComponent {
|
|
|
71
72
|
};
|
|
72
73
|
/* Generate random string */
|
|
73
74
|
|
|
74
|
-
this.selectOptionListID =
|
|
75
|
+
this.selectOptionListID = '';
|
|
75
76
|
this.virtualizeListRef = /*#__PURE__*/React.createRef();
|
|
76
77
|
this.inputRef = /*#__PURE__*/React.createRef();
|
|
77
78
|
this.triggerRef = /*#__PURE__*/React.createRef();
|
|
78
79
|
this.optionsRef = /*#__PURE__*/React.createRef();
|
|
79
80
|
this.clickOutsideHandler = null;
|
|
80
|
-
this.onSelect = _bindInstanceProperty(
|
|
81
|
-
this.onClear = _bindInstanceProperty(
|
|
82
|
-
this.onMouseEnter = _bindInstanceProperty(
|
|
83
|
-
this.onMouseLeave = _bindInstanceProperty(
|
|
84
|
-
this.renderOption = _bindInstanceProperty(
|
|
85
|
-
this.onKeyPress = _bindInstanceProperty(
|
|
86
|
-
this.onClearBtnEnterPress = _bindInstanceProperty(
|
|
81
|
+
this.onSelect = _bindInstanceProperty(_context = this.onSelect).call(_context, this);
|
|
82
|
+
this.onClear = _bindInstanceProperty(_context2 = this.onClear).call(_context2, this);
|
|
83
|
+
this.onMouseEnter = _bindInstanceProperty(_context3 = this.onMouseEnter).call(_context3, this);
|
|
84
|
+
this.onMouseLeave = _bindInstanceProperty(_context4 = this.onMouseLeave).call(_context4, this);
|
|
85
|
+
this.renderOption = _bindInstanceProperty(_context5 = this.renderOption).call(_context5, this);
|
|
86
|
+
this.onKeyPress = _bindInstanceProperty(_context6 = this.onKeyPress).call(_context6, this);
|
|
87
|
+
this.onClearBtnEnterPress = _bindInstanceProperty(_context7 = this.onClearBtnEnterPress).call(_context7, this);
|
|
87
88
|
this.foundation = new SelectFoundation(this.adapter);
|
|
88
89
|
warning('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
|
|
89
90
|
warning('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
|
|
@@ -286,18 +287,18 @@ class Select extends BaseComponent {
|
|
|
286
287
|
} catch (error) {}
|
|
287
288
|
},
|
|
288
289
|
updateScrollTop: index => {
|
|
289
|
-
var
|
|
290
|
+
var _context9, _context10;
|
|
290
291
|
|
|
291
292
|
// eslint-disable-next-line max-len
|
|
292
293
|
let optionClassName = ".".concat(prefixcls, "-option-selected");
|
|
293
294
|
|
|
294
295
|
if (index !== undefined) {
|
|
295
|
-
var
|
|
296
|
+
var _context8;
|
|
296
297
|
|
|
297
|
-
optionClassName = _concatInstanceProperty(
|
|
298
|
+
optionClassName = _concatInstanceProperty(_context8 = ".".concat(prefixcls, "-option:nth-child(")).call(_context8, index, ")");
|
|
298
299
|
}
|
|
299
300
|
|
|
300
|
-
let destNode = document.querySelector(_concatInstanceProperty(
|
|
301
|
+
let destNode = document.querySelector(_concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " ")).call(_context9, optionClassName));
|
|
301
302
|
|
|
302
303
|
if (_Array$isArray(destNode)) {
|
|
303
304
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -318,6 +319,7 @@ class Select extends BaseComponent {
|
|
|
318
319
|
|
|
319
320
|
componentDidMount() {
|
|
320
321
|
this.foundation.init();
|
|
322
|
+
this.selectOptionListID = getUuidShort();
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
componentWillUnmount() {
|
|
@@ -325,11 +327,11 @@ class Select extends BaseComponent {
|
|
|
325
327
|
}
|
|
326
328
|
|
|
327
329
|
componentDidUpdate(prevProps, prevState) {
|
|
328
|
-
var
|
|
330
|
+
var _context11, _context12;
|
|
329
331
|
|
|
330
|
-
const prevChildrenKeys = _mapInstanceProperty(
|
|
332
|
+
const prevChildrenKeys = _mapInstanceProperty(_context11 = React.Children.toArray(prevProps.children)).call(_context11, child => child.key);
|
|
331
333
|
|
|
332
|
-
const nowChildrenKeys = _mapInstanceProperty(
|
|
334
|
+
const nowChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(this.props.children)).call(_context12, child => child.key);
|
|
333
335
|
|
|
334
336
|
let isOptionsChanged = false;
|
|
335
337
|
|
|
@@ -575,7 +577,7 @@ class Select extends BaseComponent {
|
|
|
575
577
|
}
|
|
576
578
|
|
|
577
579
|
renderOptions(children) {
|
|
578
|
-
var
|
|
580
|
+
var _context13;
|
|
579
581
|
|
|
580
582
|
const {
|
|
581
583
|
dropdownMinWidth,
|
|
@@ -613,7 +615,7 @@ class Select extends BaseComponent {
|
|
|
613
615
|
});
|
|
614
616
|
const isEmpty = !options.length || !_someInstanceProperty(options).call(options, item => item._show);
|
|
615
617
|
return /*#__PURE__*/React.createElement("div", {
|
|
616
|
-
id: _concatInstanceProperty(
|
|
618
|
+
id: _concatInstanceProperty(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
|
|
617
619
|
className: dropdownClassName,
|
|
618
620
|
style: style
|
|
619
621
|
}, outerTopSlot, /*#__PURE__*/React.createElement("div", {
|
|
@@ -847,7 +849,7 @@ class Select extends BaseComponent {
|
|
|
847
849
|
}
|
|
848
850
|
|
|
849
851
|
renderSelection() {
|
|
850
|
-
var
|
|
852
|
+
var _context14;
|
|
851
853
|
|
|
852
854
|
const {
|
|
853
855
|
disabled,
|
|
@@ -931,7 +933,7 @@ class Select extends BaseComponent {
|
|
|
931
933
|
role: "combobox",
|
|
932
934
|
"aria-disabled": disabled,
|
|
933
935
|
"aria-expanded": isOpen,
|
|
934
|
-
"aria-controls": _concatInstanceProperty(
|
|
936
|
+
"aria-controls": _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
|
|
935
937
|
"aria-haspopup": "listbox",
|
|
936
938
|
"aria-label": "select value",
|
|
937
939
|
"aria-invalid": this.props['aria-invalid'],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
|
|
2
|
+
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
|
|
3
3
|
export interface HeadTableProps {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
anyColumnFixed?: boolean;
|
|
@@ -15,6 +15,7 @@ export interface HeadTableProps {
|
|
|
15
15
|
selectedRowKeysSet: Set<any>;
|
|
16
16
|
showHeader?: boolean;
|
|
17
17
|
onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
|
|
18
|
+
onHeaderRow?: OnHeaderRow<any>;
|
|
18
19
|
}
|
|
19
20
|
declare const _default: React.ForwardRefExoticComponent<Pick<HeadTableProps, keyof HeadTableProps> & React.RefAttributes<HTMLDivElement>>;
|
|
20
21
|
export default _default;
|
|
@@ -96,7 +96,8 @@ HeadTable.propTypes = {
|
|
|
96
96
|
}),
|
|
97
97
|
selectedRowKeysSet: PropTypes.instanceOf(_Set).isRequired,
|
|
98
98
|
showHeader: PropTypes.bool,
|
|
99
|
-
onDidUpdate: PropTypes.func
|
|
99
|
+
onDidUpdate: PropTypes.func,
|
|
100
|
+
onHeaderRow: PropTypes.func
|
|
100
101
|
};
|
|
101
102
|
HeadTable.defaultProps = {
|
|
102
103
|
handleBodyScroll: _noop
|
package/lib/es/table/Table.js
CHANGED
|
@@ -658,6 +658,7 @@ class Table extends BaseComponent {
|
|
|
658
658
|
components,
|
|
659
659
|
headerRef,
|
|
660
660
|
bodyRef,
|
|
661
|
+
onHeaderRow,
|
|
661
662
|
rowSelection,
|
|
662
663
|
dataSource,
|
|
663
664
|
bodyHasScrollBar,
|
|
@@ -678,6 +679,7 @@ class Table extends BaseComponent {
|
|
|
678
679
|
scroll: scroll,
|
|
679
680
|
showHeader: showHeader,
|
|
680
681
|
selectedRowKeysSet: selectedRowKeysSet,
|
|
682
|
+
onHeaderRow: onHeaderRow,
|
|
681
683
|
dataSource: dataSource,
|
|
682
684
|
bodyHasScrollBar: bodyHasScrollBar
|
|
683
685
|
}) : null;
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.10.2
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation": "2.10.
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.10.2
|
|
19
|
-
"@douyinfe/semi-foundation": "2.10.
|
|
20
|
-
"@douyinfe/semi-icons": "2.10.
|
|
21
|
-
"@douyinfe/semi-illustrations": "2.10.
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.10.
|
|
17
|
+
"@douyinfe/semi-animation": "2.10.2",
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.10.2",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.10.2",
|
|
20
|
+
"@douyinfe/semi-icons": "2.10.2",
|
|
21
|
+
"@douyinfe/semi-illustrations": "2.10.2",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.10.2",
|
|
23
23
|
"@types/react-window": "^1.8.2",
|
|
24
24
|
"async-validator": "^3.5.0",
|
|
25
25
|
"classnames": "^2.2.6",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "00b27ff43fe6ed5d775d5849bd0adc4c4c5ea231",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
76
76
|
"@babel/preset-env": "^7.15.8",
|
|
77
77
|
"@babel/preset-react": "^7.14.5",
|
|
78
|
-
"@douyinfe/semi-scss-compile": "2.10.
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.10.2",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@types/lodash": "^4.14.176",
|
|
81
81
|
"babel-loader": "^8.2.2",
|
package/select/index.tsx
CHANGED
|
@@ -28,6 +28,7 @@ import { isSemiIcon } from '../_utils';
|
|
|
28
28
|
import { Subtract } from 'utility-types';
|
|
29
29
|
|
|
30
30
|
import warning from '@douyinfe/semi-foundation/utils/warning';
|
|
31
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/utils/uuid';
|
|
31
32
|
|
|
32
33
|
import '@douyinfe/semi-foundation/select/select.scss';
|
|
33
34
|
import { Locale } from '../locale/interface';
|
|
@@ -340,7 +341,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
340
341
|
isHovering: false,
|
|
341
342
|
};
|
|
342
343
|
/* Generate random string */
|
|
343
|
-
this.selectOptionListID =
|
|
344
|
+
this.selectOptionListID = '';
|
|
344
345
|
this.virtualizeListRef = React.createRef();
|
|
345
346
|
this.inputRef = React.createRef();
|
|
346
347
|
this.triggerRef = React.createRef();
|
|
@@ -559,6 +560,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
559
560
|
|
|
560
561
|
componentDidMount() {
|
|
561
562
|
this.foundation.init();
|
|
563
|
+
this.selectOptionListID = getUuidShort();
|
|
562
564
|
}
|
|
563
565
|
|
|
564
566
|
componentWillUnmount() {
|
package/table/HeadTable.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
|
|
7
7
|
import ColGroup from './ColGroup';
|
|
8
8
|
import TableHeader from './TableHeader';
|
|
9
|
-
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
|
|
9
|
+
import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
|
|
10
10
|
|
|
11
11
|
export interface HeadTableProps {
|
|
12
12
|
[x: string]: any;
|
|
@@ -23,6 +23,7 @@ export interface HeadTableProps {
|
|
|
23
23
|
selectedRowKeysSet: Set<any>;
|
|
24
24
|
showHeader?: boolean;
|
|
25
25
|
onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
|
|
26
|
+
onHeaderRow?: OnHeaderRow<any>;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -46,6 +47,7 @@ class HeadTable extends React.PureComponent<HeadTableProps> {
|
|
|
46
47
|
selectedRowKeysSet: PropTypes.instanceOf(Set).isRequired, // Useful when update is selected
|
|
47
48
|
showHeader: PropTypes.bool,
|
|
48
49
|
onDidUpdate: PropTypes.func,
|
|
50
|
+
onHeaderRow: PropTypes.func,
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
static defaultProps = {
|
package/table/Table.tsx
CHANGED
|
@@ -1089,6 +1089,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1089
1089
|
components,
|
|
1090
1090
|
headerRef,
|
|
1091
1091
|
bodyRef,
|
|
1092
|
+
onHeaderRow,
|
|
1092
1093
|
rowSelection,
|
|
1093
1094
|
dataSource,
|
|
1094
1095
|
bodyHasScrollBar,
|
|
@@ -1110,6 +1111,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1110
1111
|
scroll={scroll}
|
|
1111
1112
|
showHeader={showHeader}
|
|
1112
1113
|
selectedRowKeysSet={selectedRowKeysSet}
|
|
1114
|
+
onHeaderRow={onHeaderRow}
|
|
1113
1115
|
dataSource={dataSource}
|
|
1114
1116
|
bodyHasScrollBar={bodyHasScrollBar}
|
|
1115
1117
|
/>
|