@douyinfe/semi-ui 2.8.0-beta.0 → 2.9.0-beta.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/_base/_story/index.scss +0 -1
- package/badge/index.tsx +12 -3
- package/descriptions/index.tsx +4 -5
- package/descriptions/item.tsx +1 -1
- package/dist/css/semi.css +63 -16
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +231 -53
- 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/divider/__test__/divider.test.js +72 -0
- package/divider/_story/Demo.tsx +16 -0
- package/divider/_story/divider.stories.js +41 -0
- package/divider/_story/divider.stories.tsx +8 -0
- package/divider/index.tsx +72 -0
- package/form/_story/demo.jsx +9 -0
- package/index.ts +1 -0
- package/lib/cjs/badge/index.d.ts +9 -0
- package/lib/cjs/badge/index.js +34 -6
- package/lib/cjs/descriptions/index.d.ts +1 -2
- package/lib/cjs/descriptions/index.js +4 -3
- package/lib/cjs/descriptions/item.d.ts +1 -1
- package/lib/cjs/divider/index.d.ts +20 -0
- package/lib/cjs/divider/index.js +88 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +9 -0
- package/lib/cjs/slider/index.js +16 -12
- package/lib/cjs/tagInput/index.d.ts +1 -1
- package/lib/es/badge/index.d.ts +9 -0
- package/lib/es/badge/index.js +31 -6
- package/lib/es/descriptions/index.d.ts +1 -2
- package/lib/es/descriptions/index.js +4 -3
- package/lib/es/descriptions/item.d.ts +1 -1
- package/lib/es/divider/index.d.ts +20 -0
- package/lib/es/divider/index.js +68 -0
- package/lib/es/index.d.ts +1 -0
- package/lib/es/index.js +1 -0
- package/lib/es/slider/index.js +16 -12
- package/lib/es/tagInput/index.d.ts +1 -1
- package/package.json +11 -11
- package/select/__test__/select.test.js +16 -0
- package/slider/_story/slider.stories.js +28 -6
- package/slider/index.tsx +16 -11
- package/upload/_story/upload.stories.js +2 -3
package/lib/es/badge/index.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
+
import _noop from "lodash/noop";
|
|
1
2
|
import _isString from "lodash/isString";
|
|
2
3
|
import _isNumber from "lodash/isNumber";
|
|
4
|
+
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
5
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
6
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
7
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
8
|
+
|
|
9
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
10
|
+
var t = {};
|
|
11
|
+
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && _indexOfInstanceProperty(e).call(e, p) < 0) t[p] = s[p];
|
|
13
|
+
|
|
14
|
+
if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (_indexOfInstanceProperty(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
|
|
4
20
|
import React, { PureComponent } from 'react';
|
|
5
21
|
import cls from 'classnames';
|
|
6
22
|
import PropTypes from 'prop-types';
|
|
@@ -18,7 +34,8 @@ export default class Badge extends PureComponent {
|
|
|
18
34
|
|
|
19
35
|
const defaultPosition = direction === 'rtl' ? 'leftTop' : 'rightTop'; // eslint-disable-next-line max-len
|
|
20
36
|
|
|
21
|
-
const
|
|
37
|
+
const _a = this.props,
|
|
38
|
+
{
|
|
22
39
|
count,
|
|
23
40
|
dot,
|
|
24
41
|
type,
|
|
@@ -28,7 +45,9 @@ export default class Badge extends PureComponent {
|
|
|
28
45
|
style,
|
|
29
46
|
children,
|
|
30
47
|
className
|
|
31
|
-
} =
|
|
48
|
+
} = _a,
|
|
49
|
+
rest = __rest(_a, ["count", "dot", "type", "theme", "position", "overflowCount", "style", "children", "className"]);
|
|
50
|
+
|
|
32
51
|
const custom = count && !(_isNumber(count) || _isString(count));
|
|
33
52
|
const showBadge = count !== null && typeof count !== 'undefined';
|
|
34
53
|
const wrapper = cls(className, {
|
|
@@ -48,9 +67,9 @@ export default class Badge extends PureComponent {
|
|
|
48
67
|
content = count;
|
|
49
68
|
}
|
|
50
69
|
|
|
51
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
70
|
+
return /*#__PURE__*/React.createElement("span", _Object$assign({
|
|
52
71
|
className: prefixCls
|
|
53
|
-
}, children, /*#__PURE__*/React.createElement("span", {
|
|
72
|
+
}, rest), children, /*#__PURE__*/React.createElement("span", {
|
|
54
73
|
className: wrapper,
|
|
55
74
|
style: style
|
|
56
75
|
}, dot ? null : content));
|
|
@@ -67,11 +86,17 @@ Badge.propTypes = {
|
|
|
67
86
|
overflowCount: PropTypes.number,
|
|
68
87
|
style: PropTypes.object,
|
|
69
88
|
className: PropTypes.string,
|
|
70
|
-
children: PropTypes.node
|
|
89
|
+
children: PropTypes.node,
|
|
90
|
+
onClick: PropTypes.func,
|
|
91
|
+
onMouseEnter: PropTypes.func,
|
|
92
|
+
onMouseLeave: PropTypes.func
|
|
71
93
|
};
|
|
72
94
|
Badge.defaultProps = {
|
|
73
95
|
dot: false,
|
|
74
96
|
type: 'primary',
|
|
75
97
|
theme: 'solid',
|
|
76
|
-
className: ''
|
|
98
|
+
className: '',
|
|
99
|
+
onClick: () => _noop,
|
|
100
|
+
onMouseEnter: () => _noop,
|
|
101
|
+
onMouseLeave: () => _noop
|
|
77
102
|
};
|
|
@@ -6,8 +6,7 @@ import Item from './item';
|
|
|
6
6
|
export { DescriptionsItemProps } from './item';
|
|
7
7
|
export declare type DescriptionsSize = 'small' | 'medium' | 'large';
|
|
8
8
|
export interface Data {
|
|
9
|
-
|
|
10
|
-
key?: string | number;
|
|
9
|
+
key?: React.ReactNode;
|
|
11
10
|
value?: (() => React.ReactNode) | React.ReactNode;
|
|
12
11
|
hidden?: boolean;
|
|
13
12
|
}
|
|
@@ -29,10 +29,11 @@ class Descriptions extends PureComponent {
|
|
|
29
29
|
["".concat(prefixCls, "-double")]: row,
|
|
30
30
|
[_concatInstanceProperty(_context2 = "".concat(prefixCls, "-double-")).call(_context2, size)]: row
|
|
31
31
|
});
|
|
32
|
-
const childrenList = data && data.length ? _mapInstanceProperty(data).call(data, item => _isPlainObject(item) ? /*#__PURE__*/React.createElement(Item, _Object$assign({
|
|
33
|
-
key: item.key,
|
|
32
|
+
const childrenList = data && data.length ? _mapInstanceProperty(data).call(data, (item, index) => _isPlainObject(item) ? /*#__PURE__*/React.createElement(Item, _Object$assign({
|
|
34
33
|
itemKey: item.key
|
|
35
|
-
}, item
|
|
34
|
+
}, item, {
|
|
35
|
+
key: index
|
|
36
|
+
}), item.value) : null) : children;
|
|
36
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
37
38
|
className: classNames,
|
|
38
39
|
style: style
|
|
@@ -5,7 +5,7 @@ export interface DescriptionsItemProps {
|
|
|
5
5
|
hidden?: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
|
-
itemKey
|
|
8
|
+
itemKey?: React.ReactNode;
|
|
9
9
|
}
|
|
10
10
|
export default class Item extends PureComponent<DescriptionsItemProps> {
|
|
11
11
|
static propTypes: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import '@douyinfe/semi-foundation/lib/es/divider/divider.css';
|
|
3
|
+
export interface DividerProps {
|
|
4
|
+
/** The position of title inside divider */
|
|
5
|
+
align?: 'left' | 'right' | 'center';
|
|
6
|
+
/** space between divider and surroundings **/
|
|
7
|
+
margin?: number | string;
|
|
8
|
+
/** The wrapped title */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Style class name */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Whether line is dashed */
|
|
13
|
+
dashed?: boolean;
|
|
14
|
+
/** The direction type of divider */
|
|
15
|
+
layout?: 'horizontal' | 'vertical';
|
|
16
|
+
/** Divider inline style */
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
declare const Divider: React.FC<DividerProps>;
|
|
20
|
+
export default Divider;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
|
+
|
|
6
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
7
|
+
var t = {};
|
|
8
|
+
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && _indexOfInstanceProperty(e).call(e, p) < 0) t[p] = s[p];
|
|
10
|
+
|
|
11
|
+
if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
|
|
12
|
+
if (_indexOfInstanceProperty(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import cls from 'classnames';
|
|
19
|
+
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/divider/constants';
|
|
20
|
+
import '@douyinfe/semi-foundation/lib/es/divider/divider.css';
|
|
21
|
+
const prefixCls = cssClasses.PREFIX;
|
|
22
|
+
|
|
23
|
+
const Divider = props => {
|
|
24
|
+
var _context;
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
layout = 'horizontal',
|
|
28
|
+
dashed,
|
|
29
|
+
align = 'center',
|
|
30
|
+
className,
|
|
31
|
+
margin,
|
|
32
|
+
style,
|
|
33
|
+
children
|
|
34
|
+
} = props,
|
|
35
|
+
rest = __rest(props, ["layout", "dashed", "align", "className", "margin", "style", "children"]);
|
|
36
|
+
|
|
37
|
+
const dividerClassNames = cls("".concat(prefixCls, "-divider"), className, {
|
|
38
|
+
["".concat(prefixCls, "-divider-horizontal")]: layout === 'horizontal',
|
|
39
|
+
["".concat(prefixCls, "-divider-vertical")]: layout === 'vertical',
|
|
40
|
+
["".concat(prefixCls, "-divider-dashed")]: !!dashed,
|
|
41
|
+
["".concat(prefixCls, "-divider-with-text")]: children && layout === 'horizontal',
|
|
42
|
+
[_concatInstanceProperty(_context = "".concat(prefixCls, "-divider-with-text-")).call(_context, align)]: children && layout === 'horizontal'
|
|
43
|
+
});
|
|
44
|
+
let overrideDefaultStyle = {};
|
|
45
|
+
|
|
46
|
+
if (margin !== undefined) {
|
|
47
|
+
if (layout === 'vertical') {
|
|
48
|
+
overrideDefaultStyle = {
|
|
49
|
+
'marginLeft': margin,
|
|
50
|
+
'marginRight': margin
|
|
51
|
+
};
|
|
52
|
+
} else if (layout === 'horizontal') {
|
|
53
|
+
overrideDefaultStyle = {
|
|
54
|
+
'marginTop': margin,
|
|
55
|
+
'marginBottom': margin
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", _Object$assign({}, rest, {
|
|
61
|
+
className: dividerClassNames,
|
|
62
|
+
style: _Object$assign(_Object$assign({}, overrideDefaultStyle), style)
|
|
63
|
+
}), children && layout === 'horizontal' ? typeof children === 'string' ? /*#__PURE__*/React.createElement("span", {
|
|
64
|
+
className: "".concat(prefixCls, "-divider_inner-text")
|
|
65
|
+
}, children) : children : null);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default Divider;
|
package/lib/es/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { default as Collapsible } from './collapsible';
|
|
|
20
20
|
export { default as ConfigProvider } from './configProvider';
|
|
21
21
|
export { default as DatePicker } from './datePicker';
|
|
22
22
|
export { default as Descriptions } from './descriptions';
|
|
23
|
+
export { default as Divider } from './divider';
|
|
23
24
|
export { default as Empty } from './empty';
|
|
24
25
|
export { default as Modal } from './modal';
|
|
25
26
|
export { default as Dropdown } from './dropdown';
|
package/lib/es/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export { default as Collapsible } from './collapsible';
|
|
|
20
20
|
export { default as ConfigProvider } from './configProvider';
|
|
21
21
|
export { default as DatePicker } from './datePicker';
|
|
22
22
|
export { default as Descriptions } from './descriptions';
|
|
23
|
+
export { default as Divider } from './divider';
|
|
23
24
|
export { default as Empty } from './empty';
|
|
24
25
|
export { default as Modal } from './modal';
|
|
25
26
|
export { default as Dropdown } from './dropdown';
|
package/lib/es/slider/index.js
CHANGED
|
@@ -266,7 +266,10 @@ export default class Slider extends BaseComponent {
|
|
|
266
266
|
["".concat(prefixCls, "-dot-active")]: this.foundation.isMarkActive(Number(mark)) === 'active'
|
|
267
267
|
});
|
|
268
268
|
const markPercent = (Number(mark) - min) / (max - min);
|
|
269
|
-
return activeResult ?
|
|
269
|
+
return activeResult ?
|
|
270
|
+
/*#__PURE__*/
|
|
271
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
272
|
+
React.createElement("span", {
|
|
270
273
|
key: mark,
|
|
271
274
|
onClick: e => this.foundation.handleWrapClick(e),
|
|
272
275
|
className: markClass,
|
|
@@ -448,6 +451,7 @@ export default class Slider extends BaseComponent {
|
|
|
448
451
|
onHandleMove: function (mousePos, isMin) {
|
|
449
452
|
let stateChangeCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _noop;
|
|
450
453
|
let clickTrack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
454
|
+
let outPutValue = arguments.length > 4 ? arguments[4] : undefined;
|
|
451
455
|
|
|
452
456
|
const sliderDOMIsInRenderTree = _this.foundation.checkAndUpdateIsInRenderTreeState();
|
|
453
457
|
|
|
@@ -456,32 +460,32 @@ export default class Slider extends BaseComponent {
|
|
|
456
460
|
}
|
|
457
461
|
|
|
458
462
|
const {
|
|
459
|
-
value
|
|
460
|
-
onChange
|
|
463
|
+
value
|
|
461
464
|
} = _this.props;
|
|
465
|
+
let finalOutPutValue = outPutValue;
|
|
462
466
|
|
|
463
|
-
|
|
467
|
+
if (finalOutPutValue === undefined) {
|
|
468
|
+
const moveValue = _this.foundation.transPosToValue(mousePos, isMin);
|
|
464
469
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
470
|
+
if (moveValue === false) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
468
473
|
|
|
469
|
-
|
|
474
|
+
finalOutPutValue = _this.foundation.outPutValue(moveValue);
|
|
475
|
+
}
|
|
470
476
|
|
|
471
477
|
const {
|
|
472
478
|
currentValue
|
|
473
479
|
} = _this.state;
|
|
474
480
|
|
|
475
|
-
if (!_isEqual(_this.foundation.outPutValue(currentValue),
|
|
476
|
-
onChange(outPutValue);
|
|
477
|
-
|
|
481
|
+
if (!_isEqual(_this.foundation.outPutValue(currentValue), finalOutPutValue)) {
|
|
478
482
|
if (!clickTrack && _this.foundation.valueFormatIsCorrect(value)) {
|
|
479
483
|
// still require afterChangeCallback when click on the track directly, need skip here
|
|
480
484
|
return false;
|
|
481
485
|
}
|
|
482
486
|
|
|
483
487
|
_this.setState({
|
|
484
|
-
currentValue:
|
|
488
|
+
currentValue: finalOutPutValue
|
|
485
489
|
}, stateChangeCallback);
|
|
486
490
|
}
|
|
487
491
|
},
|
|
@@ -82,7 +82,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
82
82
|
onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
83
83
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
84
84
|
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
85
|
-
validateStatus: PropTypes.Requireable<"default" | "error" | "warning">;
|
|
85
|
+
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
86
86
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
87
87
|
suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
88
88
|
'aria-label': PropTypes.Requireable<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0-beta.0",
|
|
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.
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.
|
|
19
|
-
"@douyinfe/semi-foundation": "2.
|
|
20
|
-
"@douyinfe/semi-icons": "2.
|
|
21
|
-
"@douyinfe/semi-illustrations": "2.
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.
|
|
17
|
+
"@douyinfe/semi-animation": "2.9.0-beta.0",
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.9.0-beta.0",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.9.0-beta.0",
|
|
20
|
+
"@douyinfe/semi-icons": "2.9.0-beta.0",
|
|
21
|
+
"@douyinfe/semi-illustrations": "2.9.0-beta.0",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.9.0-beta.0",
|
|
23
23
|
"@types/react-window": "^1.8.2",
|
|
24
24
|
"async-validator": "^3.5.0",
|
|
25
25
|
"classnames": "^2.2.6",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"date-fns-tz": "^1.0.10",
|
|
29
29
|
"lodash": "^4.17.21",
|
|
30
30
|
"react-resizable": "^1.8.0",
|
|
31
|
-
"react-sortable-hoc": "^
|
|
31
|
+
"react-sortable-hoc": "^2.0.0",
|
|
32
32
|
"react-window": "^1.8.2",
|
|
33
33
|
"resize-observer-polyfill": "^1.5.1",
|
|
34
34
|
"scroll-into-view-if-needed": "^2.2.24",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|
|
63
|
-
"url": "https://github.com/DouyinFE"
|
|
63
|
+
"url": "https://github.com/DouyinFE/semi-design"
|
|
64
64
|
},
|
|
65
65
|
"_unpkg": true,
|
|
66
66
|
"unpkgFiles": [
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "acb1db546e6d3b2a7a40467d83d4b1e1b51e2b21",
|
|
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.
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.9.0-beta.0",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@types/lodash": "^4.14.176",
|
|
81
81
|
"babel-loader": "^8.2.2",
|
|
@@ -504,6 +504,22 @@ describe('Select', () => {
|
|
|
504
504
|
expect(optionList.at(0).text()).toEqual('Abc');
|
|
505
505
|
});
|
|
506
506
|
|
|
507
|
+
it('filter = true,label includes regex special character and key it at first', () => {
|
|
508
|
+
let props = {
|
|
509
|
+
filter: true,
|
|
510
|
+
optionList: [{label: 'label++',value: ''}]
|
|
511
|
+
};
|
|
512
|
+
const select = getSelect(props);
|
|
513
|
+
// click to show input
|
|
514
|
+
select.find(`.${BASE_CLASS_PREFIX}-select`).simulate('click', {});
|
|
515
|
+
let inputValue = '+';
|
|
516
|
+
let event = { target: { value: inputValue } };
|
|
517
|
+
select.find('input').simulate('change', event);
|
|
518
|
+
let optionList = select.find(`.${BASE_CLASS_PREFIX}-select-option-list`).children();
|
|
519
|
+
expect(optionList.length).toEqual(1);
|
|
520
|
+
expect(optionList.at(0).text()).toEqual('label++');
|
|
521
|
+
});
|
|
522
|
+
|
|
507
523
|
it('filter = custom function', () => {
|
|
508
524
|
let customFilter = (sugInput, option) => {
|
|
509
525
|
return option.label == 'Hotsoon';
|
|
@@ -254,14 +254,15 @@ SliderInScrollContainer.story = {
|
|
|
254
254
|
|
|
255
255
|
class ControlledSlider extends Component {
|
|
256
256
|
state = {
|
|
257
|
-
value:
|
|
258
|
-
rangeValue:
|
|
257
|
+
value: 30,
|
|
258
|
+
rangeValue: [10, 30],
|
|
259
259
|
};
|
|
260
260
|
changeValue = () => {
|
|
261
261
|
this.setState({ value: this.state.value + 10 });
|
|
262
|
+
const [start, end] = this.state.rangeValue;
|
|
263
|
+
this.setState({ rangeValue: [start - 10, end + 10]})
|
|
262
264
|
};
|
|
263
265
|
changeRangeValue = rangeValue => {
|
|
264
|
-
console.log('rangeValue' + rangeValue);
|
|
265
266
|
this.setState({ rangeValue: rangeValue });
|
|
266
267
|
};
|
|
267
268
|
render() {
|
|
@@ -269,21 +270,42 @@ class ControlledSlider extends Component {
|
|
|
269
270
|
return (
|
|
270
271
|
<div>
|
|
271
272
|
<Button onClick={() => this.changeValue()}>点击改变value</Button>
|
|
272
|
-
<div style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
|
|
273
|
+
<div data-cy="horizontalNoChangeSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
|
|
274
|
+
<Slider
|
|
275
|
+
value={30}
|
|
276
|
+
onChange={value => {
|
|
277
|
+
console.log('value改变了' + value);
|
|
278
|
+
}}
|
|
279
|
+
></Slider>
|
|
280
|
+
</div>
|
|
281
|
+
<div data-cy="horizontalOnChangeSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
|
|
273
282
|
<Slider
|
|
274
283
|
value={value}
|
|
275
284
|
onChange={value => {
|
|
276
285
|
console.log('value改变了' + value);
|
|
286
|
+
this.setState({value: value});
|
|
277
287
|
}}
|
|
278
288
|
></Slider>
|
|
279
289
|
</div>
|
|
280
|
-
<div style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
|
|
290
|
+
<div data-cy="horizontalNoChangeRangeSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
|
|
281
291
|
<Slider
|
|
282
292
|
value={rangeValue}
|
|
283
|
-
onChange={rangeValue =>
|
|
293
|
+
onChange={rangeValue => {
|
|
294
|
+
console.log('value改变了' + rangeValue);
|
|
295
|
+
}}
|
|
284
296
|
range
|
|
285
297
|
></Slider>
|
|
286
298
|
</div>
|
|
299
|
+
<div data-cy="horizontalNoChangeVerticalSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
|
|
300
|
+
<Slider
|
|
301
|
+
value={40}
|
|
302
|
+
vertical
|
|
303
|
+
onChange={value => {
|
|
304
|
+
console.log('value改变了' + value);
|
|
305
|
+
}}
|
|
306
|
+
style={{height: '300px'}}
|
|
307
|
+
></Slider>
|
|
308
|
+
</div>
|
|
287
309
|
</div>
|
|
288
310
|
);
|
|
289
311
|
}
|
package/slider/index.tsx
CHANGED
|
@@ -195,29 +195,33 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
|
|
|
195
195
|
this._addEventListener(document.body, 'mouseup', this.foundation.onHandleUp, false);
|
|
196
196
|
this._addEventListener(document.body, 'touchmove', this.foundation.onHandleTouchMove, false);
|
|
197
197
|
},
|
|
198
|
-
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback = noop, clickTrack = false): boolean | void => {
|
|
198
|
+
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback = noop, clickTrack = false, outPutValue): boolean | void => {
|
|
199
199
|
|
|
200
200
|
const sliderDOMIsInRenderTree = this.foundation.checkAndUpdateIsInRenderTreeState();
|
|
201
201
|
if (!sliderDOMIsInRenderTree) {
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
const { value
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
const { value } = this.props;
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
let finalOutPutValue = outPutValue;
|
|
209
|
+
if (finalOutPutValue === undefined) {
|
|
210
|
+
const moveValue = this.foundation.transPosToValue(mousePos, isMin);
|
|
211
|
+
if (moveValue === false) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
finalOutPutValue = this.foundation.outPutValue(moveValue);
|
|
209
215
|
}
|
|
210
216
|
|
|
211
|
-
const outPutValue = this.foundation.outPutValue(moveValue);
|
|
212
217
|
const { currentValue } = this.state;
|
|
213
|
-
if (!isEqual(this.foundation.outPutValue(currentValue),
|
|
214
|
-
onChange(outPutValue);
|
|
218
|
+
if (!isEqual(this.foundation.outPutValue(currentValue), finalOutPutValue)) {
|
|
215
219
|
if (!clickTrack && this.foundation.valueFormatIsCorrect(value)) {
|
|
216
220
|
// still require afterChangeCallback when click on the track directly, need skip here
|
|
217
221
|
return false;
|
|
218
222
|
}
|
|
219
223
|
this.setState({
|
|
220
|
-
currentValue:
|
|
224
|
+
currentValue: finalOutPutValue,
|
|
221
225
|
}, stateChangeCallback);
|
|
222
226
|
}
|
|
223
227
|
},
|
|
@@ -300,14 +304,14 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
|
|
|
300
304
|
const maxClass = cls(cssClasses.HANDLE, {
|
|
301
305
|
[`${cssClasses.HANDLE}-clicked`]: chooseMovePos === 'max' && isDrag,
|
|
302
306
|
});
|
|
303
|
-
const {min, max, currentValue} = this.state;
|
|
307
|
+
const { min, max, currentValue } = this.state;
|
|
304
308
|
|
|
305
309
|
const commonAria = {
|
|
306
310
|
'aria-label': ariaLabel,
|
|
307
311
|
'aria-labelledby': ariaLabelledby,
|
|
308
312
|
'aria-disabled': disabled
|
|
309
313
|
};
|
|
310
|
-
vertical && Object.assign(commonAria, {'aria-orientation': 'vertical'});
|
|
314
|
+
vertical && Object.assign(commonAria, { 'aria-orientation': 'vertical' });
|
|
311
315
|
|
|
312
316
|
const handleContents = !range ? (
|
|
313
317
|
<Tooltip
|
|
@@ -494,6 +498,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
|
|
|
494
498
|
});
|
|
495
499
|
const markPercent = (Number(mark) - min) / (max - min);
|
|
496
500
|
return activeResult ? (
|
|
501
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
497
502
|
<span
|
|
498
503
|
key={mark}
|
|
499
504
|
onClick={e => this.foundation.handleWrapClick(e)}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/* argus-disable unPkgSensitiveInfo */
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import FileCard from '../fileCard';
|
|
4
|
+
import { Button, Upload, Toast, Icon } from '@douyinfe/semi-ui/index';
|
|
4
5
|
import { withField, Form } from '../../form/index';
|
|
5
6
|
import { IconPlus, IconFile, IconUpload, IconEyeOpened, IconDownload, IconDelete } from '@douyinfe/semi-icons';
|
|
6
7
|
|
|
7
|
-
import FileCard from '../fileCard';
|
|
8
|
-
|
|
9
8
|
export default {
|
|
10
9
|
title: 'Upload'
|
|
11
10
|
}
|