@douyinfe/semi-ui 2.17.0 → 2.19.0-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/anchor/index.tsx +1 -1
- package/anchor/link.tsx +3 -4
- package/autoComplete/__test__/autoComplete.test.js +6 -6
- package/autoComplete/index.tsx +3 -1
- package/autoComplete/option.tsx +164 -0
- package/calendar/__test__/calendar.test.js +21 -2
- package/calendar/_story/calendar.stories.js +31 -0
- package/calendar/index.tsx +3 -1
- package/calendar/interface.ts +2 -1
- package/carousel/index.tsx +5 -5
- package/checkbox/checkbox.tsx +10 -2
- package/dist/css/semi.css +174 -29
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +4190 -5430
- 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/form/_story/FieldProps/labelOptional.jsx +30 -0
- package/form/_story/form.stories.js +7 -0
- package/form/hoc/withField.tsx +1 -0
- package/form/label.tsx +21 -7
- package/gulpfile.js +3 -1
- package/lib/cjs/_base/base.css +35 -0
- package/lib/cjs/anchor/index.js +2 -1
- package/lib/cjs/anchor/link.d.ts +1 -1
- package/lib/cjs/anchor/link.js +9 -5
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.js +6 -3
- package/lib/cjs/autoComplete/option.d.ts +50 -0
- package/lib/cjs/autoComplete/option.js +218 -0
- package/lib/cjs/calendar/index.d.ts +2 -0
- package/lib/cjs/calendar/index.js +3 -1
- package/lib/cjs/calendar/interface.d.ts +2 -1
- package/lib/cjs/carousel/index.js +2 -2
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +9 -3
- package/lib/cjs/form/hoc/withField.js +2 -1
- package/lib/cjs/form/label.d.ts +8 -5
- package/lib/cjs/form/label.js +15 -4
- package/lib/cjs/locale/interface.d.ts +3 -0
- package/lib/cjs/locale/source/ar.js +3 -0
- package/lib/cjs/locale/source/de.js +3 -0
- package/lib/cjs/locale/source/en_GB.js +3 -0
- package/lib/cjs/locale/source/en_US.js +3 -0
- package/lib/cjs/locale/source/es.js +3 -0
- package/lib/cjs/locale/source/fr.js +3 -0
- package/lib/cjs/locale/source/id_ID.js +3 -0
- package/lib/cjs/locale/source/it.js +3 -0
- package/lib/cjs/locale/source/ja_JP.js +3 -0
- package/lib/cjs/locale/source/ko_KR.js +3 -0
- package/lib/cjs/locale/source/ms_MY.js +3 -0
- package/lib/cjs/locale/source/pt_BR.js +3 -0
- package/lib/cjs/locale/source/ru_RU.js +3 -0
- package/lib/cjs/locale/source/th_TH.js +3 -0
- package/lib/cjs/locale/source/tr_TR.js +3 -0
- package/lib/cjs/locale/source/vi_VN.js +3 -0
- package/lib/cjs/locale/source/zh_CN.js +3 -0
- package/lib/cjs/locale/source/zh_TW.js +3 -0
- package/lib/cjs/modal/Modal.js +0 -8
- package/lib/cjs/modal/ModalContent.js +4 -1
- package/lib/cjs/radio/radio.d.ts +2 -0
- package/lib/cjs/radio/radio.js +33 -8
- package/lib/cjs/table/ColumnFilter.js +4 -2
- package/lib/cjs/table/ColumnSorter.d.ts +1 -0
- package/lib/cjs/table/ColumnSorter.js +9 -6
- package/lib/cjs/table/Table.js +11 -4
- package/lib/cjs/tag/group.d.ts +3 -0
- package/lib/cjs/tag/group.js +24 -6
- package/lib/cjs/tag/index.d.ts +2 -1
- package/lib/cjs/tag/index.js +7 -5
- package/lib/cjs/tag/interface.d.ts +2 -1
- package/lib/cjs/tree/index.d.ts +3 -1
- package/lib/cjs/tree/index.js +23 -0
- package/lib/cjs/tree/interface.d.ts +4 -0
- package/lib/cjs/tree/treeNode.d.ts +4 -1
- package/lib/cjs/tree/treeNode.js +13 -4
- package/lib/es/_base/base.css +35 -0
- package/lib/es/anchor/index.js +2 -1
- package/lib/es/anchor/link.d.ts +1 -1
- package/lib/es/anchor/link.js +9 -5
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/autoComplete/index.js +6 -3
- package/lib/es/autoComplete/option.d.ts +50 -0
- package/lib/es/autoComplete/option.js +188 -0
- package/lib/es/calendar/index.d.ts +2 -0
- package/lib/es/calendar/index.js +3 -1
- package/lib/es/calendar/interface.d.ts +2 -1
- package/lib/es/carousel/index.js +2 -2
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +10 -4
- package/lib/es/form/hoc/withField.js +2 -1
- package/lib/es/form/label.d.ts +8 -5
- package/lib/es/form/label.js +13 -4
- package/lib/es/locale/interface.d.ts +3 -0
- package/lib/es/locale/source/ar.js +3 -0
- package/lib/es/locale/source/de.js +3 -0
- package/lib/es/locale/source/en_GB.js +3 -0
- package/lib/es/locale/source/en_US.js +3 -0
- package/lib/es/locale/source/es.js +3 -0
- package/lib/es/locale/source/fr.js +3 -0
- package/lib/es/locale/source/id_ID.js +3 -0
- package/lib/es/locale/source/it.js +3 -0
- package/lib/es/locale/source/ja_JP.js +3 -0
- package/lib/es/locale/source/ko_KR.js +3 -0
- package/lib/es/locale/source/ms_MY.js +3 -0
- package/lib/es/locale/source/pt_BR.js +3 -0
- package/lib/es/locale/source/ru_RU.js +3 -0
- package/lib/es/locale/source/th_TH.js +3 -0
- package/lib/es/locale/source/tr_TR.js +3 -0
- package/lib/es/locale/source/vi_VN.js +3 -0
- package/lib/es/locale/source/zh_CN.js +3 -0
- package/lib/es/locale/source/zh_TW.js +3 -0
- package/lib/es/modal/Modal.js +0 -8
- package/lib/es/modal/ModalContent.js +4 -1
- package/lib/es/radio/radio.d.ts +2 -0
- package/lib/es/radio/radio.js +31 -8
- package/lib/es/table/ColumnFilter.js +4 -2
- package/lib/es/table/ColumnSorter.d.ts +1 -0
- package/lib/es/table/ColumnSorter.js +9 -6
- package/lib/es/table/Table.js +10 -4
- package/lib/es/tag/group.d.ts +3 -0
- package/lib/es/tag/group.js +24 -6
- package/lib/es/tag/index.d.ts +2 -1
- package/lib/es/tag/index.js +7 -5
- package/lib/es/tag/interface.d.ts +2 -1
- package/lib/es/tree/index.d.ts +3 -1
- package/lib/es/tree/index.js +22 -0
- package/lib/es/tree/interface.d.ts +4 -0
- package/lib/es/tree/treeNode.d.ts +4 -1
- package/lib/es/tree/treeNode.js +13 -4
- package/locale/interface.ts +3 -0
- package/locale/source/ar.ts +3 -0
- package/locale/source/de.ts +3 -0
- package/locale/source/en_GB.ts +3 -0
- package/locale/source/en_US.ts +3 -0
- package/locale/source/es.ts +3 -0
- package/locale/source/fr.ts +3 -0
- package/locale/source/id_ID.ts +3 -0
- package/locale/source/it.ts +3 -0
- package/locale/source/ja_JP.ts +3 -0
- package/locale/source/ko_KR.ts +3 -0
- package/locale/source/ms_MY.ts +3 -0
- package/locale/source/pt_BR.ts +3 -0
- package/locale/source/ru_RU.ts +3 -0
- package/locale/source/th_TH.ts +3 -0
- package/locale/source/tr_TR.ts +4 -1
- package/locale/source/vi_VN.ts +3 -0
- package/locale/source/zh_CN.ts +3 -0
- package/locale/source/zh_TW.ts +3 -0
- package/modal/Modal.tsx +0 -6
- package/modal/ModalContent.tsx +4 -1
- package/modal/__test__/modal.test.js +1 -1
- package/modal/_story/__snapshots__/modal.stories.tsx.snap +203 -0
- package/package.json +7 -7
- package/radio/_story/radio.stories.js +2 -2
- package/radio/radio.tsx +27 -5
- package/rating/__test__/rating.test.js +1 -1
- package/select/__test__/select.test.js +11 -17
- package/select/_story/select.stories.js +6 -6
- package/steps/_story/steps.stories.js +3 -3
- package/switch/_story/switch.stories.js +4 -4
- package/switch/_story/switch.stories.tsx +4 -4
- package/table/ColumnFilter.tsx +2 -1
- package/table/ColumnSorter.tsx +16 -10
- package/table/Table.tsx +7 -4
- package/table/_story/v2/FixedFilter/index.tsx +106 -0
- package/table/_story/v2/FixedSorter/index.tsx +102 -0
- package/table/_story/v2/index.js +4 -2
- package/tag/_story/tag.stories.js +57 -1
- package/tag/group.tsx +20 -3
- package/tag/index.tsx +6 -5
- package/tag/interface.ts +2 -1
- package/transfer/_story/transfer.stories.js +2 -2
- package/tree/_story/tree.stories.js +152 -3
- package/tree/index.tsx +16 -1
- package/tree/interface.ts +6 -0
- package/tree/treeNode.tsx +11 -5
- package/upload/_story/upload.stories.js +2 -2
- package/webpack.config.js +13 -3
|
@@ -151,7 +151,8 @@ class Checkbox extends _baseComponent.default {
|
|
|
151
151
|
value,
|
|
152
152
|
role,
|
|
153
153
|
tabIndex,
|
|
154
|
-
id
|
|
154
|
+
id,
|
|
155
|
+
type
|
|
155
156
|
} = this.props;
|
|
156
157
|
const {
|
|
157
158
|
checked,
|
|
@@ -184,6 +185,9 @@ class Checkbox extends _baseComponent.default {
|
|
|
184
185
|
props.isCardType = isCardType;
|
|
185
186
|
props.isPureCardType = isPureCardType;
|
|
186
187
|
props['name'] = this.context.checkboxGroup.name;
|
|
188
|
+
} else {
|
|
189
|
+
props.isPureCardType = type === _constants.strings.TYPE_PURECARD;
|
|
190
|
+
props.isCardType = type === _constants.strings.TYPE_CARD || props.isPureCardType;
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
const prefix = prefixCls || _constants.checkboxClasses.PREFIX;
|
|
@@ -274,14 +278,16 @@ Checkbox.propTypes = {
|
|
|
274
278
|
index: _propTypes.default.number,
|
|
275
279
|
'aria-label': _propTypes.default.string,
|
|
276
280
|
tabIndex: _propTypes.default.number,
|
|
277
|
-
preventScroll: _propTypes.default.bool
|
|
281
|
+
preventScroll: _propTypes.default.bool,
|
|
282
|
+
type: _propTypes.default.string
|
|
278
283
|
};
|
|
279
284
|
Checkbox.defaultProps = {
|
|
280
285
|
defaultChecked: false,
|
|
281
286
|
indeterminate: false,
|
|
282
287
|
onChange: _noop2.default,
|
|
283
288
|
onMouseEnter: _noop2.default,
|
|
284
|
-
onMouseLeave: _noop2.default
|
|
289
|
+
onMouseLeave: _noop2.default,
|
|
290
|
+
type: 'default'
|
|
285
291
|
};
|
|
286
292
|
var _default = Checkbox;
|
|
287
293
|
exports.default = _default;
|
|
@@ -136,7 +136,8 @@ function withField(Component, opts) {
|
|
|
136
136
|
if (arrayFieldState) {
|
|
137
137
|
initVal = arrayFieldState.shouldUseInitValue && typeof initValue !== 'undefined' ? initValue : initValueInFormOpts;
|
|
138
138
|
}
|
|
139
|
-
} catch (err) {}
|
|
139
|
+
} catch (err) {} // FIXME typeof initVal
|
|
140
|
+
|
|
140
141
|
|
|
141
142
|
const [value, setValue, getVal] = (0, _index.useStateWithGetter)(typeof initVal !== undefined ? initVal : null);
|
|
142
143
|
const validateOnMount = (0, _includes.default)(trigger).call(trigger, 'mount');
|
package/lib/cjs/form/label.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
export interface LabelProps {
|
|
4
|
+
/** text-align of label */
|
|
5
|
+
align?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
4
9
|
id?: string;
|
|
5
10
|
/** Whether to display the required * symbol */
|
|
6
11
|
required?: boolean;
|
|
7
12
|
/** Content of label */
|
|
8
13
|
text?: React.ReactNode;
|
|
9
|
-
disabled?: boolean;
|
|
10
14
|
/** Used to configure the htmlFor attribute of the label tag */
|
|
11
15
|
name?: string;
|
|
12
|
-
/** text-align of label */
|
|
13
|
-
align?: string;
|
|
14
16
|
/** width of label */
|
|
15
17
|
width?: number | string;
|
|
16
18
|
style?: React.CSSProperties;
|
|
17
|
-
className?: string;
|
|
18
|
-
children?: React.ReactNode;
|
|
19
19
|
extra?: React.ReactNode;
|
|
20
|
+
optional?: boolean;
|
|
20
21
|
}
|
|
21
22
|
export default class Label extends PureComponent<LabelProps> {
|
|
22
23
|
static defaultProps: {
|
|
@@ -24,6 +25,7 @@ export default class Label extends PureComponent<LabelProps> {
|
|
|
24
25
|
name: string;
|
|
25
26
|
align: string;
|
|
26
27
|
className: string;
|
|
28
|
+
optional: boolean;
|
|
27
29
|
};
|
|
28
30
|
static propTypes: {
|
|
29
31
|
id: PropTypes.Requireable<string>;
|
|
@@ -37,6 +39,7 @@ export default class Label extends PureComponent<LabelProps> {
|
|
|
37
39
|
style: PropTypes.Requireable<object>;
|
|
38
40
|
className: PropTypes.Requireable<string>;
|
|
39
41
|
extra: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
42
|
+
optional: PropTypes.Requireable<boolean>;
|
|
40
43
|
};
|
|
41
44
|
render(): JSX.Element;
|
|
42
45
|
}
|
package/lib/cjs/form/label.js
CHANGED
|
@@ -22,6 +22,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
22
22
|
|
|
23
23
|
var _constants = require("@douyinfe/semi-foundation/lib/cjs/form/constants");
|
|
24
24
|
|
|
25
|
+
var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
|
|
26
|
+
|
|
25
27
|
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); }
|
|
26
28
|
|
|
27
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -41,7 +43,8 @@ class Label extends _react.PureComponent {
|
|
|
41
43
|
style,
|
|
42
44
|
className,
|
|
43
45
|
extra,
|
|
44
|
-
id
|
|
46
|
+
id,
|
|
47
|
+
optional
|
|
45
48
|
} = this.props;
|
|
46
49
|
const labelCls = (0, _classnames.default)(className, {
|
|
47
50
|
["".concat(prefixCls, "-field-label")]: true,
|
|
@@ -54,10 +57,16 @@ class Label extends _react.PureComponent {
|
|
|
54
57
|
const labelStyle = style ? style : {};
|
|
55
58
|
width ? labelStyle.width = width : null;
|
|
56
59
|
|
|
60
|
+
const optionalText = /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
|
|
61
|
+
componentName: "Form"
|
|
62
|
+
}, locale => /*#__PURE__*/_react.default.createElement("span", {
|
|
63
|
+
className: "".concat(prefixCls, "-field-label-optional-text")
|
|
64
|
+
}, locale.optional));
|
|
65
|
+
|
|
57
66
|
const textContent = /*#__PURE__*/_react.default.createElement("div", {
|
|
58
67
|
className: "".concat(prefixCls, "-field-label-text"),
|
|
59
68
|
"x-semi-prop": "label"
|
|
60
|
-
}, typeof text !== 'undefined' ? text : children);
|
|
69
|
+
}, typeof text !== 'undefined' ? text : children, optional ? optionalText : null);
|
|
61
70
|
|
|
62
71
|
const contentWithExtra = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, textContent, /*#__PURE__*/_react.default.createElement("div", {
|
|
63
72
|
className: "".concat(prefixCls, "-field-label-extra")
|
|
@@ -78,7 +87,8 @@ Label.defaultProps = {
|
|
|
78
87
|
required: false,
|
|
79
88
|
name: '',
|
|
80
89
|
align: 'left',
|
|
81
|
-
className: ''
|
|
90
|
+
className: '',
|
|
91
|
+
optional: false
|
|
82
92
|
};
|
|
83
93
|
Label.propTypes = {
|
|
84
94
|
id: _propTypes.default.string,
|
|
@@ -91,5 +101,6 @@ Label.propTypes = {
|
|
|
91
101
|
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
92
102
|
style: _propTypes.default.object,
|
|
93
103
|
className: _propTypes.default.string,
|
|
94
|
-
extra: _propTypes.default.node
|
|
104
|
+
extra: _propTypes.default.node,
|
|
105
|
+
optional: _propTypes.default.bool
|
|
95
106
|
};
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -164,14 +164,6 @@ class Modal extends _baseComponent.default {
|
|
|
164
164
|
let style = styleFromProps;
|
|
165
165
|
const maskStyle = maskStyleFromProps;
|
|
166
166
|
const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
|
|
167
|
-
|
|
168
|
-
if (this.props.centered) {
|
|
169
|
-
style = (0, _assign.default)({
|
|
170
|
-
transform: 'translateY(-50%)',
|
|
171
|
-
top: '50%'
|
|
172
|
-
}, style);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
167
|
let wrapperStyle = {
|
|
176
168
|
zIndex
|
|
177
169
|
};
|
|
@@ -376,7 +376,10 @@ class ModalContent extends _baseComponent.default {
|
|
|
376
376
|
}, this.getMaskElement(), /*#__PURE__*/_react.default.createElement("div", {
|
|
377
377
|
role: "none",
|
|
378
378
|
tabIndex: -1,
|
|
379
|
-
className:
|
|
379
|
+
className: (0, _classnames.default)({
|
|
380
|
+
["".concat(_constants.cssClasses.DIALOG, "-wrap")]: true,
|
|
381
|
+
["".concat(_constants.cssClasses.DIALOG, "-wrap-center")]: this.props.centered
|
|
382
|
+
}),
|
|
380
383
|
onClick: maskClosable ? this.onMaskClick : null,
|
|
381
384
|
onMouseUp: maskClosable ? this.onMaskMouseUp : null
|
|
382
385
|
}, this.getDialogElement())); // eslint-disable-next-line max-len
|
package/lib/cjs/radio/radio.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface RadioState {
|
|
|
39
39
|
addonId?: string;
|
|
40
40
|
extraId?: string;
|
|
41
41
|
focusVisible?: boolean;
|
|
42
|
+
checked?: boolean;
|
|
42
43
|
}
|
|
43
44
|
export { RadioChangeEvent };
|
|
44
45
|
declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
@@ -71,6 +72,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
71
72
|
addonId: string;
|
|
72
73
|
extraId: string;
|
|
73
74
|
constructor(props: RadioProps);
|
|
75
|
+
componentDidUpdate(prevProps: RadioProps): void;
|
|
74
76
|
get adapter(): RadioAdapter;
|
|
75
77
|
isInGroup(): {
|
|
76
78
|
value?: string | number;
|
package/lib/cjs/radio/radio.js
CHANGED
|
@@ -14,6 +14,10 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
14
|
|
|
15
15
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
16
16
|
|
|
17
|
+
var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
|
|
18
|
+
|
|
19
|
+
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
20
|
+
|
|
17
21
|
var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
18
22
|
|
|
19
23
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -53,6 +57,7 @@ class Radio extends _baseComponent.default {
|
|
|
53
57
|
radioGroup.onChange && radioGroup.onChange(e);
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
!('checked' in this.props) && this.foundation.setChecked(e.target.checked);
|
|
56
61
|
onChange && onChange(e);
|
|
57
62
|
};
|
|
58
63
|
|
|
@@ -77,12 +82,23 @@ class Radio extends _baseComponent.default {
|
|
|
77
82
|
this.state = {
|
|
78
83
|
hover: false,
|
|
79
84
|
addonId: props.addonId,
|
|
80
|
-
extraId: props.extraId
|
|
85
|
+
extraId: props.extraId,
|
|
86
|
+
checked: props.checked || props.defaultChecked || false
|
|
81
87
|
};
|
|
82
88
|
this.foundation = new _radioFoundation.default(this.adapter);
|
|
83
89
|
this.radioEntity = null;
|
|
84
90
|
}
|
|
85
91
|
|
|
92
|
+
componentDidUpdate(prevProps) {
|
|
93
|
+
if (this.props.checked !== prevProps.checked) {
|
|
94
|
+
if ((0, _isUndefined2.default)(this.props.checked)) {
|
|
95
|
+
this.foundation.setChecked(false);
|
|
96
|
+
} else if ((0, _isBoolean2.default)(this.props.checked)) {
|
|
97
|
+
this.foundation.setChecked(this.props.checked);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
86
102
|
get adapter() {
|
|
87
103
|
return (0, _assign.default)((0, _assign.default)({}, super.adapter), {
|
|
88
104
|
setHover: hover => {
|
|
@@ -97,6 +113,11 @@ class Radio extends _baseComponent.default {
|
|
|
97
113
|
})
|
|
98
114
|
});
|
|
99
115
|
},
|
|
116
|
+
setChecked: checked => {
|
|
117
|
+
this.setState({
|
|
118
|
+
checked
|
|
119
|
+
});
|
|
120
|
+
},
|
|
100
121
|
setExtraId: () => {
|
|
101
122
|
this.setState({
|
|
102
123
|
extraId: (0, _uuid.getUuidShort)({
|
|
@@ -131,7 +152,6 @@ class Radio extends _baseComponent.default {
|
|
|
131
152
|
const {
|
|
132
153
|
addonClassName,
|
|
133
154
|
addonStyle,
|
|
134
|
-
checked,
|
|
135
155
|
disabled,
|
|
136
156
|
style,
|
|
137
157
|
className,
|
|
@@ -149,9 +169,13 @@ class Radio extends _baseComponent.default {
|
|
|
149
169
|
hover: isHover,
|
|
150
170
|
addonId,
|
|
151
171
|
extraId,
|
|
152
|
-
focusVisible
|
|
172
|
+
focusVisible,
|
|
173
|
+
checked
|
|
153
174
|
} = this.state;
|
|
154
|
-
|
|
175
|
+
const props = {
|
|
176
|
+
checked,
|
|
177
|
+
disabled
|
|
178
|
+
};
|
|
155
179
|
|
|
156
180
|
if (this.isInGroup()) {
|
|
157
181
|
realChecked = this.context.radioGroup.value === propValue;
|
|
@@ -162,16 +186,17 @@ class Radio extends _baseComponent.default {
|
|
|
162
186
|
isPureCardRadioGroup = this.context.radioGroup.isPureCardRadio;
|
|
163
187
|
buttonSize = this.context.radioGroup.buttonSize;
|
|
164
188
|
realPrefixCls = prefixCls || this.context.radioGroup.prefixCls;
|
|
165
|
-
props =
|
|
166
|
-
|
|
167
|
-
disabled: isDisabled
|
|
168
|
-
};
|
|
189
|
+
props.checked = realChecked;
|
|
190
|
+
props.disabled = isDisabled;
|
|
169
191
|
} else {
|
|
170
192
|
realChecked = checked;
|
|
171
193
|
isDisabled = disabled;
|
|
172
194
|
realMode = mode;
|
|
173
195
|
isButtonRadioComponent = type === 'button';
|
|
174
196
|
realPrefixCls = prefixCls;
|
|
197
|
+
isButtonRadioGroup = type === _constants.strings.TYPE_BUTTON;
|
|
198
|
+
isPureCardRadioGroup = type === _constants.strings.TYPE_PURECARD;
|
|
199
|
+
isCardRadioGroup = type === _constants.strings.TYPE_CARD || isPureCardRadioGroup;
|
|
175
200
|
}
|
|
176
201
|
|
|
177
202
|
const isButtonRadio = typeof isButtonRadioGroup === 'undefined' ? isButtonRadioComponent : isButtonRadioGroup;
|
|
@@ -179,12 +179,14 @@ function ColumnFilter() {
|
|
|
179
179
|
} else {
|
|
180
180
|
iconElem = /*#__PURE__*/_react.default.createElement("div", {
|
|
181
181
|
className: finalCls
|
|
182
|
-
},
|
|
182
|
+
}, '\u200b'
|
|
183
|
+
/* ZWSP(zero-width space) */
|
|
184
|
+
, /*#__PURE__*/_react.default.createElement(_semiIcons.IconFilter, {
|
|
183
185
|
role: "button",
|
|
184
186
|
"aria-label": "Filter data with this column",
|
|
185
187
|
"aria-haspopup": "listbox",
|
|
186
188
|
tabIndex: -1,
|
|
187
|
-
size: "
|
|
189
|
+
size: "default"
|
|
188
190
|
}));
|
|
189
191
|
}
|
|
190
192
|
|
|
@@ -7,6 +7,7 @@ export interface ColumnSorterProps {
|
|
|
7
7
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
8
8
|
prefixCls?: string;
|
|
9
9
|
sortOrder?: SortOrder;
|
|
10
|
+
title?: React.ReactNode;
|
|
10
11
|
}
|
|
11
12
|
export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
12
13
|
static propTypes: {
|
|
@@ -40,9 +40,10 @@ class ColumnSorter extends _react.PureComponent {
|
|
|
40
40
|
prefixCls,
|
|
41
41
|
onClick,
|
|
42
42
|
sortOrder,
|
|
43
|
-
style
|
|
43
|
+
style,
|
|
44
|
+
title
|
|
44
45
|
} = this.props;
|
|
45
|
-
const iconBtnSize = '
|
|
46
|
+
const iconBtnSize = 'default';
|
|
46
47
|
const upCls = (0, _classnames.default)("".concat(prefixCls, "-column-sorter-up"), {
|
|
47
48
|
on: sortOrder === _constants.strings.SORT_DIRECTIONS[0]
|
|
48
49
|
});
|
|
@@ -61,11 +62,13 @@ class ColumnSorter extends _react.PureComponent {
|
|
|
61
62
|
role: 'button'
|
|
62
63
|
}, ariaProps, {
|
|
63
64
|
tabIndex: -1,
|
|
64
|
-
|
|
65
|
-
className: "".concat(prefixCls, "-column-sorter"),
|
|
65
|
+
className: "".concat(prefixCls, "-column-sorter-wrapper"),
|
|
66
66
|
onClick: onClick,
|
|
67
67
|
onKeyPress: e => (0, _isEnterPress.default)(e) && onClick(e)
|
|
68
|
-
}), /*#__PURE__*/_react.default.createElement("
|
|
68
|
+
}), title, /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
style: style,
|
|
70
|
+
className: "".concat(prefixCls, "-column-sorter")
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
69
72
|
className: "".concat(upCls)
|
|
70
73
|
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCaretup, {
|
|
71
74
|
size: iconBtnSize
|
|
@@ -73,7 +76,7 @@ class ColumnSorter extends _react.PureComponent {
|
|
|
73
76
|
className: "".concat(downCls)
|
|
74
77
|
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCaretdown, {
|
|
75
78
|
size: iconBtnSize
|
|
76
|
-
})));
|
|
79
|
+
}))));
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
}
|
package/lib/cjs/table/Table.js
CHANGED
|
@@ -555,15 +555,24 @@ class Table extends _baseComponent.default {
|
|
|
555
555
|
const defaultSortOrder = (0, _get2.default)(curQuery, 'defaultSortOrder', false);
|
|
556
556
|
const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
557
557
|
|
|
558
|
+
const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
559
|
+
key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE
|
|
560
|
+
}, rawTitle);
|
|
561
|
+
|
|
558
562
|
if (typeof column.sorter === 'function' || column.sorter === true) {
|
|
563
|
+
// In order to increase the click hot area of sorting, when sorting is required & useFullRender is false,
|
|
564
|
+
// both the title and sorting areas are used as the click hot area for sorting。
|
|
559
565
|
const sorter = /*#__PURE__*/_react.default.createElement(_ColumnSorter.default, {
|
|
560
566
|
key: _constants.strings.DEFAULT_KEY_COLUMN_SORTER,
|
|
561
567
|
sortOrder: sortOrder,
|
|
562
|
-
onClick: e => _this.foundation.handleSort(column, e)
|
|
568
|
+
onClick: e => _this.foundation.handleSort(column, e),
|
|
569
|
+
title: TitleNode
|
|
563
570
|
});
|
|
564
571
|
|
|
565
572
|
useFullRender && (titleMap.sorter = sorter);
|
|
566
573
|
titleArr.push(sorter);
|
|
574
|
+
} else {
|
|
575
|
+
titleArr.push(TitleNode);
|
|
567
576
|
}
|
|
568
577
|
|
|
569
578
|
const stateFilteredValue = (0, _get2.default)(curQuery, 'filteredValue');
|
|
@@ -583,9 +592,7 @@ class Table extends _baseComponent.default {
|
|
|
583
592
|
titleArr.push(filter);
|
|
584
593
|
}
|
|
585
594
|
|
|
586
|
-
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr
|
|
587
|
-
key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE
|
|
588
|
-
}, rawTitle)) && titleArr;
|
|
595
|
+
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr;
|
|
589
596
|
column = (0, _assign.default)((0, _assign.default)({}, column), {
|
|
590
597
|
title: newTitle
|
|
591
598
|
});
|
package/lib/cjs/tag/group.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface TagGroupProps<T> {
|
|
|
14
14
|
popoverProps?: PopoverProps;
|
|
15
15
|
avatarShape?: AvatarShape;
|
|
16
16
|
mode?: string;
|
|
17
|
+
onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
|
|
17
18
|
}
|
|
18
19
|
export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
|
|
19
20
|
static defaultProps: {
|
|
@@ -21,6 +22,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
|
|
|
21
22
|
className: string;
|
|
22
23
|
size: string;
|
|
23
24
|
avatarShape: string;
|
|
25
|
+
onTagClose: () => any;
|
|
24
26
|
};
|
|
25
27
|
static propTypes: {
|
|
26
28
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -31,6 +33,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
|
|
|
31
33
|
tagList: PropTypes.Requireable<any[]>;
|
|
32
34
|
size: PropTypes.Requireable<string>;
|
|
33
35
|
mode: PropTypes.Requireable<string>;
|
|
36
|
+
onTagClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
37
|
showPopover: PropTypes.Requireable<boolean>;
|
|
35
38
|
popoverProps: PropTypes.Requireable<object>;
|
|
36
39
|
avatarShape: PropTypes.Requireable<string>;
|