@nutui/nutui-react 3.0.14 → 3.0.16
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/CHANGELOG.md +27 -0
- package/dist/cjs/packages/button/style/button.scss +3 -0
- package/dist/cjs/packages/button/style/style.css +3 -3
- package/dist/cjs/packages/button/style-jmapp/button.scss +3 -0
- package/dist/cjs/packages/button/style-jmapp/style.css +3 -3
- package/dist/cjs/packages/button/style-jrkf/button.scss +3 -0
- package/dist/cjs/packages/button/style-jrkf/style.css +3 -3
- package/dist/cjs/packages/calendarcard/calendarcard.js +10 -4
- package/dist/cjs/packages/calendaritem/calendaritem.d.ts +1 -1
- package/dist/cjs/packages/calendaritem/calendaritem.js +3 -3
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/datepicker/utils.js +22 -37
- package/dist/cjs/packages/dialog/dialog.js +2 -7
- package/dist/cjs/packages/formitem/formitem.js +3 -3
- package/dist/cjs/packages/formitem/style/formitem.scss +14 -15
- package/dist/cjs/packages/formitem/style/style.css +9 -11
- package/dist/cjs/packages/formitem/style-jmapp/formitem.scss +14 -15
- package/dist/cjs/packages/formitem/style-jmapp/style.css +8 -10
- package/dist/cjs/packages/formitem/style-jrkf/formitem.scss +14 -15
- package/dist/cjs/packages/formitem/style-jrkf/style.css +8 -10
- package/dist/cjs/packages/imagepreview/imagepreview.js +23 -7
- package/dist/cjs/packages/noticebar/noticebar.js +66 -41
- package/dist/cjs/packages/overlay/style/overlay.scss +0 -1
- package/dist/cjs/packages/overlay/style/style.css +0 -1
- package/dist/cjs/packages/overlay/style-jmapp/overlay.scss +0 -1
- package/dist/cjs/packages/overlay/style-jmapp/style.css +0 -1
- package/dist/cjs/packages/overlay/style-jrkf/overlay.scss +0 -1
- package/dist/cjs/packages/overlay/style-jrkf/style.css +0 -1
- package/dist/cjs/types/spec/calendar/base.d.ts +3 -1
- package/dist/cjs/types/spec/calendarcard/base.d.ts +1 -0
- package/dist/cjs/types/spec/datepicker/base.d.ts +1 -1
- package/dist/cjs/types/spec/imagepreview/h5.d.ts +4 -1
- package/dist/cjs/types/spec/imagepreview/taro.d.ts +4 -1
- package/dist/cjs/utils/date.d.ts +2 -2
- package/dist/cjs/utils/date.js +2 -2
- package/dist/es/packages/button/style/button.scss +3 -0
- package/dist/es/packages/button/style/style.css +3 -3
- package/dist/es/packages/button/style-jmapp/button.scss +3 -0
- package/dist/es/packages/button/style-jmapp/style.css +3 -3
- package/dist/es/packages/button/style-jrkf/button.scss +3 -0
- package/dist/es/packages/button/style-jrkf/style.css +3 -3
- package/dist/es/packages/calendarcard/calendarcard.js +11 -5
- package/dist/es/packages/calendaritem/calendaritem.d.ts +1 -1
- package/dist/es/packages/calendaritem/calendaritem.js +3 -3
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/datepicker/utils.js +22 -37
- package/dist/es/packages/dialog/dialog.js +2 -7
- package/dist/es/packages/formitem/formitem.js +3 -3
- package/dist/es/packages/formitem/style/formitem.scss +14 -15
- package/dist/es/packages/formitem/style/style.css +9 -11
- package/dist/es/packages/formitem/style-jmapp/formitem.scss +14 -15
- package/dist/es/packages/formitem/style-jmapp/style.css +8 -10
- package/dist/es/packages/formitem/style-jrkf/formitem.scss +14 -15
- package/dist/es/packages/formitem/style-jrkf/style.css +8 -10
- package/dist/es/packages/imagepreview/imagepreview.js +23 -7
- package/dist/es/packages/noticebar/noticebar.js +67 -42
- package/dist/es/packages/overlay/style/overlay.scss +0 -1
- package/dist/es/packages/overlay/style/style.css +0 -1
- package/dist/es/packages/overlay/style-jmapp/overlay.scss +0 -1
- package/dist/es/packages/overlay/style-jmapp/style.css +0 -1
- package/dist/es/packages/overlay/style-jrkf/overlay.scss +0 -1
- package/dist/es/packages/overlay/style-jrkf/style.css +0 -1
- package/dist/es/types/spec/calendar/base.d.ts +3 -1
- package/dist/es/types/spec/calendarcard/base.d.ts +4 -0
- package/dist/es/types/spec/datepicker/base.d.ts +1 -1
- package/dist/es/types/spec/imagepreview/h5.d.ts +4 -1
- package/dist/es/types/spec/imagepreview/taro.d.ts +4 -1
- package/dist/es/utils/date.d.ts +2 -2
- package/dist/es/utils/date.js +2 -2
- package/dist/nutui.react.umd.js +128 -104
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +28 -28
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +40 -40
- package/dist/style.css +1 -1
- package/dist/style.scss +31 -31
- package/dist/styles/variables.scss +1 -2
- package/package.json +1 -1
|
@@ -22,16 +22,21 @@
|
|
|
22
22
|
text-align: var(--nutui-form-item-label-text-align, left);
|
|
23
23
|
line-height: unset;
|
|
24
24
|
}
|
|
25
|
-
.nut-form-item-label-required {
|
|
25
|
+
.nut-form-item-label-left-required {
|
|
26
26
|
color: var(--nutui-form-item-required-color, var(--nutui-color-danger));
|
|
27
27
|
margin-right: var(--nutui-form-item-required-margin-right, 4px);
|
|
28
|
-
display: block;
|
|
29
28
|
position: absolute;
|
|
30
29
|
left: -10px;
|
|
31
30
|
}
|
|
31
|
+
.nut-form-item-label-right-required {
|
|
32
|
+
color: var(--nutui-form-item-required-color, var(--nutui-color-danger));
|
|
33
|
+
margin-left: var(--nutui-form-item-required-margin-right, 4px);
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: -10px;
|
|
36
|
+
}
|
|
32
37
|
.nut-form-item .nut-form-item-labeltxt {
|
|
33
38
|
position: relative;
|
|
34
|
-
font-size:
|
|
39
|
+
font-size: var(--nutui-form-item-label-font-size, var(--nutui-font-text));
|
|
35
40
|
}
|
|
36
41
|
.nut-form-item-body {
|
|
37
42
|
flex: 1;
|
|
@@ -121,13 +126,6 @@
|
|
|
121
126
|
white-space: nowrap;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
.nut-form-item-label-left-required {
|
|
125
|
-
display: block;
|
|
126
|
-
line-height: 1.5;
|
|
127
|
-
position: absolute;
|
|
128
|
-
left: 0.1em;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
129
|
.nut-form-item-top {
|
|
132
130
|
flex-direction: column;
|
|
133
131
|
align-items: flex-start;
|
|
@@ -18,19 +18,25 @@
|
|
|
18
18
|
word-wrap: break-word;
|
|
19
19
|
text-align: $form-item-label-text-align;
|
|
20
20
|
line-height: unset;
|
|
21
|
-
}
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
&-left-required {
|
|
23
|
+
color: $form-item-required-color;
|
|
24
|
+
margin-right: $form-item-required-margin-right;
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: -10px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-right-required {
|
|
30
|
+
color: $form-item-required-color;
|
|
31
|
+
margin-left: $form-item-required-margin-right;
|
|
32
|
+
position: absolute;
|
|
33
|
+
right: -10px;
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
.nut-form-item-labeltxt {
|
|
32
38
|
position: relative;
|
|
33
|
-
font-size:
|
|
39
|
+
font-size: $form-item-label-font-size;
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
&-body {
|
|
@@ -136,13 +142,6 @@
|
|
|
136
142
|
white-space: nowrap;
|
|
137
143
|
}
|
|
138
144
|
|
|
139
|
-
.nut-form-item-label-left-required {
|
|
140
|
-
display: block;
|
|
141
|
-
line-height: 1.5;
|
|
142
|
-
position: absolute;
|
|
143
|
-
left: 0.1em;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
145
|
.nut-form-item-top {
|
|
147
146
|
flex-direction: column;
|
|
148
147
|
align-items: flex-start;
|
|
@@ -22,16 +22,21 @@
|
|
|
22
22
|
text-align: var(--nutui-form-item-label-text-align, left);
|
|
23
23
|
line-height: unset;
|
|
24
24
|
}
|
|
25
|
-
.nut-form-item-label-required {
|
|
25
|
+
.nut-form-item-label-left-required {
|
|
26
26
|
color: var(--nutui-form-item-required-color, var(--nutui-color-danger));
|
|
27
27
|
margin-right: var(--nutui-form-item-required-margin-right, 4px);
|
|
28
|
-
display: block;
|
|
29
28
|
position: absolute;
|
|
30
29
|
left: -10px;
|
|
31
30
|
}
|
|
31
|
+
.nut-form-item-label-right-required {
|
|
32
|
+
color: var(--nutui-form-item-required-color, var(--nutui-color-danger));
|
|
33
|
+
margin-left: var(--nutui-form-item-required-margin-right, 4px);
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: -10px;
|
|
36
|
+
}
|
|
32
37
|
.nut-form-item .nut-form-item-labeltxt {
|
|
33
38
|
position: relative;
|
|
34
|
-
font-size:
|
|
39
|
+
font-size: var(--nutui-form-item-label-font-size, var(--nutui-font-text));
|
|
35
40
|
}
|
|
36
41
|
.nut-form-item-body {
|
|
37
42
|
flex: 1;
|
|
@@ -121,13 +126,6 @@
|
|
|
121
126
|
white-space: nowrap;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
.nut-form-item-label-left-required {
|
|
125
|
-
display: block;
|
|
126
|
-
line-height: 1.5;
|
|
127
|
-
position: absolute;
|
|
128
|
-
left: 0.1em;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
129
|
.nut-form-item-top {
|
|
132
130
|
flex-direction: column;
|
|
133
131
|
align-items: flex-start;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
+
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
3
4
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
5
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
5
6
|
import React, { useEffect, useRef, useState } from "react";
|
|
@@ -12,6 +13,7 @@ import Swiper from "../swiper";
|
|
|
12
13
|
import SwiperItem from "../swiperitem";
|
|
13
14
|
import { ComponentDefaults } from "../../utils/typings";
|
|
14
15
|
import { usePropsValue } from "../../hooks/use-props-value";
|
|
16
|
+
import { mergeProps } from "../../utils";
|
|
15
17
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
16
18
|
images: [],
|
|
17
19
|
videos: [],
|
|
@@ -28,7 +30,24 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
28
30
|
onClose: function() {}
|
|
29
31
|
});
|
|
30
32
|
export var ImagePreview = function(props) {
|
|
31
|
-
var
|
|
33
|
+
var _mergeProps = mergeProps(defaultProps, props), value = _mergeProps.value, className = _mergeProps.className, style = _mergeProps.style, images = _mergeProps.images, videos = _mergeProps.videos, visible = _mergeProps.visible, defaultValue = _mergeProps.defaultValue, indicatorColor = _mergeProps.indicatorColor, pagination = _mergeProps.pagination, indicator = _mergeProps.indicator, autoPlay = _mergeProps.autoPlay, closeOnContentClick = _mergeProps.closeOnContentClick, closeIcon = _mergeProps.closeIcon, closeIconPosition = _mergeProps.closeIconPosition, onClose = _mergeProps.onClose, onChange = _mergeProps.onChange, rest = _object_without_properties(_mergeProps, [
|
|
34
|
+
"value",
|
|
35
|
+
"className",
|
|
36
|
+
"style",
|
|
37
|
+
"images",
|
|
38
|
+
"videos",
|
|
39
|
+
"visible",
|
|
40
|
+
"defaultValue",
|
|
41
|
+
"indicatorColor",
|
|
42
|
+
"pagination",
|
|
43
|
+
"indicator",
|
|
44
|
+
"autoPlay",
|
|
45
|
+
"closeOnContentClick",
|
|
46
|
+
"closeIcon",
|
|
47
|
+
"closeIconPosition",
|
|
48
|
+
"onClose",
|
|
49
|
+
"onChange"
|
|
50
|
+
]);
|
|
32
51
|
var classPrefix = 'nut-imagepreview';
|
|
33
52
|
var ref = useRef(null);
|
|
34
53
|
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
@@ -167,21 +186,18 @@ export var ImagePreview = function(props) {
|
|
|
167
186
|
style: style,
|
|
168
187
|
ref: ref,
|
|
169
188
|
onTouchStart: onTouchStart
|
|
170
|
-
}, showPop && /*#__PURE__*/ React.createElement(Swiper, {
|
|
171
|
-
|
|
172
|
-
duration: duration,
|
|
189
|
+
}, showPop && /*#__PURE__*/ React.createElement(Swiper, _object_spread({
|
|
190
|
+
autoplay: !!duration,
|
|
173
191
|
className: "".concat(classPrefix, "-swiper"),
|
|
174
|
-
loop: true,
|
|
175
192
|
style: {
|
|
176
193
|
'--nutui-indicator-color': indicatorColor
|
|
177
194
|
},
|
|
178
|
-
direction: "horizontal",
|
|
179
195
|
onChange: function(page) {
|
|
180
196
|
return slideChangeEnd(page);
|
|
181
197
|
},
|
|
182
198
|
defaultValue: innerNo > maxNo ? maxNo - 1 : innerNo - 1,
|
|
183
199
|
indicator: indicator
|
|
184
|
-
}, _to_consumable_array(videos.map(function(item) {
|
|
200
|
+
}, rest), _to_consumable_array(videos.map(function(item) {
|
|
185
201
|
return {
|
|
186
202
|
type: 'video',
|
|
187
203
|
data: item
|
|
@@ -2,7 +2,8 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
|
2
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
4
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
5
|
-
import
|
|
5
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
6
|
+
import React, { useEffect, useMemo, useRef, useState, useCallback } from "react";
|
|
6
7
|
import { Close, Notice } from "@nutui/icons-react";
|
|
7
8
|
import classNames from "classnames";
|
|
8
9
|
import { getRect } from "../../utils/get-rect";
|
|
@@ -45,9 +46,10 @@ export var NoticeBar = function(props) {
|
|
|
45
46
|
var _useState8 = _sliced_to_array(useState(null), 2), isCanScroll = _useState8[0], SetIsCanScroll = _useState8[1];
|
|
46
47
|
var isVertical = direction === 'vertical';
|
|
47
48
|
var _useState9 = _sliced_to_array(useState(null), 2), rect = _useState9[0], setRect = _useState9[1];
|
|
48
|
-
var
|
|
49
|
+
var activeRef = useRef(0);
|
|
49
50
|
var _useState10 = _sliced_to_array(useState(false), 2), ready = _useState10[0], setReady = _useState10[1];
|
|
50
51
|
var container = useRef(null);
|
|
52
|
+
var _useState11 = _sliced_to_array(useState(false), 2), isContainerReady = _useState11[0], setIsContainerReady = _useState11[1];
|
|
51
53
|
var innerRef = useRef(null);
|
|
52
54
|
var swiperRef = useRef({
|
|
53
55
|
moving: false,
|
|
@@ -57,8 +59,8 @@ export var NoticeBar = function(props) {
|
|
|
57
59
|
offset: 0,
|
|
58
60
|
size: 0
|
|
59
61
|
});
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
+
var _useState12 = _sliced_to_array(useState([]), 2), childOffset = _useState12[0], setChildOffset = _useState12[1];
|
|
63
|
+
var _useState13 = _sliced_to_array(useState(0), 2), offset = _useState13[0], setOffset = _useState13[1];
|
|
62
64
|
var _useMemo = useMemo(function() {
|
|
63
65
|
var childCount = 0;
|
|
64
66
|
var childs = React.Children.map(children, function(child) {
|
|
@@ -98,7 +100,9 @@ export var NoticeBar = function(props) {
|
|
|
98
100
|
// 销毁事件
|
|
99
101
|
clearInterval(timer);
|
|
100
102
|
};
|
|
101
|
-
}, [
|
|
103
|
+
}, [
|
|
104
|
+
childs
|
|
105
|
+
]);
|
|
102
106
|
useEffect(function() {
|
|
103
107
|
initScrollWrap(content);
|
|
104
108
|
}, [
|
|
@@ -196,24 +200,24 @@ export var NoticeBar = function(props) {
|
|
|
196
200
|
};
|
|
197
201
|
// 垂直自定义滚动方式
|
|
198
202
|
var init = function() {
|
|
199
|
-
var
|
|
203
|
+
var activeIndex = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
200
204
|
var rects = getRect(container === null || container === void 0 ? void 0 : container.current);
|
|
201
|
-
var _active = Math.max(Math.min(childCount - 1,
|
|
205
|
+
var _active = Math.max(Math.min(childCount - 1, activeIndex), 0);
|
|
202
206
|
var _height = rects.height;
|
|
203
207
|
trackSize = childCount * Number(_height);
|
|
204
208
|
var targetOffset = getOffset(_active);
|
|
205
|
-
|
|
206
|
-
if (ready) {
|
|
207
|
-
swiperRef.current.moving = false;
|
|
208
|
-
}
|
|
209
|
-
active = _active;
|
|
209
|
+
activeRef.current = _active;
|
|
210
210
|
setRect(rects);
|
|
211
211
|
setOffset(targetOffset);
|
|
212
|
+
setChildOffset(new Array(childCount).fill(0));
|
|
213
|
+
// 关闭动画并立即设置样式
|
|
214
|
+
swiperRef.current.moving = true;
|
|
215
|
+
setStyle(targetOffset, rects);
|
|
216
|
+
swiperRef.current.moving = false;
|
|
212
217
|
setReady(true);
|
|
213
218
|
};
|
|
214
219
|
useEffect(function() {
|
|
215
220
|
if (ready) {
|
|
216
|
-
stopAutoPlay();
|
|
217
221
|
autoplay();
|
|
218
222
|
}
|
|
219
223
|
return function() {
|
|
@@ -223,18 +227,19 @@ export var NoticeBar = function(props) {
|
|
|
223
227
|
ready
|
|
224
228
|
]);
|
|
225
229
|
useEffect(function() {
|
|
226
|
-
if (isVertical && children) {
|
|
227
|
-
init();
|
|
230
|
+
if (isVertical && children && isContainerReady) {
|
|
228
231
|
stopAutoPlay();
|
|
229
|
-
|
|
232
|
+
setReady(false);
|
|
233
|
+
init();
|
|
230
234
|
}
|
|
231
235
|
}, [
|
|
232
236
|
children,
|
|
233
|
-
|
|
237
|
+
isContainerReady
|
|
234
238
|
]);
|
|
235
239
|
// 清除定时器
|
|
236
240
|
var stopAutoPlay = function() {
|
|
237
241
|
clearTimeout(swiperRef.current.autoplayTimer);
|
|
242
|
+
swiperRef.current.moving = false;
|
|
238
243
|
swiperRef.current.autoplayTimer = null;
|
|
239
244
|
};
|
|
240
245
|
// 定时轮播
|
|
@@ -254,22 +259,25 @@ export var NoticeBar = function(props) {
|
|
|
254
259
|
// 父级容器偏移量
|
|
255
260
|
var targetOffset = getOffset(targetActive, offset);
|
|
256
261
|
// 循环滚动,调整开头结尾图片位置
|
|
257
|
-
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
262
|
+
setChildOffset(function(prevChildOffset) {
|
|
263
|
+
var newChildOffset = _to_consumable_array(prevChildOffset);
|
|
264
|
+
if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
|
|
265
|
+
var rightBound = targetOffset < minOffset;
|
|
266
|
+
newChildOffset[0] = rightBound ? trackSize : 0;
|
|
267
|
+
}
|
|
268
|
+
if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
|
|
269
|
+
var leftBound = targetOffset > 0;
|
|
270
|
+
newChildOffset[childCount - 1] = leftBound ? -trackSize : 0;
|
|
271
|
+
}
|
|
272
|
+
return newChildOffset;
|
|
273
|
+
});
|
|
274
|
+
activeRef.current = targetActive;
|
|
267
275
|
setOffset(targetOffset);
|
|
268
|
-
|
|
276
|
+
setStyle(targetOffset);
|
|
269
277
|
};
|
|
270
278
|
// 下一页
|
|
271
279
|
var next = function() {
|
|
272
|
-
|
|
280
|
+
resetPosition();
|
|
273
281
|
requestFrame(function() {
|
|
274
282
|
requestFrame(function() {
|
|
275
283
|
swiperRef.current.moving = false;
|
|
@@ -282,18 +290,19 @@ export var NoticeBar = function(props) {
|
|
|
282
290
|
var handleItemClick = function(event, value) {
|
|
283
291
|
onItemClick && onItemClick(event, value);
|
|
284
292
|
};
|
|
285
|
-
var
|
|
286
|
-
var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset;
|
|
293
|
+
var setStyle = function() {
|
|
294
|
+
var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset, currentRect = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : rect;
|
|
287
295
|
var target = innerRef.current;
|
|
288
296
|
if (!target) {
|
|
289
297
|
return;
|
|
290
298
|
}
|
|
291
299
|
var _offset = 0;
|
|
292
|
-
//
|
|
293
|
-
var
|
|
294
|
-
|
|
300
|
+
// 使用传入的 currentRect 或状态中的 rect
|
|
301
|
+
var containerHeight = (currentRect === null || currentRect === void 0 ? void 0 : currentRect.height) || height;
|
|
302
|
+
var val = containerHeight - Number(height);
|
|
303
|
+
_offset = moveOffset + Number(activeRef.current === childCount - 1 && val / 2);
|
|
295
304
|
target.style.transitionDuration = "".concat(swiperRef.current.moving ? 0 : duration, "ms");
|
|
296
|
-
target.style.height = "".concat(Number(height) * childCount, "px");
|
|
305
|
+
target.style.height = "".concat(Number(height) * (childCount + 1), "px");
|
|
297
306
|
target.style.transform = "translate3D(0,".concat(_offset, "px,0)");
|
|
298
307
|
};
|
|
299
308
|
// 无缝滚动第一个元素位移控制
|
|
@@ -311,11 +320,12 @@ export var NoticeBar = function(props) {
|
|
|
311
320
|
};
|
|
312
321
|
// 确定当前active 元素
|
|
313
322
|
var getActive = function(pace) {
|
|
323
|
+
var currentActive = activeRef.current;
|
|
314
324
|
if (pace) {
|
|
315
|
-
var _active =
|
|
325
|
+
var _active = currentActive + pace;
|
|
316
326
|
return range(_active, -1, childCount);
|
|
317
327
|
}
|
|
318
|
-
return
|
|
328
|
+
return currentActive;
|
|
319
329
|
};
|
|
320
330
|
// 计算位移
|
|
321
331
|
var getOffset = function(active) {
|
|
@@ -333,14 +343,15 @@ export var NoticeBar = function(props) {
|
|
|
333
343
|
return Math.min(Math.max(num, min), max);
|
|
334
344
|
};
|
|
335
345
|
// 重置首尾位置信息
|
|
336
|
-
var
|
|
346
|
+
var resetPosition = function() {
|
|
347
|
+
var currentActive = activeRef.current;
|
|
337
348
|
swiperRef.current.moving = true;
|
|
338
|
-
if (
|
|
349
|
+
if (currentActive <= -1) {
|
|
339
350
|
move({
|
|
340
351
|
pace: childCount
|
|
341
352
|
});
|
|
342
353
|
}
|
|
343
|
-
if (
|
|
354
|
+
if (currentActive >= childCount) {
|
|
344
355
|
move({
|
|
345
356
|
pace: -childCount
|
|
346
357
|
});
|
|
@@ -354,6 +365,20 @@ export var NoticeBar = function(props) {
|
|
|
354
365
|
stopAutoPlay();
|
|
355
366
|
};
|
|
356
367
|
}, []);
|
|
368
|
+
var hasVerticalContent = useMemo(function() {
|
|
369
|
+
if (!isVertical) return false;
|
|
370
|
+
if (children) return (childs === null || childs === void 0 ? void 0 : childs.length) > 0;
|
|
371
|
+
return (list === null || list === void 0 ? void 0 : list.length) > 0;
|
|
372
|
+
}, [
|
|
373
|
+
isVertical,
|
|
374
|
+
childs,
|
|
375
|
+
list,
|
|
376
|
+
children
|
|
377
|
+
]);
|
|
378
|
+
var containerRefCallback = useCallback(function(ref) {
|
|
379
|
+
container.current = ref;
|
|
380
|
+
setIsContainerReady(true);
|
|
381
|
+
}, []);
|
|
357
382
|
return /*#__PURE__*/ React.createElement("div", {
|
|
358
383
|
className: cls,
|
|
359
384
|
style: style
|
|
@@ -379,10 +404,10 @@ export var NoticeBar = function(props) {
|
|
|
379
404
|
}, rightIcon || /*#__PURE__*/ React.createElement(Close, {
|
|
380
405
|
width: 12,
|
|
381
406
|
height: 12
|
|
382
|
-
})) : null) : null, showNoticeBar &&
|
|
407
|
+
})) : null) : null, showNoticeBar && hasVerticalContent && isVertical ? /*#__PURE__*/ React.createElement("div", {
|
|
383
408
|
className: "nut-noticebar-vertical",
|
|
384
409
|
style: barStyle,
|
|
385
|
-
ref:
|
|
410
|
+
ref: containerRefCallback,
|
|
386
411
|
onClick: handleClick
|
|
387
412
|
}, leftIcon ? /*#__PURE__*/ React.createElement("div", {
|
|
388
413
|
className: "nut-noticebar-box-left-icon"
|
|
@@ -4,6 +4,8 @@ import { BaseProps } from '../../base/props';
|
|
|
4
4
|
export interface CalendarDay {
|
|
5
5
|
day: SimpleValue;
|
|
6
6
|
type: string;
|
|
7
|
+
month?: SimpleValue;
|
|
8
|
+
year?: SimpleValue;
|
|
7
9
|
}
|
|
8
10
|
export interface CalendarMonthInfo {
|
|
9
11
|
curData: string[] | string;
|
|
@@ -121,7 +123,7 @@ export interface BaseCalendar {
|
|
|
121
123
|
/**
|
|
122
124
|
* 点击/选择后触发
|
|
123
125
|
*/
|
|
124
|
-
onDayClick: (data: string) => void
|
|
126
|
+
onDayClick: (data: string[]) => void
|
|
125
127
|
/**
|
|
126
128
|
* 年月子标题到达顶部时触发
|
|
127
129
|
*/
|
|
@@ -20,7 +20,7 @@ export interface BaseDatePicker extends BaseProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* 类时间类型,可选值 date time year-month month-day datehour datetime hour-minutes
|
|
22
22
|
*/
|
|
23
|
-
type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes'
|
|
23
|
+
type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes' | ''
|
|
24
24
|
/**
|
|
25
25
|
* 每列是否展示中文
|
|
26
26
|
*/
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { BaseImagePreview } from './base';
|
|
2
|
-
|
|
2
|
+
import { WebSwiperProps } from "../../../types";
|
|
3
|
+
type props = BaseImagePreview & Omit<WebSwiperProps, 'autoPlay' | 'indicator'>;
|
|
4
|
+
export interface WebImagePreviewProps extends Omit<props, 'autoplay'> {
|
|
3
5
|
}
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BaseImagePreview } from './base';
|
|
2
|
-
|
|
2
|
+
import { TaroSwiperProps } from "../../../types";
|
|
3
|
+
type props = Omit<BaseImagePreview, 'autoPlay'> & Omit<TaroSwiperProps, 'autoPlay' | 'autoplay' | 'indicator'>;
|
|
4
|
+
export interface TaroImagePreviewProps extends props {
|
|
3
5
|
autoPlay: boolean;
|
|
4
6
|
showMenuByLongpress: boolean;
|
|
5
7
|
}
|
|
8
|
+
export {};
|
package/dist/es/utils/date.d.ts
CHANGED
|
@@ -60,6 +60,6 @@ export declare const getDaysStatus: (type: string, year: number, month: number)
|
|
|
60
60
|
export declare const getPreMonthDates: (type: string, year: number, month: number, firstDayOfWeek: number) => {
|
|
61
61
|
day: number;
|
|
62
62
|
type: string;
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
year: number;
|
|
64
|
+
month: number;
|
|
65
65
|
}[];
|
package/dist/es/utils/date.js
CHANGED
|
@@ -229,8 +229,8 @@ export var getPreMonthDates = function(type, year, month, firstDayOfWeek) {
|
|
|
229
229
|
return {
|
|
230
230
|
day: k + 1,
|
|
231
231
|
type: type,
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
year: preYear,
|
|
233
|
+
month: preMonth
|
|
234
234
|
};
|
|
235
235
|
});
|
|
236
236
|
return months.slice(preDates - days);
|