@nutui/nutui-react-taro 2.6.20 → 2.6.21
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 +13 -5
- package/dist/esm/Barrage.js +1 -1
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/{barrage.taro-CA-9uADD.js → barrage.taro-D2lmvcB-.js} +40 -26
- package/dist/esm/nutui-react.es.js +2 -2
- package/dist/esm/{uploader.taro-C-8Jf7un.js → uploader.taro-DZyZiEi2.js} +7 -6
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +52 -34
- package/dist/nutui.react.umd.js +52 -34
- package/dist/types/packages/uploader/uploader.d.ts +1 -0
- package/dist/types/packages/uploader/uploader.taro.d.ts +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
# v2.6.
|
|
2
|
-
`2024-09-
|
|
1
|
+
# v2.6.21
|
|
2
|
+
`2024-09-27`
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
* 🏡 chore: update dependency linguist-languages to be included within package (#2607)
|
|
6
|
+
* :sparkles: feat(Uploader): add support for deleteIcon prop customization (#2618)
|
|
7
|
+
* :bug: fix: 修改jd小程序高版本弹幕不滚动问题 (#2612)
|
|
3
8
|
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
# v2.6.20
|
|
11
|
+
|
|
12
|
+
`2024-09-20`
|
|
8
13
|
|
|
14
|
+
- :bug: fix: i18n (#2597)
|
|
15
|
+
- :bug: fix: 类型构建错误 (#2605)
|
|
16
|
+
- 🏡 chore: replace local prettier plugin with npm package (#2603)
|
|
9
17
|
|
|
10
18
|
# v2.6.19
|
|
11
19
|
|
package/dist/esm/Barrage.js
CHANGED
package/dist/esm/Uploader.js
CHANGED
|
@@ -12,6 +12,7 @@ const InternalBarrage = (props, ref) => {
|
|
|
12
12
|
const barrageContainer = useRef(null);
|
|
13
13
|
const barrageCWidth = useRef(0);
|
|
14
14
|
const timer = useRef(0);
|
|
15
|
+
const domTimer = useRef(0);
|
|
15
16
|
const index = useRef(0);
|
|
16
17
|
const times = useRef([]);
|
|
17
18
|
const historyIndex = useRef(-1);
|
|
@@ -33,25 +34,31 @@ const InternalBarrage = (props, ref) => {
|
|
|
33
34
|
}
|
|
34
35
|
return 0;
|
|
35
36
|
});
|
|
37
|
+
const clearDomTimeout = () => {
|
|
38
|
+
if (domTimer.current) {
|
|
39
|
+
clearTimeout(domTimer.current);
|
|
40
|
+
domTimer.current = 0;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
36
43
|
useEffect(() => {
|
|
37
44
|
const init = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
var _a2;
|
|
38
46
|
if (barrageBody.current) {
|
|
39
47
|
barrageCWidth.current = yield getNodeWidth(barrageBody.current);
|
|
48
|
+
(_a2 = barrageBody.current) === null || _a2 === void 0 ? void 0 : _a2.style.setProperty("--move-distance", `-${barrageCWidth.current}px`);
|
|
49
|
+
index.current = 0;
|
|
50
|
+
run();
|
|
40
51
|
}
|
|
41
52
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _a2;
|
|
45
|
-
(_a2 = barrageBody.current) === null || _a2 === void 0 ? void 0 : _a2.style.setProperty("--move-distance", `-${barrageCWidth.current}px`);
|
|
46
|
-
index.current = 0;
|
|
47
|
-
run();
|
|
53
|
+
domTimer.current = window.setTimeout(() => {
|
|
54
|
+
init();
|
|
48
55
|
}, 300);
|
|
49
56
|
return () => {
|
|
50
|
-
|
|
57
|
+
clearDomTimeout();
|
|
51
58
|
};
|
|
52
59
|
}, [list]);
|
|
53
60
|
const run = () => {
|
|
54
|
-
|
|
61
|
+
clearTimeout(timer.current);
|
|
55
62
|
let intervalCache = interval;
|
|
56
63
|
const _index = (loop ? index.current % list.length : index.current) % rows;
|
|
57
64
|
const result = times.current[_index] - rows * interval;
|
|
@@ -62,7 +69,28 @@ const InternalBarrage = (props, ref) => {
|
|
|
62
69
|
play();
|
|
63
70
|
}, intervalCache);
|
|
64
71
|
};
|
|
65
|
-
const
|
|
72
|
+
const setStyle = (el, currentIndex) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
try {
|
|
74
|
+
if (el) {
|
|
75
|
+
const refe = yield getRectByTaro(el);
|
|
76
|
+
const width = refe.width;
|
|
77
|
+
const height = refe.height;
|
|
78
|
+
el.classList.add("move");
|
|
79
|
+
const elScrollDuration = Math.round(width / barrageCWidth.current * duration);
|
|
80
|
+
times.current[currentIndex] = elScrollDuration;
|
|
81
|
+
el.style.animationDuration = `${duration + elScrollDuration}ms`;
|
|
82
|
+
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
83
|
+
el.style.width = `${width}px`;
|
|
84
|
+
}
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.log("异常自动流转到下一个", error);
|
|
87
|
+
barrageContainer.current.removeChild(el);
|
|
88
|
+
}
|
|
89
|
+
el.addEventListener("animationend", () => {
|
|
90
|
+
barrageContainer.current.removeChild(el);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
const play = () => {
|
|
66
94
|
if (!loop && index.current >= list.length) {
|
|
67
95
|
return;
|
|
68
96
|
}
|
|
@@ -74,26 +102,12 @@ const InternalBarrage = (props, ref) => {
|
|
|
74
102
|
}
|
|
75
103
|
historyIndex.current = currentIndex;
|
|
76
104
|
el.innerHTML = list[_index];
|
|
77
|
-
el.classList.add("barrage-item");
|
|
78
105
|
barrageContainer.current.appendChild(el);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const height = yield getNodeWidth(el, "height");
|
|
82
|
-
el.classList.add("move");
|
|
83
|
-
const elScrollDuration = width / barrageCWidth.current * duration;
|
|
84
|
-
times.current[currentIndex] = Math.ceil(elScrollDuration);
|
|
85
|
-
el.style.animationDuration = `${(duration + elScrollDuration).toFixed(2)}ms`;
|
|
86
|
-
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
87
|
-
el.style.width = `${width}px`;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.log("异常自动流转到下一个");
|
|
90
|
-
}
|
|
91
|
-
el.addEventListener("animationend", () => {
|
|
92
|
-
barrageContainer.current.removeChild(el);
|
|
93
|
-
});
|
|
106
|
+
el.classList.add("barrage-item");
|
|
107
|
+
requestAnimationFrame(() => setStyle(el, currentIndex));
|
|
94
108
|
index.current++;
|
|
95
109
|
run();
|
|
96
|
-
}
|
|
110
|
+
};
|
|
97
111
|
return React__default.createElement(
|
|
98
112
|
View,
|
|
99
113
|
Object.assign({ className: classes, ref: barrageBody }, restProps),
|
|
@@ -47,7 +47,7 @@ import { S as S8 } from "./shortpassword.taro-ByEtEDDl.js";
|
|
|
47
47
|
import { S as S9 } from "./signature.taro-BW4eiGIR.js";
|
|
48
48
|
import { S as S10 } from "./switch.taro-CdBmDo18.js";
|
|
49
49
|
import { T as T5 } from "./textarea.taro-EJQxRHZR.js";
|
|
50
|
-
import { U } from "./uploader.taro-
|
|
50
|
+
import { U } from "./uploader.taro-DZyZiEi2.js";
|
|
51
51
|
import { A as A2 } from "./actionsheet.taro-CgfXnK1M.js";
|
|
52
52
|
import { B as B3 } from "./badge.taro-B42_7q8v.js";
|
|
53
53
|
import { B as B4 } from "./dialog.taro-Bg730q8d.js";
|
|
@@ -87,7 +87,7 @@ import { T as T8 } from "./tag.taro-CFt28RLm.js";
|
|
|
87
87
|
import { T as T9 } from "./tour.taro-BvBZa8nq.js";
|
|
88
88
|
import { V } from "./video.taro-CecLv4sr.js";
|
|
89
89
|
import { V as V2 } from "./virtuallist.taro-BlPW8ibd.js";
|
|
90
|
-
import { B as B5 } from "./barrage.taro-
|
|
90
|
+
import { B as B5 } from "./barrage.taro-D2lmvcB-.js";
|
|
91
91
|
import { C as C14 } from "./card.taro-DxcIi5qH.js";
|
|
92
92
|
import { T as T10 } from "./timedetail.taro-ya5JNy2L.js";
|
|
93
93
|
import { T as T11 } from "./timeselect.taro-DE_a87DT.js";
|
|
@@ -2,13 +2,13 @@ import { _ as __rest } from "./tslib.es6-iWu3F_1J.js";
|
|
|
2
2
|
import React__default, { useState, useImperativeHandle, useRef, useEffect } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import Taro, { uploadFile, getEnv, chooseMedia, chooseImage } from "@tarojs/taro";
|
|
5
|
-
import {
|
|
5
|
+
import { Link, Del, Failure, Loading, Photograph } from "@nutui/icons-react-taro";
|
|
6
6
|
import { B as Button } from "./button.taro-1kEru6r9.js";
|
|
7
7
|
import { u as useConfig } from "./configprovider.taro-C3WyeHSO.js";
|
|
8
8
|
import { a as isPromise } from "./index-DeNfBlua.js";
|
|
9
9
|
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
10
10
|
import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
|
|
11
|
-
import { Image } from "@tarojs/components";
|
|
11
|
+
import { View, Image } from "@tarojs/components";
|
|
12
12
|
import { P as Progress } from "./progress.taro-CaIUT9Uo.js";
|
|
13
13
|
class UploadOptions {
|
|
14
14
|
constructor() {
|
|
@@ -138,7 +138,7 @@ class FileItem {
|
|
|
138
138
|
this.formData = {};
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
const Preview = ({ fileList, previewType, deletable, onDeleteItem, handleItemClick, previewUrl, children }) => {
|
|
141
|
+
const Preview = ({ fileList, previewType, deletable, onDeleteItem, handleItemClick, previewUrl, deleteIcon, children }) => {
|
|
142
142
|
const renderIcon = (item) => {
|
|
143
143
|
if (item.status === ERROR) {
|
|
144
144
|
return item.failIcon || React__default.createElement(Failure, { color: "#fff" });
|
|
@@ -150,7 +150,7 @@ const Preview = ({ fileList, previewType, deletable, onDeleteItem, handleItemCli
|
|
|
150
150
|
return React__default.createElement(
|
|
151
151
|
"div",
|
|
152
152
|
{ className: `nut-uploader-preview ${previewType}`, key: item.uid },
|
|
153
|
-
previewType === "picture" && !children && deletable && React__default.createElement(
|
|
153
|
+
previewType === "picture" && !children && deletable && React__default.createElement(View, { className: "close", onClick: () => onDeleteItem(item, index) }, deleteIcon),
|
|
154
154
|
previewType === "picture" && !children && React__default.createElement(
|
|
155
155
|
"div",
|
|
156
156
|
{ className: "nut-uploader-preview-img" },
|
|
@@ -201,12 +201,12 @@ const Preview = ({ fileList, previewType, deletable, onDeleteItem, handleItemCli
|
|
|
201
201
|
);
|
|
202
202
|
}));
|
|
203
203
|
};
|
|
204
|
-
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { url: "", maxCount: 1, sizeType: ["original", "compressed"], sourceType: ["album", "camera"], mediaType: ["image", "video"], camera: "back", uploadIcon: React__default.createElement(Photograph, { size: "20px", color: "#808080" }), uploadLabel: "", previewType: "picture", fit: "cover", name: "file", accept: "*", disabled: false, autoUpload: true, multiple: false, maxFileSize: Number.MAX_VALUE, data: {}, headers: {}, method: "post", previewUrl: "", xhrState: 200, timeout: 1e3 * 30, preview: true, deletable: true, maxDuration: 10, beforeDelete: (file, files) => {
|
|
204
|
+
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { url: "", maxCount: 1, sizeType: ["original", "compressed"], sourceType: ["album", "camera"], mediaType: ["image", "video"], camera: "back", uploadIcon: React__default.createElement(Photograph, { size: "20px", color: "#808080" }), deleteIcon: React__default.createElement(Failure, { color: "rgba(0,0,0,0.6)" }), uploadLabel: "", previewType: "picture", fit: "cover", name: "file", accept: "*", disabled: false, autoUpload: true, multiple: false, maxFileSize: Number.MAX_VALUE, data: {}, headers: {}, method: "post", previewUrl: "", xhrState: 200, timeout: 1e3 * 30, preview: true, deletable: true, maxDuration: 10, beforeDelete: (file, files) => {
|
|
205
205
|
return true;
|
|
206
206
|
} });
|
|
207
207
|
const InternalUploader = (props, ref) => {
|
|
208
208
|
const { locale } = useConfig();
|
|
209
|
-
const _a = Object.assign(Object.assign({}, defaultProps), props), { children, uploadIcon, uploadLabel, accept, name, camera, defaultValue, value, previewType, fit, disabled, multiple, url, previewUrl, headers, timeout, method, xhrState, data, preview, deletable, maxCount, maxFileSize, mediaType, className, autoUpload, sizeType, sourceType, maxDuration, onStart, onDelete, onChange, onFileItemClick, onProgress, onSuccess, onUpdate, onFailure, onOversize, beforeUpload, beforeXhrUpload, beforeDelete } = _a, restProps = __rest(_a, ["children", "uploadIcon", "uploadLabel", "accept", "name", "camera", "defaultValue", "value", "previewType", "fit", "disabled", "multiple", "url", "previewUrl", "headers", "timeout", "method", "xhrState", "data", "preview", "deletable", "maxCount", "maxFileSize", "mediaType", "className", "autoUpload", "sizeType", "sourceType", "maxDuration", "onStart", "onDelete", "onChange", "onFileItemClick", "onProgress", "onSuccess", "onUpdate", "onFailure", "onOversize", "beforeUpload", "beforeXhrUpload", "beforeDelete"]);
|
|
209
|
+
const _a = Object.assign(Object.assign({}, defaultProps), props), { children, uploadIcon, deleteIcon, uploadLabel, accept, name, camera, defaultValue, value, previewType, fit, disabled, multiple, url, previewUrl, headers, timeout, method, xhrState, data, preview, deletable, maxCount, maxFileSize, mediaType, className, autoUpload, sizeType, sourceType, maxDuration, onStart, onDelete, onChange, onFileItemClick, onProgress, onSuccess, onUpdate, onFailure, onOversize, beforeUpload, beforeXhrUpload, beforeDelete } = _a, restProps = __rest(_a, ["children", "uploadIcon", "deleteIcon", "uploadLabel", "accept", "name", "camera", "defaultValue", "value", "previewType", "fit", "disabled", "multiple", "url", "previewUrl", "headers", "timeout", "method", "xhrState", "data", "preview", "deletable", "maxCount", "maxFileSize", "mediaType", "className", "autoUpload", "sizeType", "sourceType", "maxDuration", "onStart", "onDelete", "onChange", "onFileItemClick", "onProgress", "onSuccess", "onUpdate", "onFailure", "onOversize", "beforeUpload", "beforeXhrUpload", "beforeDelete"]);
|
|
210
210
|
const [fileList, setFileList] = usePropsValue({
|
|
211
211
|
value,
|
|
212
212
|
defaultValue,
|
|
@@ -484,6 +484,7 @@ const InternalUploader = (props, ref) => {
|
|
|
484
484
|
onDeleteItem,
|
|
485
485
|
handleItemClick,
|
|
486
486
|
previewUrl,
|
|
487
|
+
deleteIcon,
|
|
487
488
|
children
|
|
488
489
|
}),
|
|
489
490
|
Number(maxCount) > fileList.length && previewType === "picture" && !children && React__default.createElement(
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED
package/dist/nutui.react.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v2.6.
|
|
2
|
+
* @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:02:22 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -12862,6 +12862,7 @@ const Preview = ({
|
|
|
12862
12862
|
onDeleteItem,
|
|
12863
12863
|
handleItemClick,
|
|
12864
12864
|
previewUrl,
|
|
12865
|
+
deleteIcon,
|
|
12865
12866
|
children
|
|
12866
12867
|
}) => {
|
|
12867
12868
|
const renderIcon = (item) => {
|
|
@@ -12879,12 +12880,12 @@ const Preview = ({
|
|
|
12879
12880
|
key: item.uid
|
|
12880
12881
|
},
|
|
12881
12882
|
previewType === "picture" && !children && deletable && /* @__PURE__ */ React__default.createElement(
|
|
12882
|
-
|
|
12883
|
+
View,
|
|
12883
12884
|
{
|
|
12884
|
-
color: "rgba(0,0,0,0.6)",
|
|
12885
12885
|
className: "close",
|
|
12886
12886
|
onClick: () => onDeleteItem(item, index)
|
|
12887
|
-
}
|
|
12887
|
+
},
|
|
12888
|
+
deleteIcon
|
|
12888
12889
|
),
|
|
12889
12890
|
previewType === "picture" && !children && /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-img" }, item.status === "ready" ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)) : item.status !== "success" && /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress" }, renderIcon(item), /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)), ((_a = item.type) == null ? void 0 : _a.includes("image")) ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, item.url && /* @__PURE__ */ React__default.createElement(
|
|
12890
12891
|
Image$2,
|
|
@@ -12947,6 +12948,7 @@ const defaultProps$H = {
|
|
|
12947
12948
|
mediaType: ["image", "video"],
|
|
12948
12949
|
camera: "back",
|
|
12949
12950
|
uploadIcon: /* @__PURE__ */ React__default.createElement(y, { size: "20px", color: "#808080" }),
|
|
12951
|
+
deleteIcon: /* @__PURE__ */ React__default.createElement(u$1, { color: "rgba(0,0,0,0.6)" }),
|
|
12950
12952
|
uploadLabel: "",
|
|
12951
12953
|
previewType: "picture",
|
|
12952
12954
|
fit: "cover",
|
|
@@ -12974,6 +12976,7 @@ const InternalUploader = (props, ref) => {
|
|
|
12974
12976
|
const {
|
|
12975
12977
|
children,
|
|
12976
12978
|
uploadIcon,
|
|
12979
|
+
deleteIcon,
|
|
12977
12980
|
uploadLabel,
|
|
12978
12981
|
accept,
|
|
12979
12982
|
name,
|
|
@@ -13300,6 +13303,7 @@ const InternalUploader = (props, ref) => {
|
|
|
13300
13303
|
onDeleteItem,
|
|
13301
13304
|
handleItemClick,
|
|
13302
13305
|
previewUrl,
|
|
13306
|
+
deleteIcon,
|
|
13303
13307
|
children
|
|
13304
13308
|
}
|
|
13305
13309
|
}
|
|
@@ -18355,6 +18359,7 @@ const InternalBarrage = (props, ref) => {
|
|
|
18355
18359
|
const barrageContainer = useRef(null);
|
|
18356
18360
|
const barrageCWidth = useRef(0);
|
|
18357
18361
|
const timer = useRef(0);
|
|
18362
|
+
const domTimer = useRef(0);
|
|
18358
18363
|
const index = useRef(0);
|
|
18359
18364
|
const times = useRef([]);
|
|
18360
18365
|
const historyIndex = useRef(-1);
|
|
@@ -18376,28 +18381,34 @@ const InternalBarrage = (props, ref) => {
|
|
|
18376
18381
|
}
|
|
18377
18382
|
return 0;
|
|
18378
18383
|
};
|
|
18384
|
+
const clearDomTimeout = () => {
|
|
18385
|
+
if (domTimer.current) {
|
|
18386
|
+
clearTimeout(domTimer.current);
|
|
18387
|
+
domTimer.current = 0;
|
|
18388
|
+
}
|
|
18389
|
+
};
|
|
18379
18390
|
useEffect(() => {
|
|
18380
18391
|
const init = async () => {
|
|
18392
|
+
var _a;
|
|
18381
18393
|
if (barrageBody.current) {
|
|
18382
18394
|
barrageCWidth.current = await getNodeWidth(barrageBody.current);
|
|
18395
|
+
(_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
|
|
18396
|
+
"--move-distance",
|
|
18397
|
+
`-${barrageCWidth.current}px`
|
|
18398
|
+
);
|
|
18399
|
+
index.current = 0;
|
|
18400
|
+
run();
|
|
18383
18401
|
}
|
|
18384
18402
|
};
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
var _a;
|
|
18388
|
-
(_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
|
|
18389
|
-
"--move-distance",
|
|
18390
|
-
`-${barrageCWidth.current}px`
|
|
18391
|
-
);
|
|
18392
|
-
index.current = 0;
|
|
18393
|
-
run();
|
|
18403
|
+
domTimer.current = window.setTimeout(() => {
|
|
18404
|
+
init();
|
|
18394
18405
|
}, 300);
|
|
18395
18406
|
return () => {
|
|
18396
|
-
|
|
18407
|
+
clearDomTimeout();
|
|
18397
18408
|
};
|
|
18398
18409
|
}, [list]);
|
|
18399
18410
|
const run = () => {
|
|
18400
|
-
|
|
18411
|
+
clearTimeout(timer.current);
|
|
18401
18412
|
let intervalCache = interval;
|
|
18402
18413
|
const _index = (loop ? index.current % list.length : index.current) % rows;
|
|
18403
18414
|
const result = times.current[_index] - rows * interval;
|
|
@@ -18408,7 +18419,30 @@ const InternalBarrage = (props, ref) => {
|
|
|
18408
18419
|
play();
|
|
18409
18420
|
}, intervalCache);
|
|
18410
18421
|
};
|
|
18411
|
-
const
|
|
18422
|
+
const setStyle = async (el, currentIndex) => {
|
|
18423
|
+
try {
|
|
18424
|
+
if (el) {
|
|
18425
|
+
const refe = await getRectByTaro(el);
|
|
18426
|
+
const width = refe.width;
|
|
18427
|
+
const height = refe.height;
|
|
18428
|
+
el.classList.add("move");
|
|
18429
|
+
const elScrollDuration = Math.round(
|
|
18430
|
+
width / barrageCWidth.current * duration
|
|
18431
|
+
);
|
|
18432
|
+
times.current[currentIndex] = elScrollDuration;
|
|
18433
|
+
el.style.animationDuration = `${duration + elScrollDuration}ms`;
|
|
18434
|
+
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
18435
|
+
el.style.width = `${width}px`;
|
|
18436
|
+
}
|
|
18437
|
+
} catch (error) {
|
|
18438
|
+
console.log("异常自动流转到下一个", error);
|
|
18439
|
+
barrageContainer.current.removeChild(el);
|
|
18440
|
+
}
|
|
18441
|
+
el.addEventListener("animationend", () => {
|
|
18442
|
+
barrageContainer.current.removeChild(el);
|
|
18443
|
+
});
|
|
18444
|
+
};
|
|
18445
|
+
const play = () => {
|
|
18412
18446
|
if (!loop && index.current >= list.length) {
|
|
18413
18447
|
return;
|
|
18414
18448
|
}
|
|
@@ -18420,25 +18454,9 @@ const InternalBarrage = (props, ref) => {
|
|
|
18420
18454
|
}
|
|
18421
18455
|
historyIndex.current = currentIndex;
|
|
18422
18456
|
el.innerHTML = list[_index];
|
|
18423
|
-
el.classList.add("barrage-item");
|
|
18424
18457
|
barrageContainer.current.appendChild(el);
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
const height = await getNodeWidth(el, "height");
|
|
18428
|
-
el.classList.add("move");
|
|
18429
|
-
const elScrollDuration = width / barrageCWidth.current * duration;
|
|
18430
|
-
times.current[currentIndex] = Math.ceil(elScrollDuration);
|
|
18431
|
-
el.style.animationDuration = `${(duration + elScrollDuration).toFixed(
|
|
18432
|
-
2
|
|
18433
|
-
)}ms`;
|
|
18434
|
-
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
18435
|
-
el.style.width = `${width}px`;
|
|
18436
|
-
} catch (error) {
|
|
18437
|
-
console.log("异常自动流转到下一个");
|
|
18438
|
-
}
|
|
18439
|
-
el.addEventListener("animationend", () => {
|
|
18440
|
-
barrageContainer.current.removeChild(el);
|
|
18441
|
-
});
|
|
18458
|
+
el.classList.add("barrage-item");
|
|
18459
|
+
requestAnimationFrame(() => setStyle(el, currentIndex));
|
|
18442
18460
|
index.current++;
|
|
18443
18461
|
run();
|
|
18444
18462
|
};
|
package/dist/nutui.react.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
|
|
3
3
|
})(this, function(exports2, React, Taro, components, ReactDOM) {
|
|
4
4
|
"use strict";/*!
|
|
5
|
-
* @nutui/nutui-react-taro v2.6.
|
|
5
|
+
* @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:02:22 GMT+0800 (China Standard Time)
|
|
6
6
|
* (c) 2023 @jdf2e.
|
|
7
7
|
* Released under the MIT License.
|
|
8
8
|
*/
|
|
@@ -12878,6 +12878,7 @@
|
|
|
12878
12878
|
onDeleteItem,
|
|
12879
12879
|
handleItemClick,
|
|
12880
12880
|
previewUrl,
|
|
12881
|
+
deleteIcon,
|
|
12881
12882
|
children
|
|
12882
12883
|
}) => {
|
|
12883
12884
|
const renderIcon = (item) => {
|
|
@@ -12895,12 +12896,12 @@
|
|
|
12895
12896
|
key: item.uid
|
|
12896
12897
|
},
|
|
12897
12898
|
previewType === "picture" && !children && deletable && /* @__PURE__ */ React.createElement(
|
|
12898
|
-
|
|
12899
|
+
components.View,
|
|
12899
12900
|
{
|
|
12900
|
-
color: "rgba(0,0,0,0.6)",
|
|
12901
12901
|
className: "close",
|
|
12902
12902
|
onClick: () => onDeleteItem(item, index)
|
|
12903
|
-
}
|
|
12903
|
+
},
|
|
12904
|
+
deleteIcon
|
|
12904
12905
|
),
|
|
12905
12906
|
previewType === "picture" && !children && /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-img" }, item.status === "ready" ? /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress" }, /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)) : item.status !== "success" && /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress" }, renderIcon(item), /* @__PURE__ */ React.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)), ((_a = item.type) == null ? void 0 : _a.includes("image")) ? /* @__PURE__ */ React.createElement(React.Fragment, null, item.url && /* @__PURE__ */ React.createElement(
|
|
12906
12907
|
components.Image,
|
|
@@ -12963,6 +12964,7 @@
|
|
|
12963
12964
|
mediaType: ["image", "video"],
|
|
12964
12965
|
camera: "back",
|
|
12965
12966
|
uploadIcon: /* @__PURE__ */ React.createElement(y, { size: "20px", color: "#808080" }),
|
|
12967
|
+
deleteIcon: /* @__PURE__ */ React.createElement(u$1, { color: "rgba(0,0,0,0.6)" }),
|
|
12966
12968
|
uploadLabel: "",
|
|
12967
12969
|
previewType: "picture",
|
|
12968
12970
|
fit: "cover",
|
|
@@ -12990,6 +12992,7 @@
|
|
|
12990
12992
|
const {
|
|
12991
12993
|
children,
|
|
12992
12994
|
uploadIcon,
|
|
12995
|
+
deleteIcon,
|
|
12993
12996
|
uploadLabel,
|
|
12994
12997
|
accept,
|
|
12995
12998
|
name,
|
|
@@ -13316,6 +13319,7 @@
|
|
|
13316
13319
|
onDeleteItem,
|
|
13317
13320
|
handleItemClick,
|
|
13318
13321
|
previewUrl,
|
|
13322
|
+
deleteIcon,
|
|
13319
13323
|
children
|
|
13320
13324
|
}
|
|
13321
13325
|
}
|
|
@@ -18371,6 +18375,7 @@
|
|
|
18371
18375
|
const barrageContainer = React.useRef(null);
|
|
18372
18376
|
const barrageCWidth = React.useRef(0);
|
|
18373
18377
|
const timer = React.useRef(0);
|
|
18378
|
+
const domTimer = React.useRef(0);
|
|
18374
18379
|
const index = React.useRef(0);
|
|
18375
18380
|
const times = React.useRef([]);
|
|
18376
18381
|
const historyIndex = React.useRef(-1);
|
|
@@ -18392,28 +18397,34 @@
|
|
|
18392
18397
|
}
|
|
18393
18398
|
return 0;
|
|
18394
18399
|
};
|
|
18400
|
+
const clearDomTimeout = () => {
|
|
18401
|
+
if (domTimer.current) {
|
|
18402
|
+
clearTimeout(domTimer.current);
|
|
18403
|
+
domTimer.current = 0;
|
|
18404
|
+
}
|
|
18405
|
+
};
|
|
18395
18406
|
React.useEffect(() => {
|
|
18396
18407
|
const init = async () => {
|
|
18408
|
+
var _a;
|
|
18397
18409
|
if (barrageBody.current) {
|
|
18398
18410
|
barrageCWidth.current = await getNodeWidth(barrageBody.current);
|
|
18411
|
+
(_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
|
|
18412
|
+
"--move-distance",
|
|
18413
|
+
`-${barrageCWidth.current}px`
|
|
18414
|
+
);
|
|
18415
|
+
index.current = 0;
|
|
18416
|
+
run();
|
|
18399
18417
|
}
|
|
18400
18418
|
};
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
var _a;
|
|
18404
|
-
(_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
|
|
18405
|
-
"--move-distance",
|
|
18406
|
-
`-${barrageCWidth.current}px`
|
|
18407
|
-
);
|
|
18408
|
-
index.current = 0;
|
|
18409
|
-
run();
|
|
18419
|
+
domTimer.current = window.setTimeout(() => {
|
|
18420
|
+
init();
|
|
18410
18421
|
}, 300);
|
|
18411
18422
|
return () => {
|
|
18412
|
-
|
|
18423
|
+
clearDomTimeout();
|
|
18413
18424
|
};
|
|
18414
18425
|
}, [list]);
|
|
18415
18426
|
const run = () => {
|
|
18416
|
-
|
|
18427
|
+
clearTimeout(timer.current);
|
|
18417
18428
|
let intervalCache = interval;
|
|
18418
18429
|
const _index = (loop ? index.current % list.length : index.current) % rows;
|
|
18419
18430
|
const result = times.current[_index] - rows * interval;
|
|
@@ -18424,7 +18435,30 @@
|
|
|
18424
18435
|
play();
|
|
18425
18436
|
}, intervalCache);
|
|
18426
18437
|
};
|
|
18427
|
-
const
|
|
18438
|
+
const setStyle = async (el, currentIndex) => {
|
|
18439
|
+
try {
|
|
18440
|
+
if (el) {
|
|
18441
|
+
const refe = await getRectByTaro(el);
|
|
18442
|
+
const width = refe.width;
|
|
18443
|
+
const height = refe.height;
|
|
18444
|
+
el.classList.add("move");
|
|
18445
|
+
const elScrollDuration = Math.round(
|
|
18446
|
+
width / barrageCWidth.current * duration
|
|
18447
|
+
);
|
|
18448
|
+
times.current[currentIndex] = elScrollDuration;
|
|
18449
|
+
el.style.animationDuration = `${duration + elScrollDuration}ms`;
|
|
18450
|
+
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
18451
|
+
el.style.width = `${width}px`;
|
|
18452
|
+
}
|
|
18453
|
+
} catch (error) {
|
|
18454
|
+
console.log("异常自动流转到下一个", error);
|
|
18455
|
+
barrageContainer.current.removeChild(el);
|
|
18456
|
+
}
|
|
18457
|
+
el.addEventListener("animationend", () => {
|
|
18458
|
+
barrageContainer.current.removeChild(el);
|
|
18459
|
+
});
|
|
18460
|
+
};
|
|
18461
|
+
const play = () => {
|
|
18428
18462
|
if (!loop && index.current >= list.length) {
|
|
18429
18463
|
return;
|
|
18430
18464
|
}
|
|
@@ -18436,25 +18470,9 @@
|
|
|
18436
18470
|
}
|
|
18437
18471
|
historyIndex.current = currentIndex;
|
|
18438
18472
|
el.innerHTML = list[_index];
|
|
18439
|
-
el.classList.add("barrage-item");
|
|
18440
18473
|
barrageContainer.current.appendChild(el);
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
const height = await getNodeWidth(el, "height");
|
|
18444
|
-
el.classList.add("move");
|
|
18445
|
-
const elScrollDuration = width / barrageCWidth.current * duration;
|
|
18446
|
-
times.current[currentIndex] = Math.ceil(elScrollDuration);
|
|
18447
|
-
el.style.animationDuration = `${(duration + elScrollDuration).toFixed(
|
|
18448
|
-
2
|
|
18449
|
-
)}ms`;
|
|
18450
|
-
el.style.top = `${currentIndex * (height + gapY) + 20}px`;
|
|
18451
|
-
el.style.width = `${width}px`;
|
|
18452
|
-
} catch (error) {
|
|
18453
|
-
console.log("异常自动流转到下一个");
|
|
18454
|
-
}
|
|
18455
|
-
el.addEventListener("animationend", () => {
|
|
18456
|
-
barrageContainer.current.removeChild(el);
|
|
18457
|
-
});
|
|
18474
|
+
el.classList.add("barrage-item");
|
|
18475
|
+
requestAnimationFrame(() => setStyle(el, currentIndex));
|
|
18458
18476
|
index.current++;
|
|
18459
18477
|
run();
|
|
18460
18478
|
};
|
|
@@ -11,6 +11,7 @@ export interface UploaderProps extends BasicComponent {
|
|
|
11
11
|
previewType: 'picture' | 'list';
|
|
12
12
|
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
13
13
|
uploadIcon?: React.ReactNode;
|
|
14
|
+
deleteIcon?: React.ReactNode;
|
|
14
15
|
uploadLabel?: React.ReactNode;
|
|
15
16
|
name: string;
|
|
16
17
|
accept: string;
|