@douyinfe/semi-ui 2.47.0 → 2.47.1
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 +3 -1
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +22 -11
- 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/dropdown/dropdownItem.js +2 -1
- package/lib/cjs/form/baseForm.js +2 -2
- package/lib/cjs/select/utils.d.ts +1 -1
- package/lib/cjs/select/utils.js +16 -4
- package/lib/cjs/table/HeadTable.js +2 -4
- package/lib/es/dropdown/dropdownItem.js +2 -1
- package/lib/es/form/baseForm.js +2 -2
- package/lib/es/select/utils.d.ts +1 -1
- package/lib/es/select/utils.js +16 -4
- package/lib/es/table/HeadTable.js +2 -4
- package/package.json +8 -8
|
@@ -46,8 +46,9 @@ class DropdownItem extends _baseComponent.default {
|
|
|
46
46
|
['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
|
|
47
47
|
if (eventName === "onClick") {
|
|
48
48
|
events["onMouseDown"] = e => {
|
|
49
|
+
var _a, _b;
|
|
49
50
|
if (e.button === 0) {
|
|
50
|
-
this.props[eventName](e);
|
|
51
|
+
(_b = (_a = this.props)[eventName]) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
} else {
|
package/lib/cjs/form/baseForm.js
CHANGED
|
@@ -181,7 +181,7 @@ class Form extends _baseComponent.default {
|
|
|
181
181
|
[prefix + '-vertical']: layout === 'vertical',
|
|
182
182
|
[prefix + '-horizontal']: layout === 'horizontal'
|
|
183
183
|
});
|
|
184
|
-
const
|
|
184
|
+
const shouldAppendRow = wrapperCol && labelCol;
|
|
185
185
|
const formContent = /*#__PURE__*/_react.default.createElement("form", Object.assign({
|
|
186
186
|
style: style
|
|
187
187
|
}, rest, {
|
|
@@ -197,7 +197,7 @@ class Form extends _baseComponent.default {
|
|
|
197
197
|
value: this.formApi
|
|
198
198
|
}, /*#__PURE__*/_react.default.createElement(_context.FormStateContext.Provider, {
|
|
199
199
|
value: formState
|
|
200
|
-
},
|
|
200
|
+
}, shouldAppendRow ? withRowForm : formContent)));
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
Form.propTypes = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OptionProps } from './option';
|
|
3
3
|
import { OptionGroupProps } from './optionGroup';
|
|
4
|
-
declare const generateOption: (child: React.ReactElement, parent: any, index: number) => OptionProps;
|
|
4
|
+
declare const generateOption: (child: React.ReactElement, parent: any, index: number, newKey?: string | number) => OptionProps;
|
|
5
5
|
declare const getOptionsFromGroup: (selectChildren: React.ReactNode) => {
|
|
6
6
|
optionGroups: OptionGroupProps[];
|
|
7
7
|
options: OptionProps[];
|
package/lib/cjs/select/utils.js
CHANGED
|
@@ -15,7 +15,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
15
15
|
}
|
|
16
16
|
return t;
|
|
17
17
|
};
|
|
18
|
-
const generateOption = (child, parent, index) => {
|
|
18
|
+
const generateOption = (child, parent, index, newKey) => {
|
|
19
19
|
const childProps = child.props;
|
|
20
20
|
if (!child || !childProps) {
|
|
21
21
|
return null;
|
|
@@ -33,7 +33,7 @@ const generateOption = (child, parent, index) => {
|
|
|
33
33
|
// Props are collected from ReactNode, after React.Children.toArray
|
|
34
34
|
// no need to determine whether the key exists in child
|
|
35
35
|
// Even if the user does not explicitly declare it, React will always generate a key.
|
|
36
|
-
option._keyInJsx = child.key;
|
|
36
|
+
option._keyInJsx = newKey || child.key;
|
|
37
37
|
return option;
|
|
38
38
|
};
|
|
39
39
|
exports.generateOption = generateOption;
|
|
@@ -65,10 +65,22 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
65
65
|
children
|
|
66
66
|
} = _a,
|
|
67
67
|
restGroupProps = __rest(_a, ["children"]);
|
|
68
|
+
let originKeys = [];
|
|
69
|
+
if (Array.isArray(children)) {
|
|
70
|
+
// if group has children > 1
|
|
71
|
+
originKeys = children.map(item => item.key);
|
|
72
|
+
} else {
|
|
73
|
+
originKeys.push(children.key);
|
|
74
|
+
}
|
|
68
75
|
children = _react.default.Children.toArray(children);
|
|
69
|
-
const childrenOption = children.map(option => {
|
|
76
|
+
const childrenOption = children.map((option, index) => {
|
|
77
|
+
let newKey = option.key;
|
|
78
|
+
if (originKeys[index] === null) {
|
|
79
|
+
newKey = child.key + '' + option.key; // if option in group and didn't set key, concat parent key to avoid conflict (default generate key just like .0, .1)
|
|
80
|
+
}
|
|
81
|
+
|
|
70
82
|
optionIndex++;
|
|
71
|
-
return generateOption(option, restGroupProps, optionIndex);
|
|
83
|
+
return generateOption(option, restGroupProps, optionIndex, newKey);
|
|
72
84
|
});
|
|
73
85
|
const group = Object.assign(Object.assign({}, child.props), {
|
|
74
86
|
children: childrenOption,
|
|
@@ -37,9 +37,6 @@ class HeadTable extends _react.default.PureComponent {
|
|
|
37
37
|
bodyHasScrollBar,
|
|
38
38
|
sticky
|
|
39
39
|
} = this.props;
|
|
40
|
-
if (!showHeader) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
40
|
const Table = (0, _get2.default)(components, 'header.outer', 'table');
|
|
44
41
|
const x = (0, _get2.default)(scroll, 'x');
|
|
45
42
|
const headStyle = {};
|
|
@@ -60,7 +57,8 @@ class HeadTable extends _react.default.PureComponent {
|
|
|
60
57
|
onDidUpdate: onDidUpdate
|
|
61
58
|
}));
|
|
62
59
|
const headTableCls = (0, _classnames.default)(`${prefixCls}-header`, {
|
|
63
|
-
[`${prefixCls}-header-sticky`]: sticky
|
|
60
|
+
[`${prefixCls}-header-sticky`]: sticky,
|
|
61
|
+
[`${prefixCls}-header-hidden`]: !showHeader
|
|
64
62
|
});
|
|
65
63
|
const stickyTop = (0, _get2.default)(sticky, 'top', 0);
|
|
66
64
|
if (typeof stickyTop === 'number') {
|
|
@@ -39,8 +39,9 @@ class DropdownItem extends BaseComponent {
|
|
|
39
39
|
['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
|
|
40
40
|
if (eventName === "onClick") {
|
|
41
41
|
events["onMouseDown"] = e => {
|
|
42
|
+
var _a, _b;
|
|
42
43
|
if (e.button === 0) {
|
|
43
|
-
this.props[eventName](e);
|
|
44
|
+
(_b = (_a = this.props)[eventName]) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
47
|
} else {
|
package/lib/es/form/baseForm.js
CHANGED
|
@@ -174,7 +174,7 @@ class Form extends BaseComponent {
|
|
|
174
174
|
[prefix + '-vertical']: layout === 'vertical',
|
|
175
175
|
[prefix + '-horizontal']: layout === 'horizontal'
|
|
176
176
|
});
|
|
177
|
-
const
|
|
177
|
+
const shouldAppendRow = wrapperCol && labelCol;
|
|
178
178
|
const formContent = /*#__PURE__*/React.createElement("form", Object.assign({
|
|
179
179
|
style: style
|
|
180
180
|
}, rest, {
|
|
@@ -190,7 +190,7 @@ class Form extends BaseComponent {
|
|
|
190
190
|
value: this.formApi
|
|
191
191
|
}, /*#__PURE__*/React.createElement(FormStateContext.Provider, {
|
|
192
192
|
value: formState
|
|
193
|
-
},
|
|
193
|
+
}, shouldAppendRow ? withRowForm : formContent)));
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
Form.propTypes = {
|
package/lib/es/select/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OptionProps } from './option';
|
|
3
3
|
import { OptionGroupProps } from './optionGroup';
|
|
4
|
-
declare const generateOption: (child: React.ReactElement, parent: any, index: number) => OptionProps;
|
|
4
|
+
declare const generateOption: (child: React.ReactElement, parent: any, index: number, newKey?: string | number) => OptionProps;
|
|
5
5
|
declare const getOptionsFromGroup: (selectChildren: React.ReactNode) => {
|
|
6
6
|
optionGroups: OptionGroupProps[];
|
|
7
7
|
options: OptionProps[];
|
package/lib/es/select/utils.js
CHANGED
|
@@ -8,7 +8,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
8
8
|
};
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
11
|
-
const generateOption = (child, parent, index) => {
|
|
11
|
+
const generateOption = (child, parent, index, newKey) => {
|
|
12
12
|
const childProps = child.props;
|
|
13
13
|
if (!child || !childProps) {
|
|
14
14
|
return null;
|
|
@@ -26,7 +26,7 @@ const generateOption = (child, parent, index) => {
|
|
|
26
26
|
// Props are collected from ReactNode, after React.Children.toArray
|
|
27
27
|
// no need to determine whether the key exists in child
|
|
28
28
|
// Even if the user does not explicitly declare it, React will always generate a key.
|
|
29
|
-
option._keyInJsx = child.key;
|
|
29
|
+
option._keyInJsx = newKey || child.key;
|
|
30
30
|
return option;
|
|
31
31
|
};
|
|
32
32
|
const getOptionsFromGroup = selectChildren => {
|
|
@@ -57,10 +57,22 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
57
57
|
children
|
|
58
58
|
} = _a,
|
|
59
59
|
restGroupProps = __rest(_a, ["children"]);
|
|
60
|
+
let originKeys = [];
|
|
61
|
+
if (Array.isArray(children)) {
|
|
62
|
+
// if group has children > 1
|
|
63
|
+
originKeys = children.map(item => item.key);
|
|
64
|
+
} else {
|
|
65
|
+
originKeys.push(children.key);
|
|
66
|
+
}
|
|
60
67
|
children = React.Children.toArray(children);
|
|
61
|
-
const childrenOption = children.map(option => {
|
|
68
|
+
const childrenOption = children.map((option, index) => {
|
|
69
|
+
let newKey = option.key;
|
|
70
|
+
if (originKeys[index] === null) {
|
|
71
|
+
newKey = child.key + '' + option.key; // if option in group and didn't set key, concat parent key to avoid conflict (default generate key just like .0, .1)
|
|
72
|
+
}
|
|
73
|
+
|
|
62
74
|
optionIndex++;
|
|
63
|
-
return generateOption(option, restGroupProps, optionIndex);
|
|
75
|
+
return generateOption(option, restGroupProps, optionIndex, newKey);
|
|
64
76
|
});
|
|
65
77
|
const group = Object.assign(Object.assign({}, child.props), {
|
|
66
78
|
children: childrenOption,
|
|
@@ -30,9 +30,6 @@ class HeadTable extends React.PureComponent {
|
|
|
30
30
|
bodyHasScrollBar,
|
|
31
31
|
sticky
|
|
32
32
|
} = this.props;
|
|
33
|
-
if (!showHeader) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
33
|
const Table = _get(components, 'header.outer', 'table');
|
|
37
34
|
const x = _get(scroll, 'x');
|
|
38
35
|
const headStyle = {};
|
|
@@ -53,7 +50,8 @@ class HeadTable extends React.PureComponent {
|
|
|
53
50
|
onDidUpdate: onDidUpdate
|
|
54
51
|
}));
|
|
55
52
|
const headTableCls = classnames(`${prefixCls}-header`, {
|
|
56
|
-
[`${prefixCls}-header-sticky`]: sticky
|
|
53
|
+
[`${prefixCls}-header-sticky`]: sticky,
|
|
54
|
+
[`${prefixCls}-header-hidden`]: !showHeader
|
|
57
55
|
});
|
|
58
56
|
const stickyTop = _get(sticky, 'top', 0);
|
|
59
57
|
if (typeof stickyTop === 'number') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.47.
|
|
3
|
+
"version": "2.47.1",
|
|
4
4
|
"description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"@dnd-kit/core": "^6.0.8",
|
|
21
21
|
"@dnd-kit/sortable": "^7.0.2",
|
|
22
22
|
"@dnd-kit/utilities": "^3.2.1",
|
|
23
|
-
"@douyinfe/semi-animation": "2.47.
|
|
24
|
-
"@douyinfe/semi-animation-react": "2.47.
|
|
25
|
-
"@douyinfe/semi-foundation": "2.47.
|
|
26
|
-
"@douyinfe/semi-icons": "2.47.
|
|
27
|
-
"@douyinfe/semi-illustrations": "2.47.
|
|
28
|
-
"@douyinfe/semi-theme-default": "2.47.
|
|
23
|
+
"@douyinfe/semi-animation": "2.47.1",
|
|
24
|
+
"@douyinfe/semi-animation-react": "2.47.1",
|
|
25
|
+
"@douyinfe/semi-foundation": "2.47.1",
|
|
26
|
+
"@douyinfe/semi-icons": "2.47.1",
|
|
27
|
+
"@douyinfe/semi-illustrations": "2.47.1",
|
|
28
|
+
"@douyinfe/semi-theme-default": "2.47.1",
|
|
29
29
|
"async-validator": "^3.5.0",
|
|
30
30
|
"classnames": "^2.2.6",
|
|
31
31
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
],
|
|
76
76
|
"author": "",
|
|
77
77
|
"license": "MIT",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "875fcccc849e3f6131d8d9352acd2c309f3a3a60",
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
81
|
"@babel/plugin-transform-runtime": "^7.15.8",
|