@nutui/nutui-react-taro 2.0.0-alpha.11 → 2.0.0-alpha.13
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 +28 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +1 -3
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/AnimatingNumbers/style/style.css +1 -1
- package/dist/esm/AnimatingNumbers.js +99 -5
- package/dist/esm/AvatarGroup.js +1 -1
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/CountDown/style/style.css +1 -1
- package/dist/esm/CountDown.js +2 -3
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/Ellipsis/style/style.css +1 -1
- package/dist/esm/Ellipsis.js +1 -1
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/NumberKeyboard/style/style.css +1 -1
- package/dist/esm/Picker/style/style.css +1 -1
- package/dist/esm/Popup/style/style.css +1 -1
- package/dist/esm/SearchBar/style/style.css +1 -1
- package/dist/esm/SearchBar.js +1 -4
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/ShortPassword.js +3 -4
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/Toast/style/style.css +1 -1
- package/dist/esm/Toast.js +2 -3
- package/dist/esm/TrendArrow/style/style.css +1 -1
- package/dist/esm/TrendArrow.js +2 -3
- package/dist/esm/Video.js +3 -3
- package/dist/esm/VirtualList/style/style.css +1 -1
- package/dist/esm/VirtualList.js +2 -2
- package/dist/esm/WaterMark.js +2 -3
- package/dist/esm/actionsheet.taro-697a594b.js +54 -0
- package/dist/esm/{countdown.taro-22200811.js → countdown.taro-c399cc08.js} +17 -10
- package/dist/esm/{ellipsis.taro-02765890.js → ellipsis.taro-f423affa.js} +13 -6
- package/dist/esm/nutui-react.es.js +18 -18
- package/dist/esm/searchbar.taro-09468fff.js +122 -0
- package/dist/esm/shortpassword.taro-eabbde1b.js +90 -0
- package/dist/esm/toast.taro-b2937e7c.js +171 -0
- package/dist/esm/trendarrow.taro-253025d2.js +70 -0
- package/dist/esm/types/src/packages/actionsheet/actionsheet.d.ts +11 -15
- package/dist/esm/types/src/packages/actionsheet/actionsheet.taro.d.ts +11 -15
- package/dist/esm/types/src/packages/actionsheet/index.d.ts +1 -0
- package/dist/esm/types/src/packages/actionsheet/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/animatingnumbers/countup.d.ts +7 -8
- package/dist/esm/types/src/packages/animatingnumbers/countup.taro.d.ts +7 -8
- package/dist/esm/types/src/packages/animatingnumbers/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/animatingnumbers/demo.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/animatingnumbers/index.d.ts +1 -0
- package/dist/esm/types/src/packages/animatingnumbers/index.taro.d.ts +1 -0
- package/dist/{types/packages/avatargroup/avatargroup.d.ts → esm/types/src/packages/avatargroup/avatargroup.taro.d.ts} +1 -1
- package/dist/esm/types/src/packages/avatargroup/index.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/configprovider/configprovider.d.ts +2 -1
- package/dist/esm/types/src/packages/configprovider/configprovider.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/configprovider/index.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -0
- package/dist/esm/types/src/packages/countdown/countdown.d.ts +5 -4
- package/dist/esm/types/src/packages/countdown/countdown.taro.d.ts +5 -4
- package/dist/esm/types/src/packages/countdown/index.d.ts +1 -0
- package/dist/esm/types/src/packages/countdown/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/ellipsis/ellipsis.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/index.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +4 -31
- package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +4 -31
- package/dist/esm/types/src/packages/shortpassword/index.d.ts +1 -0
- package/dist/esm/types/src/packages/shortpassword/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +17 -20
- package/dist/esm/types/src/packages/shortpassword/shortpassword.taro.d.ts +17 -20
- package/dist/esm/types/src/packages/toast/Notification.d.ts +9 -13
- package/dist/esm/types/src/packages/toast/index.d.ts +1 -0
- package/dist/esm/types/src/packages/toast/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/toast/toast.d.ts +19 -26
- package/dist/esm/types/src/packages/toast/toast.taro.d.ts +9 -11
- package/dist/esm/types/src/packages/trendarrow/trendarrow.d.ts +8 -10
- package/dist/esm/types/src/packages/trendarrow/trendarrow.taro.d.ts +8 -10
- package/dist/esm/types/src/packages/video/index.d.ts +1 -0
- package/dist/esm/types/src/packages/video/index.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/video/video.d.ts +5 -9
- package/dist/esm/types/src/packages/video/video.taro.d.ts +6 -9
- package/dist/esm/types/src/packages/virtuallist/index.d.ts +1 -0
- package/dist/esm/types/src/packages/virtuallist/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/virtuallist/type.d.ts +0 -18
- package/dist/esm/types/src/packages/virtuallist/utils.d.ts +3 -3
- package/dist/esm/types/src/packages/virtuallist/virtuallist.d.ts +15 -4
- package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +13 -14
- package/dist/esm/types/src/packages/watermark/demo.d.ts +0 -1
- package/dist/esm/types/src/packages/watermark/demo.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/watermark/index.d.ts +1 -0
- package/dist/esm/types/src/packages/watermark/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/watermark/watermark.d.ts +3 -4
- package/dist/esm/types/src/packages/watermark/watermark.taro.d.ts +3 -4
- package/dist/esm/video.taro-2a26d7da.js +37 -0
- package/dist/esm/{virtuallist.taro-99f03769.js → virtuallist.taro-97d3403a.js} +27 -30
- package/dist/esm/{watermark.taro-cef29c03.js → watermark.taro-e2245bb1.js} +12 -13
- 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 +10 -2
- 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 +495 -548
- package/dist/nutui.react.umd.js +495 -548
- package/dist/packages/actionsheet/actionsheet.scss +26 -73
- package/dist/packages/animatingnumbers/countup.scss +0 -21
- package/dist/packages/countdown/countdown.scss +2 -0
- package/dist/packages/ellipsis/ellipsis.scss +4 -0
- package/dist/packages/popup/popup.scss +98 -47
- package/dist/packages/searchbar/searchbar.scss +13 -71
- package/dist/packages/shortpassword/shortpassword.scss +1 -88
- package/dist/packages/toast/toast.scss +20 -7
- package/dist/packages/trendarrow/trendarrow.scss +4 -3
- package/dist/packages/virtuallist/virtuallist.scss +0 -12
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +58 -68
- package/dist/styles/variables.scss +32 -61
- package/dist/types/packages/actionsheet/actionsheet.taro.d.ts +44 -16
- package/dist/types/packages/actionsheet/index.taro.d.ts +1 -0
- package/dist/types/packages/animate/animate.taro.d.ts +20 -4
- package/dist/types/packages/animatingnumbers/countup.taro.d.ts +7 -8
- package/dist/types/packages/animatingnumbers/index.taro.d.ts +1 -0
- package/dist/types/packages/audio/audio.taro.d.ts +25 -5
- package/dist/types/packages/avatar/avatar.taro.d.ts +45 -9
- package/dist/types/packages/avatargroup/avatargroup.taro.d.ts +45 -0
- package/dist/types/packages/avatargroup/index.taro.d.ts +1 -1
- package/dist/types/packages/backtop/backtop.taro.d.ts +20 -4
- package/dist/types/packages/badge/badge.taro.d.ts +30 -6
- package/dist/types/packages/button/button.taro.d.ts +50 -10
- package/dist/types/packages/cascader/cascader.taro.d.ts +80 -16
- package/dist/types/packages/cell/cell.taro.d.ts +30 -6
- package/dist/types/packages/cellgroup/cellgroup.taro.d.ts +15 -3
- package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +40 -8
- package/dist/types/packages/circleprogress/circleprogress.taro.d.ts +35 -7
- package/dist/types/packages/col/col.taro.d.ts +15 -3
- package/dist/types/packages/collapse/collapse.taro.d.ts +25 -5
- package/dist/types/packages/collapseitem/collapseitem.taro.d.ts +20 -4
- package/dist/types/packages/configprovider/configprovider.d.ts +2 -1
- package/dist/types/packages/configprovider/configprovider.taro.d.ts +11 -2
- package/dist/types/packages/configprovider/index.d.ts +1 -0
- package/dist/types/packages/configprovider/index.taro.d.ts +1 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -0
- package/dist/types/packages/countdown/countdown.taro.d.ts +68 -15
- package/dist/types/packages/countdown/index.taro.d.ts +1 -0
- package/dist/types/packages/divider/divider.taro.d.ts +10 -2
- package/dist/types/packages/drag/drag.taro.d.ts +15 -3
- package/dist/types/packages/elevator/elevator.taro.d.ts +45 -9
- package/dist/types/packages/ellipsis/ellipsis.taro.d.ts +46 -9
- package/dist/types/packages/empty/empty.taro.d.ts +20 -4
- package/dist/types/packages/fixednav/fixednav.taro.d.ts +50 -10
- package/dist/types/packages/grid/grid.taro.d.ts +35 -7
- package/dist/types/packages/griditem/griditem.taro.d.ts +5 -1
- package/dist/types/packages/imagepreview/imagepreview.taro.d.ts +50 -10
- package/dist/types/packages/indicator/indicator.taro.d.ts +15 -3
- package/dist/types/packages/input/input.taro.d.ts +100 -20
- package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +85 -17
- package/dist/types/packages/menu/menu.taro.d.ts +20 -4
- package/dist/types/packages/menuitem/menuitem.taro.d.ts +35 -7
- package/dist/types/packages/noticebar/noticebar.taro.d.ts +60 -12
- package/dist/types/packages/notify/notify.taro.d.ts +30 -6
- package/dist/types/packages/numberkeyboard/numberkeyboard.taro.d.ts +50 -10
- package/dist/types/packages/overlay/index.d.ts +3 -0
- package/dist/types/packages/overlay/overlay.d.ts +14 -0
- package/dist/types/packages/overlay/overlay.taro.d.ts +40 -8
- package/dist/types/packages/pagination/pagination.taro.d.ts +55 -11
- package/dist/types/packages/picker/picker.taro.d.ts +55 -11
- package/dist/types/packages/popup/popup.taro.d.ts +75 -15
- package/dist/types/packages/price/price.taro.d.ts +35 -7
- package/dist/types/packages/progress/progress.taro.d.ts +35 -7
- package/dist/types/packages/pulltorefresh/pulltorefresh.taro.d.ts +55 -11
- package/dist/types/packages/radio/radio.taro.d.ts +45 -9
- package/dist/types/packages/radiogroup/radiogroup.taro.d.ts +30 -6
- package/dist/types/packages/range/range.taro.d.ts +80 -16
- package/dist/types/packages/searchbar/index.taro.d.ts +1 -0
- package/dist/types/packages/searchbar/searchbar.taro.d.ts +72 -44
- package/dist/types/packages/shortpassword/index.taro.d.ts +1 -0
- package/dist/types/packages/shortpassword/shortpassword.taro.d.ts +89 -24
- package/dist/types/packages/skeleton/skeleton.taro.d.ts +35 -7
- package/dist/types/packages/step/step.taro.d.ts +20 -4
- package/dist/types/packages/steps/steps.taro.d.ts +15 -3
- package/dist/types/packages/sticky/sticky.taro.d.ts +25 -5
- package/dist/types/packages/swipe/swipe.taro.d.ts +47 -11
- package/dist/types/packages/swiper/swiper.taro.d.ts +35 -7
- package/dist/types/packages/switch/switch.taro.d.ts +30 -6
- package/dist/types/packages/tabbar/tabbar.taro.d.ts +35 -7
- package/dist/types/packages/tabbaritem/tabbaritem.taro.d.ts +10 -2
- package/dist/types/packages/tabpane/tabpane.taro.d.ts +15 -3
- package/dist/types/packages/tabs/tabs.taro.d.ts +60 -12
- package/dist/types/packages/textarea/textarea.taro.d.ts +60 -12
- package/dist/types/packages/toast/index.taro.d.ts +1 -0
- package/dist/types/packages/toast/toast.taro.d.ts +9 -11
- package/dist/types/packages/trendarrow/trendarrow.taro.d.ts +57 -15
- package/dist/types/packages/uploader/uploader.taro.d.ts +165 -33
- package/dist/types/packages/video/index.taro.d.ts +2 -1
- package/dist/types/packages/video/video.taro.d.ts +41 -0
- package/dist/types/packages/virtuallist/index.taro.d.ts +1 -0
- package/dist/types/packages/virtuallist/type.d.ts +0 -17
- package/dist/types/packages/virtuallist/utils.d.ts +3 -3
- package/dist/types/packages/virtuallist/virtuallist.taro.d.ts +45 -14
- package/dist/types/packages/watermark/index.taro.d.ts +1 -0
- package/dist/types/packages/watermark/watermark.taro.d.ts +72 -17
- package/package.json +1 -1
- package/dist/esm/actionsheet.taro-d2217152.js +0 -61
- package/dist/esm/animatingnumbers.taro-c2a52dbd.js +0 -103
- package/dist/esm/searchbar.taro-37ade36e.js +0 -159
- package/dist/esm/shortpassword.taro-f7292032.js +0 -146
- package/dist/esm/toast.taro-92c10e1d.js +0 -114
- package/dist/esm/trendarrow.taro-0cf43935.js +0 -72
- package/dist/esm/video-5d106e33.js +0 -73
- package/dist/types/packages/video/video.d.ts +0 -24
- /package/dist/esm/{avatargroup-ad5ffb46.js → avatargroup.taro-ad5ffb46.js} +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import React, { useRef, useState, useEffect, Component } from "react";
|
|
8
|
-
import { createSelectorQuery } from "@tarojs/taro";
|
|
9
|
-
import { c as cn } from "./bem-cdccae08.js";
|
|
10
|
-
const defaultProps$1 = {
|
|
11
|
-
maxLen: 0,
|
|
12
|
-
endNumber: "",
|
|
13
|
-
delaySpeed: 300,
|
|
14
|
-
easeSpeed: 1,
|
|
15
|
-
thousands: false,
|
|
16
|
-
className: ""
|
|
17
|
-
};
|
|
18
|
-
const CountUp = (props) => {
|
|
19
|
-
const { maxLen, endNumber, delaySpeed, easeSpeed, className, thousands, ...reset } = {
|
|
20
|
-
...defaultProps$1,
|
|
21
|
-
...props
|
|
22
|
-
};
|
|
23
|
-
const b = cn("countup");
|
|
24
|
-
const countupRef = useRef(null);
|
|
25
|
-
const timerRef = useRef(0);
|
|
26
|
-
const numbers = Array.from({ length: 10 }, (v, i) => i);
|
|
27
|
-
const getShowNumber = () => {
|
|
28
|
-
const splitArr = endNumber.split(".");
|
|
29
|
-
const intNumber = maxLen && splitArr[0].length < maxLen ? (Array(maxLen).join("0") + splitArr[0]).slice(-maxLen) : splitArr[0];
|
|
30
|
-
const currNumber = `${thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : intNumber}${splitArr[1] ? "." : ""}${splitArr[1] || ""}`;
|
|
31
|
-
return currNumber.split("");
|
|
32
|
-
};
|
|
33
|
-
const [numerArr, setNumerArr] = useState([]);
|
|
34
|
-
const [transformArr, setTransformArr] = useState([]);
|
|
35
|
-
const isLoaded = useRef(false);
|
|
36
|
-
const setNumberTransform = () => {
|
|
37
|
-
if (countupRef.current && numerArr.length) {
|
|
38
|
-
createSelectorQuery().selectAll(".nut-countup__listitem").node((numberItems) => {
|
|
39
|
-
const transformArrCache = [];
|
|
40
|
-
Object.keys(numberItems).forEach((key) => {
|
|
41
|
-
const elem = numberItems[Number(key)];
|
|
42
|
-
const idx = Number(numerArr[Number(key)]);
|
|
43
|
-
if (elem) {
|
|
44
|
-
const transform = idx || idx === 0 ? `translate(0, -${(idx === 0 ? 10 : idx) * 5}%)` : "";
|
|
45
|
-
transformArrCache.push(transform);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
setTransformArr([...transformArrCache]);
|
|
49
|
-
}).exec();
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const numberEaseStyle = (idx) => {
|
|
53
|
-
return {
|
|
54
|
-
transition: `transform ${easeSpeed}s ease-in-out`,
|
|
55
|
-
transform: transformArr[idx] ? transformArr[idx] : null
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setNumberTransform();
|
|
60
|
-
}, [numerArr]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (!isLoaded.current) {
|
|
63
|
-
isLoaded.current = true;
|
|
64
|
-
timerRef.current = window.setTimeout(() => {
|
|
65
|
-
setNumerArr(getShowNumber());
|
|
66
|
-
}, delaySpeed);
|
|
67
|
-
} else {
|
|
68
|
-
setNumerArr(getShowNumber());
|
|
69
|
-
}
|
|
70
|
-
return () => {
|
|
71
|
-
window.clearTimeout(timerRef.current);
|
|
72
|
-
};
|
|
73
|
-
}, [endNumber]);
|
|
74
|
-
return React.createElement(
|
|
75
|
-
"div",
|
|
76
|
-
{ className: `${b()} ${className}`, ref: countupRef },
|
|
77
|
-
React.createElement("ul", { className: b("list") }, numerArr.map((item, idx) => {
|
|
78
|
-
return React.createElement("li", { className: `${b("listitem", {
|
|
79
|
-
number: !Number.isNaN(Number(item))
|
|
80
|
-
})}`, key: idx }, !Number.isNaN(Number(item)) ? React.createElement("span", { className: b("number"), style: numberEaseStyle(idx) }, [...numbers, ...numbers].map((number, subidx) => {
|
|
81
|
-
return React.createElement("span", { key: subidx }, number);
|
|
82
|
-
})) : React.createElement("span", { className: b("separator") }, item));
|
|
83
|
-
}))
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
CountUp.defaultProps = defaultProps$1;
|
|
87
|
-
CountUp.displayName = "NutCountUp";
|
|
88
|
-
const defaultProps = {};
|
|
89
|
-
class AnimatingNumbers extends Component {
|
|
90
|
-
constructor(props) {
|
|
91
|
-
super(props);
|
|
92
|
-
this.state = {};
|
|
93
|
-
}
|
|
94
|
-
render() {
|
|
95
|
-
return React.createElement("div", { className: "nut-animatingnumbers" });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
__publicField(AnimatingNumbers, "defaultProps", defaultProps);
|
|
99
|
-
__publicField(AnimatingNumbers, "displayName", "NutAnimatingNumbers");
|
|
100
|
-
__publicField(AnimatingNumbers, "CountUp", CountUp);
|
|
101
|
-
export {
|
|
102
|
-
AnimatingNumbers as A
|
|
103
|
-
};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
-
import { getEnv } from "@tarojs/taro";
|
|
3
|
-
import { Search, CircleClose } from "@nutui/icons-react-taro";
|
|
4
|
-
import { c as cn } from "./bem-cdccae08.js";
|
|
5
|
-
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
6
|
-
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
...ComponentDefaults,
|
|
9
|
-
placeholder: "",
|
|
10
|
-
shape: "square",
|
|
11
|
-
disabled: false,
|
|
12
|
-
maxLength: 9999,
|
|
13
|
-
clearable: true,
|
|
14
|
-
clearSize: "12px",
|
|
15
|
-
align: "left",
|
|
16
|
-
readonly: true,
|
|
17
|
-
autoFocus: false,
|
|
18
|
-
label: "",
|
|
19
|
-
leftinIcon: React.createElement(Search, { size: "12" })
|
|
20
|
-
};
|
|
21
|
-
const SearchBar = (props) => {
|
|
22
|
-
const searchbarBem = cn("searchbar");
|
|
23
|
-
const { locale } = useConfig();
|
|
24
|
-
const searchRef = useRef(null);
|
|
25
|
-
const [value, setValue] = useState(() => props.value);
|
|
26
|
-
const { placeholder, shape, className, disabled, maxLength, clearable, clearSize, align, readOnly, autoFocus, label, actionText, leftinIcon, rightinIcon, leftoutIcon, rightoutIcon, onChange, onFocus, onBlur, onClear, onCancel, onSearch, onClickInput, onClickLeftinIcon, onClickLeftoutIcon, onClickRightinIcon, onClickRightoutIcon } = {
|
|
27
|
-
...defaultProps,
|
|
28
|
-
...props
|
|
29
|
-
};
|
|
30
|
-
const alignClass = `${align}`;
|
|
31
|
-
const forceFocus = () => {
|
|
32
|
-
const searchSelf = searchRef.current;
|
|
33
|
-
searchSelf && searchSelf.focus();
|
|
34
|
-
};
|
|
35
|
-
const change = (event) => {
|
|
36
|
-
const { value: value2 } = event.target;
|
|
37
|
-
onChange && (onChange == null ? void 0 : onChange(value2, event));
|
|
38
|
-
setValue(value2);
|
|
39
|
-
value2 === "" && forceFocus();
|
|
40
|
-
};
|
|
41
|
-
const focus = (event) => {
|
|
42
|
-
const { value: value2 } = event.target;
|
|
43
|
-
onFocus && (onFocus == null ? void 0 : onFocus(value2, event));
|
|
44
|
-
};
|
|
45
|
-
const blur = (event) => {
|
|
46
|
-
const searchSelf = searchRef.current;
|
|
47
|
-
searchSelf && searchSelf.blur();
|
|
48
|
-
const { value: value2 } = event.target;
|
|
49
|
-
onBlur && (onBlur == null ? void 0 : onBlur(value2, event));
|
|
50
|
-
};
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
setValue(props.value);
|
|
53
|
-
}, [props.value]);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
autoFocus && forceFocus();
|
|
56
|
-
}, [autoFocus]);
|
|
57
|
-
const renderField = () => {
|
|
58
|
-
return React.createElement("input", { className: `${searchbarBem("input")} ${searchbarBem(alignClass)} ${shape === "round" ? searchbarBem("round") : ""} ${clearable ? searchbarBem("input-clear") : ""}`, ref: searchRef, style: { ...props.style }, value: value || "", placeholder: placeholder || locale.placeholder, disabled, readOnly, maxLength, onKeyPress: onKeypress, onChange: (e) => change(e), onFocus: (e) => focus(e), onBlur: (e) => blur(e), onClick: (e) => clickInput(e) });
|
|
59
|
-
};
|
|
60
|
-
const clickInput = (e) => {
|
|
61
|
-
onClickInput && onClickInput(e);
|
|
62
|
-
};
|
|
63
|
-
const renderLeftinIcon = () => {
|
|
64
|
-
if (!leftinIcon)
|
|
65
|
-
return null;
|
|
66
|
-
return React.createElement("div", { className: `${searchbarBem("leftin-icon")} ${searchbarBem("icon")}`, onClick: (e) => clickLeftIcon("in-left", e) }, leftinIcon);
|
|
67
|
-
};
|
|
68
|
-
const renderLeftoutIcon = () => {
|
|
69
|
-
if (!leftoutIcon)
|
|
70
|
-
return null;
|
|
71
|
-
return React.createElement("div", { className: `${searchbarBem("leftout-icon")}`, onClick: (e) => clickLeftIcon("out-left", e) }, leftoutIcon);
|
|
72
|
-
};
|
|
73
|
-
const clickLeftIcon = (flag, event) => {
|
|
74
|
-
if (flag === "in-left") {
|
|
75
|
-
onClickLeftinIcon && onClickLeftinIcon(value, event);
|
|
76
|
-
} else {
|
|
77
|
-
onClickLeftoutIcon && onClickLeftoutIcon(value, event);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const renderRightinIcon = () => {
|
|
81
|
-
if (!rightinIcon)
|
|
82
|
-
return null;
|
|
83
|
-
return React.createElement("div", { className: `${searchbarBem("rightin-icon")} ${searchbarBem("icon")}`, onClick: (e) => clickRightIcon("in-right", e) }, rightinIcon);
|
|
84
|
-
};
|
|
85
|
-
const renderRightoutIcon = () => {
|
|
86
|
-
if (!rightoutIcon)
|
|
87
|
-
return null;
|
|
88
|
-
return React.createElement("div", { className: `${searchbarBem("rightout-icon")}`, onClick: (e) => clickRightIcon("out-right", e) }, rightoutIcon);
|
|
89
|
-
};
|
|
90
|
-
const clickRightIcon = (flag, event) => {
|
|
91
|
-
if (flag === "in-left") {
|
|
92
|
-
onClickRightinIcon && onClickRightinIcon(value, event);
|
|
93
|
-
} else {
|
|
94
|
-
onClickRightoutIcon && onClickRightoutIcon(value, event);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const handleClear = () => {
|
|
98
|
-
return React.createElement(
|
|
99
|
-
"div",
|
|
100
|
-
{ className: `${searchbarBem("clear")} ${rightinIcon ? "pos-right" : ""}`, onClick: (e) => clearaVal(e) },
|
|
101
|
-
React.createElement(CircleClose, { size: clearSize, color: "#555" })
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
const clearaVal = (event) => {
|
|
105
|
-
if (disabled || readOnly) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
setValue("");
|
|
109
|
-
onClear && onClear(event);
|
|
110
|
-
forceFocus();
|
|
111
|
-
};
|
|
112
|
-
const renderRightLabel = () => {
|
|
113
|
-
if (actionText) {
|
|
114
|
-
return React.createElement("div", { className: searchbarBem("action-text"), onClick: search }, actionText);
|
|
115
|
-
}
|
|
116
|
-
return null;
|
|
117
|
-
};
|
|
118
|
-
const onKeypress = (e) => {
|
|
119
|
-
if (e.keyCode === 13) {
|
|
120
|
-
if (typeof e.cancelable !== "boolean" || e.cancelable) {
|
|
121
|
-
e.preventDefault();
|
|
122
|
-
}
|
|
123
|
-
onSearch && onSearch(value);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
const search = () => {
|
|
127
|
-
onSearch && onSearch(value);
|
|
128
|
-
};
|
|
129
|
-
const renderLabel = () => {
|
|
130
|
-
if (label) {
|
|
131
|
-
return React.createElement("div", { className: searchbarBem("label") }, label);
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
};
|
|
135
|
-
const envClass = () => {
|
|
136
|
-
return getEnv() === "WEB" ? "nut-searchbar-taro" : "";
|
|
137
|
-
};
|
|
138
|
-
return React.createElement(
|
|
139
|
-
"div",
|
|
140
|
-
{ className: `${searchbarBem()} ${envClass()} ${disabled ? searchbarBem("disabled") : ""} ${className || ""}`, style: { ...props.style, background: props.background } },
|
|
141
|
-
renderLeftoutIcon(),
|
|
142
|
-
renderLabel(),
|
|
143
|
-
React.createElement(
|
|
144
|
-
"div",
|
|
145
|
-
{ className: `${searchbarBem("content")}`, style: { background: props.inputBackground } },
|
|
146
|
-
renderLeftinIcon(),
|
|
147
|
-
React.createElement("div", { className: "nut-searchbar__input-box" }, renderField()),
|
|
148
|
-
renderRightinIcon(),
|
|
149
|
-
clearable && value && handleClear()
|
|
150
|
-
),
|
|
151
|
-
renderRightoutIcon(),
|
|
152
|
-
renderRightLabel()
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
SearchBar.defaultProps = defaultProps;
|
|
156
|
-
SearchBar.displayName = "NutSearchBar";
|
|
157
|
-
export {
|
|
158
|
-
SearchBar as S
|
|
159
|
-
};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
-
import { Tips } from "@nutui/icons-react-taro";
|
|
3
|
-
import { c as cn } from "./bem-cdccae08.js";
|
|
4
|
-
import { P as Popup } from "./popup.taro-e756f3fc.js";
|
|
5
|
-
import { u as useConfig } from "./configprovider.taro-25758d9f.js";
|
|
6
|
-
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
...ComponentDefaults,
|
|
9
|
-
title: "",
|
|
10
|
-
description: "",
|
|
11
|
-
tips: "",
|
|
12
|
-
tipsIcon: null,
|
|
13
|
-
iconSize: 11,
|
|
14
|
-
visible: false,
|
|
15
|
-
modelValue: "",
|
|
16
|
-
errorMsg: "",
|
|
17
|
-
noButton: true,
|
|
18
|
-
closeOnClickOverlay: true,
|
|
19
|
-
length: 6,
|
|
20
|
-
className: "",
|
|
21
|
-
autoFocus: false,
|
|
22
|
-
onChange: (value) => {
|
|
23
|
-
},
|
|
24
|
-
onOk: (value) => {
|
|
25
|
-
},
|
|
26
|
-
onCancel: () => {
|
|
27
|
-
},
|
|
28
|
-
onClose: () => {
|
|
29
|
-
},
|
|
30
|
-
onTips: () => {
|
|
31
|
-
},
|
|
32
|
-
onComplete: (value) => {
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const ShortPassword = (props) => {
|
|
36
|
-
const { locale } = useConfig();
|
|
37
|
-
const { title, description, tips, tipsIcon, iconSize, visible, modelValue, errorMsg, noButton, closeOnClickOverlay, length, style, className, onChange, onOk, onTips, onCancel, onClose, onComplete, autoFocus, ...reset } = props;
|
|
38
|
-
const b = cn("shortpassword");
|
|
39
|
-
const textInput = useRef(null);
|
|
40
|
-
const range = (val) => {
|
|
41
|
-
return Math.min(Math.max(4, val), 6);
|
|
42
|
-
};
|
|
43
|
-
const [innerVisible, setInnerVisible] = useState(visible);
|
|
44
|
-
const [comLen, setComLen] = useState(range(Number(length)));
|
|
45
|
-
const [inputValue, setInputValue] = useState("");
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
setInnerVisible(visible);
|
|
48
|
-
}, [visible]);
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (typeof modelValue !== "undefined") {
|
|
51
|
-
setInputValue(modelValue);
|
|
52
|
-
}
|
|
53
|
-
}, [modelValue]);
|
|
54
|
-
const changeValue = (e) => {
|
|
55
|
-
let inputValue2 = e.target.value;
|
|
56
|
-
if (String(inputValue2).length > comLen) {
|
|
57
|
-
inputValue2 = inputValue2.slice(0, comLen);
|
|
58
|
-
}
|
|
59
|
-
setInputValue(inputValue2);
|
|
60
|
-
if (String(inputValue2).length === comLen) {
|
|
61
|
-
onComplete && onComplete(inputValue2);
|
|
62
|
-
}
|
|
63
|
-
onChange && onChange(inputValue2);
|
|
64
|
-
};
|
|
65
|
-
const systemStyle = () => {
|
|
66
|
-
const u = navigator.userAgent;
|
|
67
|
-
const isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
|
|
68
|
-
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
|
69
|
-
let style2 = {};
|
|
70
|
-
if (isIOS) {
|
|
71
|
-
style2 = {
|
|
72
|
-
paddingRight: "1200px"
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
if (isAndroid) {
|
|
76
|
-
style2 = {
|
|
77
|
-
opacity: 0,
|
|
78
|
-
zIndex: 10
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return style2;
|
|
82
|
-
};
|
|
83
|
-
const focus = () => {
|
|
84
|
-
if (textInput.current) {
|
|
85
|
-
textInput.current.focus();
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const sure = () => {
|
|
89
|
-
onOk && onOk(inputValue);
|
|
90
|
-
};
|
|
91
|
-
const renderIcon = (size = "11px") => {
|
|
92
|
-
return React.isValidElement(tipsIcon) ? React.cloneElement(tipsIcon, {
|
|
93
|
-
...tipsIcon.props,
|
|
94
|
-
size
|
|
95
|
-
}) : React.createElement(Tips, { size });
|
|
96
|
-
};
|
|
97
|
-
return React.createElement(
|
|
98
|
-
"div",
|
|
99
|
-
null,
|
|
100
|
-
React.createElement(
|
|
101
|
-
Popup,
|
|
102
|
-
{ style: {
|
|
103
|
-
padding: "32px 24px 28px 24px",
|
|
104
|
-
borderRadius: "12px",
|
|
105
|
-
textAlign: "center"
|
|
106
|
-
}, visible: innerVisible, closeable: true, "close-on-click-overlay": closeOnClickOverlay, onClickOverlay: onClose, onClickCloseIcon: onClose },
|
|
107
|
-
React.createElement(
|
|
108
|
-
"div",
|
|
109
|
-
{ className: `${b()} ${className}`, style: { ...style }, ...reset },
|
|
110
|
-
React.createElement("div", { className: b("title") }, title || locale.shortpassword.title),
|
|
111
|
-
React.createElement("div", { className: b("subtitle") }, description || locale.shortpassword.description),
|
|
112
|
-
React.createElement(
|
|
113
|
-
"div",
|
|
114
|
-
{ className: b("input") },
|
|
115
|
-
React.createElement("input", { ref: textInput, className: b("input-real"), type: "number", style: systemStyle(), maxLength: 6, value: inputValue, autoFocus, onChange: (e) => changeValue(e) }),
|
|
116
|
-
React.createElement("div", { className: b("input-site") }),
|
|
117
|
-
React.createElement("div", { className: b("input-fake"), onClick: () => focus() }, [...new Array(comLen).keys()].map((item, index) => {
|
|
118
|
-
return React.createElement("div", { className: b("input-fake__li"), key: index }, String(inputValue).length > index ? React.createElement("div", { className: b("input-fake__li__icon") }) : null);
|
|
119
|
-
}))
|
|
120
|
-
),
|
|
121
|
-
React.createElement(
|
|
122
|
-
"div",
|
|
123
|
-
{ className: b("message") },
|
|
124
|
-
React.createElement("div", { className: b("message__error") }, errorMsg),
|
|
125
|
-
tips || locale.shortpassword.tips ? React.createElement(
|
|
126
|
-
"div",
|
|
127
|
-
{ className: b("message__forget") },
|
|
128
|
-
renderIcon(iconSize),
|
|
129
|
-
React.createElement("div", { className: b("message__forget-tips"), onClick: onTips }, tips || locale.shortpassword.tips)
|
|
130
|
-
) : null
|
|
131
|
-
),
|
|
132
|
-
!noButton ? React.createElement(
|
|
133
|
-
"div",
|
|
134
|
-
{ className: b("footer") },
|
|
135
|
-
React.createElement("div", { className: b("footer__cancel"), onClick: onCancel }, locale.cancel),
|
|
136
|
-
React.createElement("div", { className: b("footer__sure"), onClick: () => sure() }, locale.confirm)
|
|
137
|
-
) : null
|
|
138
|
-
)
|
|
139
|
-
)
|
|
140
|
-
);
|
|
141
|
-
};
|
|
142
|
-
ShortPassword.defaultProps = defaultProps;
|
|
143
|
-
ShortPassword.displayName = "NutShortPassword";
|
|
144
|
-
export {
|
|
145
|
-
ShortPassword as S
|
|
146
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
import { Success, Failure, Tips, Loading } from "@nutui/icons-react-taro";
|
|
4
|
-
import { c as cn } from "./bem-cdccae08.js";
|
|
5
|
-
const defaultProps = {
|
|
6
|
-
id: "",
|
|
7
|
-
style: {},
|
|
8
|
-
icon: null,
|
|
9
|
-
iconSize: "20",
|
|
10
|
-
msg: "",
|
|
11
|
-
bottom: "30px",
|
|
12
|
-
duration: 2,
|
|
13
|
-
center: true,
|
|
14
|
-
type: "text",
|
|
15
|
-
title: "",
|
|
16
|
-
customClass: "",
|
|
17
|
-
size: "base",
|
|
18
|
-
textAlignCenter: true,
|
|
19
|
-
bgColor: "rgba(0, 0, 0, .8)",
|
|
20
|
-
cover: false,
|
|
21
|
-
coverColor: "rgba(0, 0, 0, 0)",
|
|
22
|
-
closeOnClickOverlay: false,
|
|
23
|
-
visible: false,
|
|
24
|
-
onClose: () => {
|
|
25
|
-
}
|
|
26
|
-
// 未实现
|
|
27
|
-
};
|
|
28
|
-
const Toast = (props) => {
|
|
29
|
-
const { children, id, style, icon, iconSize, msg, bottom, duration, center, type, title, customClass, size, textAlignCenter, bgColor, cover, coverColor, closeOnClickOverlay, visible, onClose, ...rest } = { ...defaultProps, ...props };
|
|
30
|
-
let timer;
|
|
31
|
-
const [openState, SetOpenState] = useState(false);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (visible) {
|
|
34
|
-
SetOpenState(true);
|
|
35
|
-
show();
|
|
36
|
-
} else {
|
|
37
|
-
hide();
|
|
38
|
-
}
|
|
39
|
-
}, [visible]);
|
|
40
|
-
const clearTimer = () => {
|
|
41
|
-
if (timer) {
|
|
42
|
-
clearTimeout(timer);
|
|
43
|
-
timer = null;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const hide = () => {
|
|
47
|
-
SetOpenState(false);
|
|
48
|
-
onClose();
|
|
49
|
-
};
|
|
50
|
-
const show = () => {
|
|
51
|
-
clearTimer();
|
|
52
|
-
if (duration) {
|
|
53
|
-
timer = window.setTimeout(() => {
|
|
54
|
-
hide();
|
|
55
|
-
}, duration * 1e3);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const clickCover = () => {
|
|
59
|
-
if (closeOnClickOverlay) {
|
|
60
|
-
hide();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const toastBem = cn("toast");
|
|
64
|
-
const hasIcon = () => {
|
|
65
|
-
if (type !== "text") {
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
return !!icon;
|
|
69
|
-
};
|
|
70
|
-
const iconName = () => {
|
|
71
|
-
if (icon) {
|
|
72
|
-
return icon;
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
success: React.createElement(Success, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
76
|
-
fail: React.createElement(Failure, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
77
|
-
warn: React.createElement(Tips, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
78
|
-
loading: React.createElement(Loading, { color: "#ffffff", width: iconSize, height: iconSize })
|
|
79
|
-
}[type];
|
|
80
|
-
};
|
|
81
|
-
const classes = classNames({
|
|
82
|
-
"nut-toast-center": center,
|
|
83
|
-
"nut-toast-has-icon": icon,
|
|
84
|
-
"nut-toast-cover": cover,
|
|
85
|
-
"nut-toast-loading": type === "loading",
|
|
86
|
-
[`${customClass}`]: true,
|
|
87
|
-
[`nut-toast-${size}`]: true
|
|
88
|
-
});
|
|
89
|
-
return React.createElement(React.Fragment, null, openState ? React.createElement(
|
|
90
|
-
"div",
|
|
91
|
-
{ className: `${toastBem()} ${classes}`, id, style: {
|
|
92
|
-
bottom: center ? "auto" : `${bottom}`,
|
|
93
|
-
backgroundColor: cover ? coverColor : "",
|
|
94
|
-
...style
|
|
95
|
-
}, onClick: () => {
|
|
96
|
-
clickCover();
|
|
97
|
-
} },
|
|
98
|
-
React.createElement(
|
|
99
|
-
"div",
|
|
100
|
-
{ className: toastBem("inner"), style: {
|
|
101
|
-
textAlign: textAlignCenter ? "center" : "left",
|
|
102
|
-
backgroundColor: bgColor
|
|
103
|
-
} },
|
|
104
|
-
hasIcon() ? React.createElement("p", { className: toastBem("icon-wrapper") }, iconName()) : null,
|
|
105
|
-
title ? React.createElement("div", { className: "nut-toast-title" }, title) : null,
|
|
106
|
-
React.createElement("span", { className: toastBem("text") }, msg)
|
|
107
|
-
)
|
|
108
|
-
) : null);
|
|
109
|
-
};
|
|
110
|
-
Toast.defaultProps = defaultProps;
|
|
111
|
-
Toast.displayName = "NutToast";
|
|
112
|
-
export {
|
|
113
|
-
Toast as T
|
|
114
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
|
-
import { TriangleUp, TriangleDown } from "@nutui/icons-react-taro";
|
|
3
|
-
import { c as cn } from "./bem-cdccae08.js";
|
|
4
|
-
const defaultProps = {
|
|
5
|
-
rate: 0,
|
|
6
|
-
digits: 2,
|
|
7
|
-
showSign: false,
|
|
8
|
-
showZero: false,
|
|
9
|
-
arrowLeft: false,
|
|
10
|
-
syncTextColor: true,
|
|
11
|
-
textColor: "#333",
|
|
12
|
-
riseColor: "#fa2c19",
|
|
13
|
-
dropColor: "#64b578",
|
|
14
|
-
upIcon: null,
|
|
15
|
-
downIcon: null,
|
|
16
|
-
className: ""
|
|
17
|
-
};
|
|
18
|
-
const TrendArrow = (props) => {
|
|
19
|
-
const { rate, digits, showSign, showZero, arrowLeft, syncTextColor, textColor, riseColor, dropColor, upIcon, downIcon, className, children, ...rest } = { ...defaultProps, ...props };
|
|
20
|
-
const b = cn("trendarrow");
|
|
21
|
-
const handleClick = () => {
|
|
22
|
-
};
|
|
23
|
-
const rateTrend = useRef(rate > 0);
|
|
24
|
-
const myFixed = (num, digit = 2) => {
|
|
25
|
-
if (Object.is(parseFloat(num), NaN)) {
|
|
26
|
-
return console.log(`传入的值:${num}不是一个数字`);
|
|
27
|
-
}
|
|
28
|
-
num = parseFloat(num);
|
|
29
|
-
const numPow = Math.pow(10, digit);
|
|
30
|
-
return (Math.round((num + Number.EPSILON) * numPow) / numPow).toFixed(digit);
|
|
31
|
-
};
|
|
32
|
-
const calcStyle = (() => {
|
|
33
|
-
const arrowColor = rateTrend.current ? riseColor : dropColor;
|
|
34
|
-
const textEquArrowColor = syncTextColor ? arrowColor : textColor;
|
|
35
|
-
const style = {
|
|
36
|
-
color: rate === 0 ? textColor : textEquArrowColor
|
|
37
|
-
};
|
|
38
|
-
return style;
|
|
39
|
-
})();
|
|
40
|
-
const calcRate = (() => {
|
|
41
|
-
rateTrend.current = rate > 0;
|
|
42
|
-
const absRate = Math.abs(rate);
|
|
43
|
-
if (!showZero && rate === 0) {
|
|
44
|
-
return "--";
|
|
45
|
-
}
|
|
46
|
-
const resultRate = `${// eslint-disable-next-line no-nested-ternary
|
|
47
|
-
showSign && rate !== 0 ? rateTrend.current ? "+" : "-" : ""}${myFixed(Number(absRate), digits)}%`;
|
|
48
|
-
return resultRate;
|
|
49
|
-
})();
|
|
50
|
-
const calcIconProps = (() => {
|
|
51
|
-
const iconProps = {
|
|
52
|
-
color: rateTrend.current ? riseColor : dropColor
|
|
53
|
-
};
|
|
54
|
-
return iconProps;
|
|
55
|
-
})();
|
|
56
|
-
const renderContent = (arrowLeft2) => {
|
|
57
|
-
const classNameSuffix = !arrowLeft2 ? "icon-after" : "icon-before";
|
|
58
|
-
return React.createElement("span", { className: `${b(classNameSuffix)} ${b("rate")}`, style: calcStyle }, calcRate);
|
|
59
|
-
};
|
|
60
|
-
return React.createElement(
|
|
61
|
-
"div",
|
|
62
|
-
{ className: `${b()} ${className}`, ...rest, onClick: handleClick },
|
|
63
|
-
!arrowLeft && renderContent(!arrowLeft),
|
|
64
|
-
children || React.createElement(React.Fragment, null, Number(rate) !== 0 && React.createElement(React.Fragment, null, rateTrend ? React.createElement(TriangleUp, { color: calcIconProps.color }) : React.createElement(TriangleDown, { color: calcIconProps.color }))),
|
|
65
|
-
arrowLeft && renderContent(!arrowLeft)
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
TrendArrow.defaultProps = defaultProps;
|
|
69
|
-
TrendArrow.displayName = "NutTrendArrow";
|
|
70
|
-
export {
|
|
71
|
-
TrendArrow as T
|
|
72
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect } from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
import { c as cn } from "./bem-cdccae08.js";
|
|
4
|
-
const defaultProps = {
|
|
5
|
-
source: {
|
|
6
|
-
type: {},
|
|
7
|
-
src: ""
|
|
8
|
-
},
|
|
9
|
-
options: {
|
|
10
|
-
controls: true,
|
|
11
|
-
muted: false,
|
|
12
|
-
autoplay: false,
|
|
13
|
-
poster: "",
|
|
14
|
-
playsinline: false,
|
|
15
|
-
loop: false
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const Video = (props) => {
|
|
19
|
-
const { children, source, options, className, play, pause, playend, onPlay, onPause, onPlayEnd, ...restProps } = {
|
|
20
|
-
...defaultProps,
|
|
21
|
-
...props
|
|
22
|
-
};
|
|
23
|
-
const rootRef = useRef(null);
|
|
24
|
-
const b = cn("video");
|
|
25
|
-
const classes = classNames(className, b(""));
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
init();
|
|
28
|
-
}, []);
|
|
29
|
-
const init = () => {
|
|
30
|
-
if (rootRef.current) {
|
|
31
|
-
const videoRef = rootRef.current;
|
|
32
|
-
if (options.autoplay) {
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
videoRef.play();
|
|
35
|
-
}, 200);
|
|
36
|
-
}
|
|
37
|
-
if (options.playsinline) {
|
|
38
|
-
videoRef.setAttribute("playsinline", String(options.playsinline));
|
|
39
|
-
videoRef.setAttribute("webkit-playsinline", String(options.playsinline));
|
|
40
|
-
videoRef.setAttribute("x5-video-player-type", "h5-page");
|
|
41
|
-
videoRef.setAttribute("x5-video-player-fullscreen", "false");
|
|
42
|
-
}
|
|
43
|
-
videoRef.addEventListener("play", () => {
|
|
44
|
-
onPlay && onPlay(videoRef);
|
|
45
|
-
play && play(videoRef);
|
|
46
|
-
});
|
|
47
|
-
videoRef.addEventListener("pause", () => {
|
|
48
|
-
onPause && onPause(videoRef);
|
|
49
|
-
pause && pause(videoRef);
|
|
50
|
-
});
|
|
51
|
-
videoRef.addEventListener("ended", () => {
|
|
52
|
-
videoRef.currentTime = 0;
|
|
53
|
-
onPlayEnd && onPlayEnd(videoRef);
|
|
54
|
-
playend && playend(videoRef);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return React.createElement(
|
|
59
|
-
"div",
|
|
60
|
-
{ className: classes, ...restProps },
|
|
61
|
-
React.createElement(
|
|
62
|
-
"video",
|
|
63
|
-
{ className: "nut-video-player", muted: options.muted, autoPlay: options.autoplay, loop: options.loop, poster: options.poster, controls: options.controls, ref: rootRef, src: source.src },
|
|
64
|
-
React.createElement("source", { src: source.src, type: source.type }),
|
|
65
|
-
React.createElement("track", { kind: "captions" })
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
Video.defaultProps = defaultProps;
|
|
70
|
-
Video.displayName = "NutVideo";
|
|
71
|
-
export {
|
|
72
|
-
Video as V
|
|
73
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
2
|
-
export interface VideoProps {
|
|
3
|
-
source: {
|
|
4
|
-
type: string;
|
|
5
|
-
src: string;
|
|
6
|
-
};
|
|
7
|
-
options: {
|
|
8
|
-
controls?: boolean;
|
|
9
|
-
muted?: boolean;
|
|
10
|
-
autoplay?: boolean;
|
|
11
|
-
poster?: string;
|
|
12
|
-
playsinline?: boolean;
|
|
13
|
-
loop?: boolean;
|
|
14
|
-
};
|
|
15
|
-
className: string;
|
|
16
|
-
style: React.CSSProperties;
|
|
17
|
-
play: (e: HTMLVideoElement) => void;
|
|
18
|
-
pause: (e: HTMLVideoElement) => void;
|
|
19
|
-
playend: (e: HTMLVideoElement) => void;
|
|
20
|
-
onPlay: (e: HTMLVideoElement) => void;
|
|
21
|
-
onPause: (e: HTMLVideoElement) => void;
|
|
22
|
-
onPlayEnd: (e: HTMLVideoElement) => void;
|
|
23
|
-
}
|
|
24
|
-
export declare const Video: FunctionComponent<Partial<VideoProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onPause' | 'onPlay'>>;
|
|
File without changes
|