acud 1.4.60 → 1.4.62-beta
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/acud.js +513 -482
- package/dist/acud.js.map +1 -1
- package/es/carousel/carousel.d.ts +2 -0
- package/es/carousel/carousel.js +53 -31
- package/es/carousel/style/index.css +5 -0
- package/es/carousel/style/index.less +5 -0
- package/es/carousel/switch.d.ts +2 -0
- package/es/carousel/switch.js +18 -6
- package/es/input/TextArea.d.ts +2 -0
- package/es/input/TextArea.js +12 -3
- package/es/input/style/index.css +41 -0
- package/es/input/style/index.less +7 -0
- package/lib/carousel/carousel.d.ts +2 -0
- package/lib/carousel/carousel.js +53 -31
- package/lib/carousel/style/index.css +5 -0
- package/lib/carousel/style/index.less +5 -0
- package/lib/carousel/switch.d.ts +2 -0
- package/lib/carousel/switch.js +21 -6
- package/lib/input/TextArea.d.ts +2 -0
- package/lib/input/TextArea.js +12 -3
- package/lib/input/style/index.css +41 -0
- package/lib/input/style/index.less +7 -0
- package/package.json +1 -1
- package/dist/acud.css +0 -29341
- package/dist/acud.css.map +0 -1
- package/dist/acud.min.css +0 -2
- package/dist/acud.min.css.map +0 -1
- package/dist/acud.min.js +0 -69
- package/dist/acud.min.js.map +0 -1
package/es/carousel/carousel.js
CHANGED
|
@@ -27,7 +27,9 @@ var Carousel = function Carousel(_ref) {
|
|
|
27
27
|
showNumber = _ref$showNumber === void 0 ? 3 : _ref$showNumber,
|
|
28
28
|
_ref$multiShift = _ref.multiShift,
|
|
29
29
|
multiShift = _ref$multiShift === void 0 ? false : _ref$multiShift,
|
|
30
|
-
indicatorStyle = _ref.indicatorStyle
|
|
30
|
+
indicatorStyle = _ref.indicatorStyle,
|
|
31
|
+
_ref$infinite = _ref.infinite,
|
|
32
|
+
infinite = _ref$infinite === void 0 ? true : _ref$infinite;
|
|
31
33
|
var carouselRef = useRef();
|
|
32
34
|
var timer = useRef();
|
|
33
35
|
var _useState = useState(false),
|
|
@@ -55,52 +57,68 @@ var Carousel = function Carousel(_ref) {
|
|
|
55
57
|
var length = Array.isArray(children) ? children.length : undefined;
|
|
56
58
|
var next = useCallback(function () {
|
|
57
59
|
// 向右滑动,最后一帧无缝滑动到第一帧使用的是额外添加的帧,滑动动画结束后,立刻切换到原始帧
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
lastKey: currentKey,
|
|
61
|
-
currentKey: extraCount
|
|
62
|
-
});
|
|
63
|
-
setTimeout(function () {
|
|
64
|
-
// 重置掉自动轮播
|
|
65
|
-
clearTimeout(timer.current);
|
|
66
|
-
var nextKey = extraCount + (multiShift ? extraCount : 1);
|
|
60
|
+
if (infinite) {
|
|
61
|
+
if (currentKey === length + extraCount) {
|
|
67
62
|
setKey({
|
|
68
|
-
lastKey:
|
|
63
|
+
lastKey: currentKey,
|
|
64
|
+
currentKey: extraCount
|
|
65
|
+
});
|
|
66
|
+
setTimeout(function () {
|
|
67
|
+
// 重置掉自动轮播
|
|
68
|
+
clearTimeout(timer.current);
|
|
69
|
+
var nextKey = extraCount + (multiShift ? extraCount : 1);
|
|
70
|
+
setKey({
|
|
71
|
+
lastKey: extraCount,
|
|
72
|
+
currentKey: nextKey > length + extraCount ? length + extraCount : nextKey
|
|
73
|
+
});
|
|
74
|
+
}, 100);
|
|
75
|
+
} else {
|
|
76
|
+
var nextKey = currentKey + (multiShift ? extraCount : 1);
|
|
77
|
+
setKey({
|
|
78
|
+
lastKey: currentKey,
|
|
69
79
|
currentKey: nextKey > length + extraCount ? length + extraCount : nextKey
|
|
70
80
|
});
|
|
71
|
-
}
|
|
81
|
+
}
|
|
72
82
|
} else {
|
|
73
|
-
var
|
|
83
|
+
var _nextKey = currentKey + (multiShift ? extraCount : 1);
|
|
74
84
|
setKey({
|
|
75
85
|
lastKey: currentKey,
|
|
76
|
-
currentKey:
|
|
86
|
+
currentKey: _nextKey > length + extraCount ? length + extraCount : _nextKey
|
|
77
87
|
});
|
|
78
88
|
}
|
|
79
|
-
}, [currentKey, extraCount, length, multiShift]);
|
|
89
|
+
}, [currentKey, extraCount, length, multiShift, infinite]);
|
|
80
90
|
// 向左滑动,第一帧无缝滑动到最后一帧使用的是额外添加的帧,滑动动画结束后,立刻切换到原始帧
|
|
81
91
|
var prev = useCallback(function () {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
lastKey: currentKey,
|
|
85
|
-
currentKey: length
|
|
86
|
-
});
|
|
87
|
-
setTimeout(function () {
|
|
88
|
-
// 重置掉自动轮播
|
|
89
|
-
clearTimeout(timer.current);
|
|
90
|
-
var nextKey = length - (multiShift ? extraCount : 1);
|
|
92
|
+
if (infinite) {
|
|
93
|
+
if (currentKey === 0) {
|
|
91
94
|
setKey({
|
|
92
|
-
lastKey:
|
|
93
|
-
currentKey:
|
|
95
|
+
lastKey: currentKey,
|
|
96
|
+
currentKey: length
|
|
94
97
|
});
|
|
95
|
-
|
|
98
|
+
setTimeout(function () {
|
|
99
|
+
// 重置掉自动轮播
|
|
100
|
+
clearTimeout(timer.current);
|
|
101
|
+
var nextKey = length - (multiShift ? extraCount : 1);
|
|
102
|
+
setKey({
|
|
103
|
+
lastKey: length,
|
|
104
|
+
currentKey: nextKey < 0 ? 0 : length - (multiShift ? extraCount : 1)
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
var nextKey = currentKey - (multiShift ? extraCount : 1);
|
|
109
|
+
setKey({
|
|
110
|
+
lastKey: currentKey,
|
|
111
|
+
currentKey: nextKey < 0 ? 0 : currentKey - (multiShift ? extraCount : 1)
|
|
112
|
+
});
|
|
113
|
+
}
|
|
96
114
|
} else {
|
|
97
|
-
var
|
|
115
|
+
var _nextKey2 = currentKey - (multiShift ? extraCount : 1);
|
|
98
116
|
setKey({
|
|
99
117
|
lastKey: currentKey,
|
|
100
|
-
currentKey:
|
|
118
|
+
currentKey: _nextKey2 < 0 ? 0 : _nextKey2
|
|
101
119
|
});
|
|
102
120
|
}
|
|
103
|
-
}, [currentKey, extraCount, length, multiShift]);
|
|
121
|
+
}, [currentKey, extraCount, length, multiShift, infinite]);
|
|
104
122
|
// 监听是否hover热区,hover情况下不会自动轮播
|
|
105
123
|
useEffect(function () {
|
|
106
124
|
carouselRef.current.addEventListener('mouseover', function () {
|
|
@@ -152,6 +170,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
152
170
|
return (multi ? cardWidth + 8 : cardWidth) * (idx - currentKey);
|
|
153
171
|
};
|
|
154
172
|
var wrapperClassName = classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-multi"), multi));
|
|
173
|
+
var isPrevDisabled = !infinite && currentKey === extraCount;
|
|
174
|
+
var isNextDisabled = !infinite && currentKey === length;
|
|
155
175
|
return /*#__PURE__*/React.createElement("div", {
|
|
156
176
|
ref: carouselRef,
|
|
157
177
|
style: style,
|
|
@@ -159,7 +179,9 @@ var Carousel = function Carousel(_ref) {
|
|
|
159
179
|
}, childrenIsArray ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CarouselSwitch, {
|
|
160
180
|
prefixCls: prefixCls,
|
|
161
181
|
next: next,
|
|
162
|
-
prev: prev
|
|
182
|
+
prev: prev,
|
|
183
|
+
isPrevDisabled: isPrevDisabled,
|
|
184
|
+
isNextDisabled: isNextDisabled
|
|
163
185
|
}), !multi && /*#__PURE__*/React.createElement(CarouselIndicator, {
|
|
164
186
|
prefixCls: prefixCls,
|
|
165
187
|
setKey: setKey,
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
.acud-carousel-switch > span {
|
|
36
36
|
cursor: pointer;
|
|
37
37
|
pointer-events: visible;
|
|
38
|
+
opacity: 1;
|
|
39
|
+
}
|
|
40
|
+
.acud-carousel-switch > span.disabled {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
opacity: 0.5;
|
|
38
43
|
}
|
|
39
44
|
.acud-carousel-switch > span > .acudicon {
|
|
40
45
|
display: block;
|
package/es/carousel/switch.d.ts
CHANGED
package/es/carousel/switch.js
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import OutlinedRight from "acud-icon/es/icons/OutlinedRight";
|
|
3
3
|
import OutlinedLeft from "acud-icon/es/icons/OutlinedLeft";
|
|
4
4
|
;
|
|
5
5
|
var CarouselSwitch = function CarouselSwitch(_ref) {
|
|
6
6
|
var prefixCls = _ref.prefixCls,
|
|
7
7
|
next = _ref.next,
|
|
8
|
-
prev = _ref.prev
|
|
8
|
+
prev = _ref.prev,
|
|
9
|
+
isPrevDisabled = _ref.isPrevDisabled,
|
|
10
|
+
isNextDisabled = _ref.isNextDisabled;
|
|
11
|
+
var handlePrevClick = useCallback(function () {
|
|
12
|
+
if (!isPrevDisabled) {
|
|
13
|
+
prev();
|
|
14
|
+
}
|
|
15
|
+
}, [isPrevDisabled, prev]);
|
|
16
|
+
var handleNextClick = useCallback(function () {
|
|
17
|
+
if (!isNextDisabled) {
|
|
18
|
+
next();
|
|
19
|
+
}
|
|
20
|
+
}, [isNextDisabled, next]);
|
|
9
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
22
|
className: "".concat(prefixCls, "-switch")
|
|
11
23
|
}, /*#__PURE__*/React.createElement("span", {
|
|
12
|
-
className: "".concat(prefixCls, "-switch-left"),
|
|
13
|
-
onClick:
|
|
24
|
+
className: "".concat(prefixCls, "-switch-left ").concat(isPrevDisabled ? 'disabled' : ''),
|
|
25
|
+
onClick: handlePrevClick
|
|
14
26
|
}, /*#__PURE__*/React.createElement(OutlinedLeft, null)), /*#__PURE__*/React.createElement("span", {
|
|
15
|
-
className: "".concat(prefixCls, "-switch-right"),
|
|
16
|
-
onClick:
|
|
27
|
+
className: "".concat(prefixCls, "-switch-right ").concat(isNextDisabled ? 'disabled' : ''),
|
|
28
|
+
onClick: handleNextClick
|
|
17
29
|
}, /*#__PURE__*/React.createElement(OutlinedRight, null)));
|
|
18
30
|
};
|
|
19
31
|
export default CarouselSwitch;
|
package/es/input/TextArea.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface TextAreaProps {
|
|
|
23
23
|
allowClear?: boolean;
|
|
24
24
|
forbidIfLimit?: boolean;
|
|
25
25
|
disabled?: boolean;
|
|
26
|
+
warningPopover?: boolean;
|
|
27
|
+
warningText?: string;
|
|
26
28
|
onCompositionStart?: React.CompositionEventHandler<HTMLTextAreaElement>;
|
|
27
29
|
onCompositionEnd?: React.CompositionEventHandler<HTMLTextAreaElement>;
|
|
28
30
|
}
|
package/es/input/TextArea.js
CHANGED
|
@@ -20,6 +20,7 @@ import MultiToneClear from "acud-icon/es/icons/MultiToneClear";
|
|
|
20
20
|
import { ConfigContext } from '../config-provider';
|
|
21
21
|
import useMergedState from '../_util/hooks/useMergedState';
|
|
22
22
|
import { resolveTargetValue } from './Input';
|
|
23
|
+
import Popover from '../popover';
|
|
23
24
|
// const TextArea:React.FC<TextAreaProps> = props => {
|
|
24
25
|
var TextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
25
26
|
var customizePrefixCls = props.prefixCls,
|
|
@@ -41,9 +42,11 @@ var TextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
41
42
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
|
|
42
43
|
_props$forbidIfLimit = props.forbidIfLimit,
|
|
43
44
|
forbidIfLimit = _props$forbidIfLimit === void 0 ? false : _props$forbidIfLimit,
|
|
45
|
+
warningPopover = props.warningPopover,
|
|
46
|
+
warningText = props.warningText,
|
|
44
47
|
onCompositionStart = props.onCompositionStart,
|
|
45
48
|
onCompositionEnd = props.onCompositionEnd,
|
|
46
|
-
rest = __rest(props, ["prefixCls", "placeholder", "className", "style", "width", "limitLength", "readonly", "autoSize", "disabled", "onPressEnter", "onKeyDown", "onFocus", "onBlur", "allowClear", "forbidIfLimit", "onCompositionStart", "onCompositionEnd"]);
|
|
49
|
+
rest = __rest(props, ["prefixCls", "placeholder", "className", "style", "width", "limitLength", "readonly", "autoSize", "disabled", "onPressEnter", "onKeyDown", "onFocus", "onBlur", "allowClear", "forbidIfLimit", "warningPopover", "warningText", "onCompositionStart", "onCompositionEnd"]);
|
|
47
50
|
var _useMergedState = useMergedState(props.defaultValue, {
|
|
48
51
|
value: props.value
|
|
49
52
|
}),
|
|
@@ -132,7 +135,7 @@ var TextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
132
135
|
var _React$useContext = React.useContext(ConfigContext),
|
|
133
136
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
134
137
|
var prefixCls = getPrefixCls('input-textarea', customizePrefixCls);
|
|
135
|
-
var classes = classNames(prefixCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-autosize"), autoSize), "".concat(prefixCls, "-readonly"), readonly), "".concat(prefixCls, "-span-focus"), focusClass), "".concat(prefixCls, "-limit"), currentLength > limitLength), "".concat(prefixCls, "-no-limit"), !!limitLength), "".concat(prefixCls, "-no-clear"), !allowClear));
|
|
138
|
+
var classes = classNames(prefixCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-autosize"), autoSize), "".concat(prefixCls, "-readonly"), readonly), "".concat(prefixCls, "-span-focus"), focusClass), "".concat(prefixCls, "-limit"), currentLength > limitLength), "".concat(prefixCls, "-no-limit"), !!limitLength), "".concat(prefixCls, "-no-clear"), !allowClear), "".concat(prefixCls, "-error"), warningPopover));
|
|
136
139
|
var limitClassName = classNames(_defineProperty({}, "".concat(prefixCls, "-warning"), currentLength > limitLength));
|
|
137
140
|
var limitBoxClassName = classNames(_defineProperty({}, "".concat(prefixCls, "-limit-box-readonly"), readonly));
|
|
138
141
|
var clearContent = function clearContent(e) {
|
|
@@ -141,7 +144,7 @@ var TextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
141
144
|
handleOnChange(resolveTargetValue(e, ''));
|
|
142
145
|
};
|
|
143
146
|
var innerValue = composedRef.current ? composingValue : value !== null && value !== void 0 ? value : '';
|
|
144
|
-
|
|
147
|
+
var textAreaContent = /*#__PURE__*/React.createElement("div", {
|
|
145
148
|
className: classNames("".concat(prefixCls, "-outer"), className),
|
|
146
149
|
style: {
|
|
147
150
|
width: width
|
|
@@ -173,5 +176,11 @@ var TextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
173
176
|
}, /*#__PURE__*/React.createElement("span", {
|
|
174
177
|
className: classNames(limitClassName, 'limit')
|
|
175
178
|
}, currentLength, "/", limitLength)));
|
|
179
|
+
return warningPopover && warningText ? /*#__PURE__*/React.createElement(Popover, {
|
|
180
|
+
content: /*#__PURE__*/React.createElement("span", {
|
|
181
|
+
className: "".concat(prefixCls, "-warning-popover-text")
|
|
182
|
+
}, warningText),
|
|
183
|
+
placement: "bottomLeft"
|
|
184
|
+
}, textAreaContent) : textAreaContent;
|
|
176
185
|
});
|
|
177
186
|
export default TextArea;
|
package/es/input/style/index.css
CHANGED
|
@@ -957,6 +957,44 @@
|
|
|
957
957
|
.acud-input-textarea:focus {
|
|
958
958
|
outline: none;
|
|
959
959
|
}
|
|
960
|
+
.acud-input-textarea-error {
|
|
961
|
+
background-color: #FFFFFF;
|
|
962
|
+
border-color: #F33E3E;
|
|
963
|
+
}
|
|
964
|
+
.acud-input-textarea-error:hover {
|
|
965
|
+
background-color: #FFFFFF;
|
|
966
|
+
}
|
|
967
|
+
.acud-input-textarea-error:focus,
|
|
968
|
+
.acud-input-textarea-error:active {
|
|
969
|
+
background-color: #FFFFFF;
|
|
970
|
+
}
|
|
971
|
+
.acud-input-textarea-error[disabled],
|
|
972
|
+
.acud-input-textarea-error[aria-disabled="true"],
|
|
973
|
+
.acud-input-textarea-error[disabled]:hover,
|
|
974
|
+
.acud-input-textarea-error[aria-disabled="true"]:hover,
|
|
975
|
+
.acud-input-textarea-error[disabled]:focus,
|
|
976
|
+
.acud-input-textarea-error[aria-disabled="true"]:focus,
|
|
977
|
+
.acud-input-textarea-error[disabled]:active,
|
|
978
|
+
.acud-input-textarea-error[aria-disabled="true"]:active {
|
|
979
|
+
background-color: #FFFFFF;
|
|
980
|
+
}
|
|
981
|
+
.acud-input-textarea-error:hover {
|
|
982
|
+
border-color: #F33E3E;
|
|
983
|
+
}
|
|
984
|
+
.acud-input-textarea-error:focus,
|
|
985
|
+
.acud-input-textarea-error:active {
|
|
986
|
+
border-color: #F33E3E;
|
|
987
|
+
}
|
|
988
|
+
.acud-input-textarea-error[disabled],
|
|
989
|
+
.acud-input-textarea-error[aria-disabled="true"],
|
|
990
|
+
.acud-input-textarea-error[disabled]:hover,
|
|
991
|
+
.acud-input-textarea-error[aria-disabled="true"]:hover,
|
|
992
|
+
.acud-input-textarea-error[disabled]:focus,
|
|
993
|
+
.acud-input-textarea-error[aria-disabled="true"]:focus,
|
|
994
|
+
.acud-input-textarea-error[disabled]:active,
|
|
995
|
+
.acud-input-textarea-error[aria-disabled="true"]:active {
|
|
996
|
+
border-color: #F33E3E;
|
|
997
|
+
}
|
|
960
998
|
.acud-input-textarea-warning {
|
|
961
999
|
color: #F33E3E;
|
|
962
1000
|
}
|
|
@@ -1022,6 +1060,9 @@
|
|
|
1022
1060
|
background-color: #F7F7F9;
|
|
1023
1061
|
border-color: #D4D6D9;
|
|
1024
1062
|
}
|
|
1063
|
+
.acud-input-textarea-warning-popover-text {
|
|
1064
|
+
color: #F33E3E;
|
|
1065
|
+
}
|
|
1025
1066
|
.acud-input-textarea-limit-box {
|
|
1026
1067
|
position: absolute;
|
|
1027
1068
|
right: 16px;
|
|
@@ -336,6 +336,10 @@
|
|
|
336
336
|
outline: none;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
&-error {
|
|
340
|
+
.basic-p-config(@input-enhance-p);
|
|
341
|
+
}
|
|
342
|
+
|
|
339
343
|
&-warning {
|
|
340
344
|
color: @input-enhance-color;
|
|
341
345
|
}
|
|
@@ -366,6 +370,9 @@
|
|
|
366
370
|
border-color: @G7;
|
|
367
371
|
}
|
|
368
372
|
}
|
|
373
|
+
&-warning-popover-text {
|
|
374
|
+
color: @input-popover-color;
|
|
375
|
+
}
|
|
369
376
|
|
|
370
377
|
&-limit-box {
|
|
371
378
|
// display: flex;
|
package/lib/carousel/carousel.js
CHANGED
|
@@ -37,7 +37,9 @@ var Carousel = function Carousel(_ref) {
|
|
|
37
37
|
showNumber = _ref$showNumber === void 0 ? 3 : _ref$showNumber,
|
|
38
38
|
_ref$multiShift = _ref.multiShift,
|
|
39
39
|
multiShift = _ref$multiShift === void 0 ? false : _ref$multiShift,
|
|
40
|
-
indicatorStyle = _ref.indicatorStyle
|
|
40
|
+
indicatorStyle = _ref.indicatorStyle,
|
|
41
|
+
_ref$infinite = _ref.infinite,
|
|
42
|
+
infinite = _ref$infinite === void 0 ? true : _ref$infinite;
|
|
41
43
|
var carouselRef = (0, _react.useRef)();
|
|
42
44
|
var timer = (0, _react.useRef)();
|
|
43
45
|
var _useState = (0, _react.useState)(false),
|
|
@@ -65,52 +67,68 @@ var Carousel = function Carousel(_ref) {
|
|
|
65
67
|
var length = Array.isArray(children) ? children.length : undefined;
|
|
66
68
|
var next = (0, _react.useCallback)(function () {
|
|
67
69
|
// 向右滑动,最后一帧无缝滑动到第一帧使用的是额外添加的帧,滑动动画结束后,立刻切换到原始帧
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
lastKey: currentKey,
|
|
71
|
-
currentKey: extraCount
|
|
72
|
-
});
|
|
73
|
-
setTimeout(function () {
|
|
74
|
-
// 重置掉自动轮播
|
|
75
|
-
clearTimeout(timer.current);
|
|
76
|
-
var nextKey = extraCount + (multiShift ? extraCount : 1);
|
|
70
|
+
if (infinite) {
|
|
71
|
+
if (currentKey === length + extraCount) {
|
|
77
72
|
setKey({
|
|
78
|
-
lastKey:
|
|
73
|
+
lastKey: currentKey,
|
|
74
|
+
currentKey: extraCount
|
|
75
|
+
});
|
|
76
|
+
setTimeout(function () {
|
|
77
|
+
// 重置掉自动轮播
|
|
78
|
+
clearTimeout(timer.current);
|
|
79
|
+
var nextKey = extraCount + (multiShift ? extraCount : 1);
|
|
80
|
+
setKey({
|
|
81
|
+
lastKey: extraCount,
|
|
82
|
+
currentKey: nextKey > length + extraCount ? length + extraCount : nextKey
|
|
83
|
+
});
|
|
84
|
+
}, 100);
|
|
85
|
+
} else {
|
|
86
|
+
var nextKey = currentKey + (multiShift ? extraCount : 1);
|
|
87
|
+
setKey({
|
|
88
|
+
lastKey: currentKey,
|
|
79
89
|
currentKey: nextKey > length + extraCount ? length + extraCount : nextKey
|
|
80
90
|
});
|
|
81
|
-
}
|
|
91
|
+
}
|
|
82
92
|
} else {
|
|
83
|
-
var
|
|
93
|
+
var _nextKey = currentKey + (multiShift ? extraCount : 1);
|
|
84
94
|
setKey({
|
|
85
95
|
lastKey: currentKey,
|
|
86
|
-
currentKey:
|
|
96
|
+
currentKey: _nextKey > length + extraCount ? length + extraCount : _nextKey
|
|
87
97
|
});
|
|
88
98
|
}
|
|
89
|
-
}, [currentKey, extraCount, length, multiShift]);
|
|
99
|
+
}, [currentKey, extraCount, length, multiShift, infinite]);
|
|
90
100
|
// 向左滑动,第一帧无缝滑动到最后一帧使用的是额外添加的帧,滑动动画结束后,立刻切换到原始帧
|
|
91
101
|
var prev = (0, _react.useCallback)(function () {
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
lastKey: currentKey,
|
|
95
|
-
currentKey: length
|
|
96
|
-
});
|
|
97
|
-
setTimeout(function () {
|
|
98
|
-
// 重置掉自动轮播
|
|
99
|
-
clearTimeout(timer.current);
|
|
100
|
-
var nextKey = length - (multiShift ? extraCount : 1);
|
|
102
|
+
if (infinite) {
|
|
103
|
+
if (currentKey === 0) {
|
|
101
104
|
setKey({
|
|
102
|
-
lastKey:
|
|
103
|
-
currentKey:
|
|
105
|
+
lastKey: currentKey,
|
|
106
|
+
currentKey: length
|
|
104
107
|
});
|
|
105
|
-
|
|
108
|
+
setTimeout(function () {
|
|
109
|
+
// 重置掉自动轮播
|
|
110
|
+
clearTimeout(timer.current);
|
|
111
|
+
var nextKey = length - (multiShift ? extraCount : 1);
|
|
112
|
+
setKey({
|
|
113
|
+
lastKey: length,
|
|
114
|
+
currentKey: nextKey < 0 ? 0 : length - (multiShift ? extraCount : 1)
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
var nextKey = currentKey - (multiShift ? extraCount : 1);
|
|
119
|
+
setKey({
|
|
120
|
+
lastKey: currentKey,
|
|
121
|
+
currentKey: nextKey < 0 ? 0 : currentKey - (multiShift ? extraCount : 1)
|
|
122
|
+
});
|
|
123
|
+
}
|
|
106
124
|
} else {
|
|
107
|
-
var
|
|
125
|
+
var _nextKey2 = currentKey - (multiShift ? extraCount : 1);
|
|
108
126
|
setKey({
|
|
109
127
|
lastKey: currentKey,
|
|
110
|
-
currentKey:
|
|
128
|
+
currentKey: _nextKey2 < 0 ? 0 : _nextKey2
|
|
111
129
|
});
|
|
112
130
|
}
|
|
113
|
-
}, [currentKey, extraCount, length, multiShift]);
|
|
131
|
+
}, [currentKey, extraCount, length, multiShift, infinite]);
|
|
114
132
|
// 监听是否hover热区,hover情况下不会自动轮播
|
|
115
133
|
(0, _react.useEffect)(function () {
|
|
116
134
|
carouselRef.current.addEventListener('mouseover', function () {
|
|
@@ -162,6 +180,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
162
180
|
return (multi ? cardWidth + 8 : cardWidth) * (idx - currentKey);
|
|
163
181
|
};
|
|
164
182
|
var wrapperClassName = (0, _classnames["default"])(prefixCls, className, (0, _defineProperty2["default"])({}, "".concat(prefixCls, "-multi"), multi));
|
|
183
|
+
var isPrevDisabled = !infinite && currentKey === extraCount;
|
|
184
|
+
var isNextDisabled = !infinite && currentKey === length;
|
|
165
185
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
186
|
ref: carouselRef,
|
|
167
187
|
style: style,
|
|
@@ -169,7 +189,9 @@ var Carousel = function Carousel(_ref) {
|
|
|
169
189
|
}, childrenIsArray ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
170
190
|
prefixCls: prefixCls,
|
|
171
191
|
next: next,
|
|
172
|
-
prev: prev
|
|
192
|
+
prev: prev,
|
|
193
|
+
isPrevDisabled: isPrevDisabled,
|
|
194
|
+
isNextDisabled: isNextDisabled
|
|
173
195
|
}), !multi && /*#__PURE__*/_react["default"].createElement(_indicator["default"], {
|
|
174
196
|
prefixCls: prefixCls,
|
|
175
197
|
setKey: setKey,
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
.acud-carousel-switch > span {
|
|
36
36
|
cursor: pointer;
|
|
37
37
|
pointer-events: visible;
|
|
38
|
+
opacity: 1;
|
|
39
|
+
}
|
|
40
|
+
.acud-carousel-switch > span.disabled {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
opacity: 0.5;
|
|
38
43
|
}
|
|
39
44
|
.acud-carousel-switch > span > .acudicon {
|
|
40
45
|
display: block;
|
package/lib/carousel/switch.d.ts
CHANGED
package/lib/carousel/switch.js
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
8
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _OutlinedRight = _interopRequireDefault(require("acud-icon/lib/icons/OutlinedRight"));
|
|
10
11
|
var _OutlinedLeft = _interopRequireDefault(require("acud-icon/lib/icons/OutlinedLeft"));
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
11
14
|
;
|
|
12
15
|
var CarouselSwitch = function CarouselSwitch(_ref) {
|
|
13
16
|
var prefixCls = _ref.prefixCls,
|
|
14
17
|
next = _ref.next,
|
|
15
|
-
prev = _ref.prev
|
|
18
|
+
prev = _ref.prev,
|
|
19
|
+
isPrevDisabled = _ref.isPrevDisabled,
|
|
20
|
+
isNextDisabled = _ref.isNextDisabled;
|
|
21
|
+
var handlePrevClick = (0, _react.useCallback)(function () {
|
|
22
|
+
if (!isPrevDisabled) {
|
|
23
|
+
prev();
|
|
24
|
+
}
|
|
25
|
+
}, [isPrevDisabled, prev]);
|
|
26
|
+
var handleNextClick = (0, _react.useCallback)(function () {
|
|
27
|
+
if (!isNextDisabled) {
|
|
28
|
+
next();
|
|
29
|
+
}
|
|
30
|
+
}, [isNextDisabled, next]);
|
|
16
31
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
17
32
|
className: "".concat(prefixCls, "-switch")
|
|
18
33
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
19
|
-
className: "".concat(prefixCls, "-switch-left"),
|
|
20
|
-
onClick:
|
|
34
|
+
className: "".concat(prefixCls, "-switch-left ").concat(isPrevDisabled ? 'disabled' : ''),
|
|
35
|
+
onClick: handlePrevClick
|
|
21
36
|
}, /*#__PURE__*/_react["default"].createElement(_OutlinedLeft["default"], null)), /*#__PURE__*/_react["default"].createElement("span", {
|
|
22
|
-
className: "".concat(prefixCls, "-switch-right"),
|
|
23
|
-
onClick:
|
|
37
|
+
className: "".concat(prefixCls, "-switch-right ").concat(isNextDisabled ? 'disabled' : ''),
|
|
38
|
+
onClick: handleNextClick
|
|
24
39
|
}, /*#__PURE__*/_react["default"].createElement(_OutlinedRight["default"], null)));
|
|
25
40
|
};
|
|
26
41
|
var _default = exports["default"] = CarouselSwitch;
|
package/lib/input/TextArea.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface TextAreaProps {
|
|
|
23
23
|
allowClear?: boolean;
|
|
24
24
|
forbidIfLimit?: boolean;
|
|
25
25
|
disabled?: boolean;
|
|
26
|
+
warningPopover?: boolean;
|
|
27
|
+
warningText?: string;
|
|
26
28
|
onCompositionStart?: React.CompositionEventHandler<HTMLTextAreaElement>;
|
|
27
29
|
onCompositionEnd?: React.CompositionEventHandler<HTMLTextAreaElement>;
|
|
28
30
|
}
|
package/lib/input/TextArea.js
CHANGED
|
@@ -16,6 +16,7 @@ var _MultiToneClear = _interopRequireDefault(require("acud-icon/lib/icons/MultiT
|
|
|
16
16
|
var _configProvider = require("../config-provider");
|
|
17
17
|
var _useMergedState3 = _interopRequireDefault(require("../_util/hooks/useMergedState"));
|
|
18
18
|
var _Input = require("./Input");
|
|
19
|
+
var _popover = _interopRequireDefault(require("../popover"));
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
21
22
|
/**
|
|
@@ -51,9 +52,11 @@ var TextArea = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
51
52
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
|
|
52
53
|
_props$forbidIfLimit = props.forbidIfLimit,
|
|
53
54
|
forbidIfLimit = _props$forbidIfLimit === void 0 ? false : _props$forbidIfLimit,
|
|
55
|
+
warningPopover = props.warningPopover,
|
|
56
|
+
warningText = props.warningText,
|
|
54
57
|
onCompositionStart = props.onCompositionStart,
|
|
55
58
|
onCompositionEnd = props.onCompositionEnd,
|
|
56
|
-
rest = __rest(props, ["prefixCls", "placeholder", "className", "style", "width", "limitLength", "readonly", "autoSize", "disabled", "onPressEnter", "onKeyDown", "onFocus", "onBlur", "allowClear", "forbidIfLimit", "onCompositionStart", "onCompositionEnd"]);
|
|
59
|
+
rest = __rest(props, ["prefixCls", "placeholder", "className", "style", "width", "limitLength", "readonly", "autoSize", "disabled", "onPressEnter", "onKeyDown", "onFocus", "onBlur", "allowClear", "forbidIfLimit", "warningPopover", "warningText", "onCompositionStart", "onCompositionEnd"]);
|
|
57
60
|
var _useMergedState = (0, _useMergedState3["default"])(props.defaultValue, {
|
|
58
61
|
value: props.value
|
|
59
62
|
}),
|
|
@@ -142,7 +145,7 @@ var TextArea = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
142
145
|
var _React$useContext = _react["default"].useContext(_configProvider.ConfigContext),
|
|
143
146
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
144
147
|
var prefixCls = getPrefixCls('input-textarea', customizePrefixCls);
|
|
145
|
-
var classes = (0, _classnames["default"])(prefixCls, (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, "".concat(prefixCls, "-autosize"), autoSize), "".concat(prefixCls, "-readonly"), readonly), "".concat(prefixCls, "-span-focus"), focusClass), "".concat(prefixCls, "-limit"), currentLength > limitLength), "".concat(prefixCls, "-no-limit"), !!limitLength), "".concat(prefixCls, "-no-clear"), !allowClear));
|
|
148
|
+
var classes = (0, _classnames["default"])(prefixCls, (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, "".concat(prefixCls, "-autosize"), autoSize), "".concat(prefixCls, "-readonly"), readonly), "".concat(prefixCls, "-span-focus"), focusClass), "".concat(prefixCls, "-limit"), currentLength > limitLength), "".concat(prefixCls, "-no-limit"), !!limitLength), "".concat(prefixCls, "-no-clear"), !allowClear), "".concat(prefixCls, "-error"), warningPopover));
|
|
146
149
|
var limitClassName = (0, _classnames["default"])((0, _defineProperty2["default"])({}, "".concat(prefixCls, "-warning"), currentLength > limitLength));
|
|
147
150
|
var limitBoxClassName = (0, _classnames["default"])((0, _defineProperty2["default"])({}, "".concat(prefixCls, "-limit-box-readonly"), readonly));
|
|
148
151
|
var clearContent = function clearContent(e) {
|
|
@@ -151,7 +154,7 @@ var TextArea = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
151
154
|
handleOnChange((0, _Input.resolveTargetValue)(e, ''));
|
|
152
155
|
};
|
|
153
156
|
var innerValue = composedRef.current ? composingValue : value !== null && value !== void 0 ? value : '';
|
|
154
|
-
|
|
157
|
+
var textAreaContent = /*#__PURE__*/_react["default"].createElement("div", {
|
|
155
158
|
className: (0, _classnames["default"])("".concat(prefixCls, "-outer"), className),
|
|
156
159
|
style: {
|
|
157
160
|
width: width
|
|
@@ -183,5 +186,11 @@ var TextArea = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
183
186
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
184
187
|
className: (0, _classnames["default"])(limitClassName, 'limit')
|
|
185
188
|
}, currentLength, "/", limitLength)));
|
|
189
|
+
return warningPopover && warningText ? /*#__PURE__*/_react["default"].createElement(_popover["default"], {
|
|
190
|
+
content: /*#__PURE__*/_react["default"].createElement("span", {
|
|
191
|
+
className: "".concat(prefixCls, "-warning-popover-text")
|
|
192
|
+
}, warningText),
|
|
193
|
+
placement: "bottomLeft"
|
|
194
|
+
}, textAreaContent) : textAreaContent;
|
|
186
195
|
});
|
|
187
196
|
var _default = exports["default"] = TextArea;
|