@nutui/nutui-react-taro 2.0.0-alpha.7 → 2.0.0-alpha.8
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 +6 -0
- package/dist/esm/Audio.js +7 -6
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/ImagePreview.js +1 -1
- package/dist/esm/Range/style/index.js +1 -1
- package/dist/esm/Range.js +5 -7
- package/dist/esm/Step.js +1 -1
- package/dist/esm/Steps.js +1 -1
- package/dist/esm/Swiper.js +1 -1
- package/dist/esm/SwiperItem.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/{audio.taro-ec96ef80.js → audio.taro-bbd39f93.js} +2 -2
- package/dist/esm/{cascader.taro-0a2694ed.js → cascader.taro-fb7a0230.js} +21 -13
- package/dist/esm/nutui-react.es.js +5 -5
- package/dist/esm/range.taro-615e193a.js +259 -0
- package/dist/esm/step.taro-3bc01c0c.js +1 -1
- package/dist/esm/steps.taro-77e301ab.js +1 -1
- package/dist/esm/swiper.taro-74cf9306.js +1 -1
- package/dist/esm/swiperitem-80df464a.js +1 -1
- package/dist/esm/{tabs.taro-b75f20ff.js → tabs.taro-66164782.js} +8 -1
- 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/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.mjs +408 -483
- package/dist/nutui.react.umd.js +408 -483
- package/dist/packages/range/range.scss +24 -49
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +11 -17
- package/dist/styles/variables.scss +11 -14
- package/dist/types/index.d.ts +20 -26
- package/package.json +1 -1
- package/dist/esm/range.taro-52cda918.js +0 -325
package/dist/nutui.react.mjs
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
/*!
|
|
8
|
-
* @nutui/nutui-react-taro v2.0.0-alpha.
|
|
8
|
+
* @nutui/nutui-react-taro v2.0.0-alpha.8 Fri May 12 2023 19:09:01 GMT+0800 (China Standard Time)
|
|
9
9
|
* (c) 2023 @jdf2e.
|
|
10
10
|
* Released under the MIT License.
|
|
11
11
|
*/
|
|
@@ -6755,6 +6755,10 @@ const TabPane = (props) => {
|
|
|
6755
6755
|
);
|
|
6756
6756
|
return children ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes, children: !disabled && children }) : null;
|
|
6757
6757
|
};
|
|
6758
|
+
function useForceUpdate$1() {
|
|
6759
|
+
const [, updateState] = React__default.useState();
|
|
6760
|
+
return React__default.useCallback(() => updateState({}), []);
|
|
6761
|
+
}
|
|
6758
6762
|
const defaultProps$17 = {
|
|
6759
6763
|
...ComponentDefaults,
|
|
6760
6764
|
tabStyle: {},
|
|
@@ -6810,6 +6814,7 @@ const Tabs = (props) => {
|
|
|
6810
6814
|
return titles2;
|
|
6811
6815
|
};
|
|
6812
6816
|
const titles = useRef(getTitles());
|
|
6817
|
+
const forceUpdate = useForceUpdate$1();
|
|
6813
6818
|
useEffect(() => {
|
|
6814
6819
|
titles.current = getTitles();
|
|
6815
6820
|
let current = "";
|
|
@@ -6818,8 +6823,10 @@ const Tabs = (props) => {
|
|
|
6818
6823
|
current = value;
|
|
6819
6824
|
}
|
|
6820
6825
|
});
|
|
6821
|
-
if (current !== "") {
|
|
6826
|
+
if (current !== "" && current !== value) {
|
|
6822
6827
|
setValue(current);
|
|
6828
|
+
} else {
|
|
6829
|
+
forceUpdate();
|
|
6823
6830
|
}
|
|
6824
6831
|
}, [children]);
|
|
6825
6832
|
const classes = classNames(
|
|
@@ -8751,7 +8758,6 @@ const defaultProps$10 = {
|
|
|
8751
8758
|
popup: true,
|
|
8752
8759
|
visible: false,
|
|
8753
8760
|
options: [],
|
|
8754
|
-
value: [],
|
|
8755
8761
|
title: "",
|
|
8756
8762
|
optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
|
|
8757
8763
|
format: {},
|
|
@@ -8766,8 +8772,7 @@ const defaultProps$10 = {
|
|
|
8766
8772
|
onChange: () => {
|
|
8767
8773
|
},
|
|
8768
8774
|
onPathChange: () => {
|
|
8769
|
-
}
|
|
8770
|
-
...Popup.defaultProps
|
|
8775
|
+
}
|
|
8771
8776
|
};
|
|
8772
8777
|
const InternalCascader = (props, ref) => {
|
|
8773
8778
|
const {
|
|
@@ -8777,6 +8782,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8777
8782
|
visible,
|
|
8778
8783
|
options,
|
|
8779
8784
|
value,
|
|
8785
|
+
defaultValue,
|
|
8780
8786
|
title,
|
|
8781
8787
|
optionKey: optionKey2,
|
|
8782
8788
|
format: format2,
|
|
@@ -8792,6 +8798,15 @@ const InternalCascader = (props, ref) => {
|
|
|
8792
8798
|
const [tabvalue, setTabvalue] = useState("c1");
|
|
8793
8799
|
const [optionsData, setOptionsData] = useState([]);
|
|
8794
8800
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
|
|
8801
|
+
const [innerValue, setInnerValue] = usePropsValue({
|
|
8802
|
+
value,
|
|
8803
|
+
defaultValue,
|
|
8804
|
+
finalValue: defaultValue,
|
|
8805
|
+
onChange: (val) => {
|
|
8806
|
+
var _a;
|
|
8807
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, val);
|
|
8808
|
+
}
|
|
8809
|
+
});
|
|
8795
8810
|
const [state] = useState({
|
|
8796
8811
|
optionsData: [],
|
|
8797
8812
|
panes: [
|
|
@@ -8801,7 +8816,6 @@ const InternalCascader = (props, ref) => {
|
|
|
8801
8816
|
paneKey: ""
|
|
8802
8817
|
}
|
|
8803
8818
|
],
|
|
8804
|
-
innerValue: value,
|
|
8805
8819
|
tree: new Tree$1([], {}),
|
|
8806
8820
|
tabsCursor: 0,
|
|
8807
8821
|
// 选中的tab项
|
|
@@ -8821,12 +8835,12 @@ const InternalCascader = (props, ref) => {
|
|
|
8821
8835
|
});
|
|
8822
8836
|
useEffect(() => {
|
|
8823
8837
|
initData();
|
|
8824
|
-
}, [options]);
|
|
8838
|
+
}, [options, format2]);
|
|
8825
8839
|
useEffect(() => {
|
|
8826
|
-
if (
|
|
8827
|
-
|
|
8840
|
+
if (defaultValue && defaultValue !== innerValue) {
|
|
8841
|
+
setInnerValue(defaultValue);
|
|
8828
8842
|
}
|
|
8829
|
-
}, [
|
|
8843
|
+
}, [defaultValue]);
|
|
8830
8844
|
const initData = async () => {
|
|
8831
8845
|
state.lazyLoadMap.clear();
|
|
8832
8846
|
if (format2 && Object.keys(format2).length > 0) {
|
|
@@ -8861,24 +8875,24 @@ const InternalCascader = (props, ref) => {
|
|
|
8861
8875
|
setOptionsData(state.panes);
|
|
8862
8876
|
};
|
|
8863
8877
|
const syncValue = async () => {
|
|
8864
|
-
const
|
|
8865
|
-
if (
|
|
8878
|
+
const currentValue = innerValue;
|
|
8879
|
+
if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
|
|
8866
8880
|
return;
|
|
8867
8881
|
}
|
|
8868
|
-
if (
|
|
8882
|
+
if (currentValue.length === 0) {
|
|
8869
8883
|
state.tabsCursor = 0;
|
|
8870
8884
|
return;
|
|
8871
8885
|
}
|
|
8872
|
-
let needToSync =
|
|
8873
|
-
if (isLazy() && Array.isArray(
|
|
8886
|
+
let needToSync = currentValue;
|
|
8887
|
+
if (isLazy() && Array.isArray(currentValue) && currentValue.length) {
|
|
8874
8888
|
needToSync = [];
|
|
8875
8889
|
const parent = state.tree.nodes.find(
|
|
8876
|
-
(node) => node.value ===
|
|
8890
|
+
(node) => node.value === currentValue[0]
|
|
8877
8891
|
);
|
|
8878
8892
|
if (parent) {
|
|
8879
8893
|
needToSync = [parent.value];
|
|
8880
8894
|
state.initLoading = true;
|
|
8881
|
-
const last = await
|
|
8895
|
+
const last = await currentValue.slice(1).reduce(async (p, value2) => {
|
|
8882
8896
|
var _a;
|
|
8883
8897
|
const parent2 = await p;
|
|
8884
8898
|
await invokeLazyLoad(parent2);
|
|
@@ -8894,7 +8908,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8894
8908
|
state.initLoading = false;
|
|
8895
8909
|
}
|
|
8896
8910
|
}
|
|
8897
|
-
if (needToSync.length &&
|
|
8911
|
+
if (needToSync.length && currentValue === defaultValue) {
|
|
8898
8912
|
const pathNodes = state.tree.getPathNodesByValue(needToSync);
|
|
8899
8913
|
pathNodes.forEach((node, index) => {
|
|
8900
8914
|
state.tabsCursor = index;
|
|
@@ -8951,6 +8965,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8951
8965
|
const optionParams = pathNodes.map((item) => item.value);
|
|
8952
8966
|
onChange(optionParams, pathNodes);
|
|
8953
8967
|
onPathChange(optionParams, pathNodes);
|
|
8968
|
+
setInnerValue(optionParams);
|
|
8954
8969
|
}
|
|
8955
8970
|
setOptionsData(state.panes);
|
|
8956
8971
|
close();
|
|
@@ -9644,7 +9659,7 @@ const InternalPicker = (props, ref) => {
|
|
|
9644
9659
|
(_a = props.onConfirm) == null ? void 0 : _a.call(props, setSelectedOptions(), val);
|
|
9645
9660
|
}
|
|
9646
9661
|
});
|
|
9647
|
-
const [
|
|
9662
|
+
const [currentValue, setCurrentValue] = useState([]);
|
|
9648
9663
|
const [columnIndex, setColumnIndex] = useState(0);
|
|
9649
9664
|
const pickerRef = useRef(null);
|
|
9650
9665
|
const [refs, setRefs] = useRefs();
|
|
@@ -9834,7 +9849,7 @@ const InternalPicker = (props, ref) => {
|
|
|
9834
9849
|
setPickingStatus(false);
|
|
9835
9850
|
};
|
|
9836
9851
|
const pickerChange = (data) => {
|
|
9837
|
-
const prevDefaultValue =
|
|
9852
|
+
const prevDefaultValue = currentValue;
|
|
9838
9853
|
let changeIndex = 0;
|
|
9839
9854
|
const list = data.detail.value;
|
|
9840
9855
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
@@ -9877,7 +9892,7 @@ const InternalPicker = (props, ref) => {
|
|
|
9877
9892
|
PickerView,
|
|
9878
9893
|
{
|
|
9879
9894
|
ref: pickerRef,
|
|
9880
|
-
value:
|
|
9895
|
+
value: currentValue,
|
|
9881
9896
|
immediateChange: true,
|
|
9882
9897
|
onPickStart: pickerStart,
|
|
9883
9898
|
onChange: pickerChange,
|
|
@@ -11724,289 +11739,103 @@ Radio.defaultProps = defaultProps$P;
|
|
|
11724
11739
|
Radio.displayName = "NutRadio";
|
|
11725
11740
|
Radio.RadioGroup = RadioGroup;
|
|
11726
11741
|
const defaultProps$O = {
|
|
11727
|
-
|
|
11728
|
-
style: {},
|
|
11729
|
-
icon: null,
|
|
11730
|
-
iconSize: "20",
|
|
11731
|
-
msg: "",
|
|
11732
|
-
bottom: "30px",
|
|
11733
|
-
// center为false时生效,距离底部位置
|
|
11734
|
-
duration: 2,
|
|
11735
|
-
// 时长,duration为0则一直展示
|
|
11736
|
-
center: true,
|
|
11737
|
-
// toast是否居中展示
|
|
11738
|
-
type: "text",
|
|
11739
|
-
title: "",
|
|
11740
|
-
customClass: "",
|
|
11741
|
-
// 自定义样式名
|
|
11742
|
-
size: "base",
|
|
11743
|
-
// 设置字体大小,默认base,可选large\small\base
|
|
11744
|
-
textAlignCenter: true,
|
|
11745
|
-
// 文字是否居中显示,true为居中,false为left
|
|
11746
|
-
bgColor: "rgba(0, 0, 0, .8)",
|
|
11747
|
-
cover: false,
|
|
11748
|
-
// 是否展示透明遮罩层
|
|
11749
|
-
coverColor: "rgba(0, 0, 0, 0)",
|
|
11750
|
-
// 遮罩颜色设定
|
|
11751
|
-
closeOnClickOverlay: false,
|
|
11752
|
-
// 是否点击遮罩可关闭
|
|
11753
|
-
visible: false,
|
|
11754
|
-
onClose: () => {
|
|
11755
|
-
}
|
|
11756
|
-
// 未实现
|
|
11757
|
-
};
|
|
11758
|
-
const Toast = (props) => {
|
|
11759
|
-
const {
|
|
11760
|
-
children,
|
|
11761
|
-
id,
|
|
11762
|
-
style,
|
|
11763
|
-
icon,
|
|
11764
|
-
iconSize,
|
|
11765
|
-
msg,
|
|
11766
|
-
bottom,
|
|
11767
|
-
duration,
|
|
11768
|
-
center,
|
|
11769
|
-
type,
|
|
11770
|
-
title,
|
|
11771
|
-
customClass,
|
|
11772
|
-
size,
|
|
11773
|
-
textAlignCenter,
|
|
11774
|
-
bgColor,
|
|
11775
|
-
cover,
|
|
11776
|
-
coverColor,
|
|
11777
|
-
closeOnClickOverlay,
|
|
11778
|
-
visible,
|
|
11779
|
-
onClose,
|
|
11780
|
-
...rest
|
|
11781
|
-
} = { ...defaultProps$O, ...props };
|
|
11782
|
-
let timer;
|
|
11783
|
-
const [openState, SetOpenState] = useState(false);
|
|
11784
|
-
useEffect(() => {
|
|
11785
|
-
if (visible) {
|
|
11786
|
-
SetOpenState(true);
|
|
11787
|
-
show();
|
|
11788
|
-
} else {
|
|
11789
|
-
hide();
|
|
11790
|
-
}
|
|
11791
|
-
}, [visible]);
|
|
11792
|
-
const clearTimer = () => {
|
|
11793
|
-
if (timer) {
|
|
11794
|
-
clearTimeout(timer);
|
|
11795
|
-
timer = null;
|
|
11796
|
-
}
|
|
11797
|
-
};
|
|
11798
|
-
const hide = () => {
|
|
11799
|
-
SetOpenState(false);
|
|
11800
|
-
onClose();
|
|
11801
|
-
};
|
|
11802
|
-
const show = () => {
|
|
11803
|
-
clearTimer();
|
|
11804
|
-
if (duration) {
|
|
11805
|
-
timer = window.setTimeout(() => {
|
|
11806
|
-
hide();
|
|
11807
|
-
}, duration * 1e3);
|
|
11808
|
-
}
|
|
11809
|
-
};
|
|
11810
|
-
const clickCover = () => {
|
|
11811
|
-
if (closeOnClickOverlay) {
|
|
11812
|
-
hide();
|
|
11813
|
-
}
|
|
11814
|
-
};
|
|
11815
|
-
const toastBem = cn("toast");
|
|
11816
|
-
const hasIcon = () => {
|
|
11817
|
-
if (type !== "text") {
|
|
11818
|
-
return true;
|
|
11819
|
-
}
|
|
11820
|
-
return !!icon;
|
|
11821
|
-
};
|
|
11822
|
-
const iconName = () => {
|
|
11823
|
-
if (icon) {
|
|
11824
|
-
return icon;
|
|
11825
|
-
}
|
|
11826
|
-
return {
|
|
11827
|
-
success: /* @__PURE__ */ jsxRuntimeExports.jsx(a$4, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
11828
|
-
fail: /* @__PURE__ */ jsxRuntimeExports.jsx(a$l, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
11829
|
-
warn: /* @__PURE__ */ jsxRuntimeExports.jsx(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
11830
|
-
loading: /* @__PURE__ */ jsxRuntimeExports.jsx(r$f, { color: "#ffffff", width: iconSize, height: iconSize })
|
|
11831
|
-
}[type];
|
|
11832
|
-
};
|
|
11833
|
-
const classes = classNames({
|
|
11834
|
-
"nut-toast-center": center,
|
|
11835
|
-
"nut-toast-has-icon": icon,
|
|
11836
|
-
"nut-toast-cover": cover,
|
|
11837
|
-
"nut-toast-loading": type === "loading",
|
|
11838
|
-
[`${customClass}`]: true,
|
|
11839
|
-
[`nut-toast-${size}`]: true
|
|
11840
|
-
});
|
|
11841
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: openState ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11842
|
-
"div",
|
|
11843
|
-
{
|
|
11844
|
-
className: `${toastBem()} ${classes}`,
|
|
11845
|
-
id,
|
|
11846
|
-
style: {
|
|
11847
|
-
bottom: center ? "auto" : `${bottom}`,
|
|
11848
|
-
backgroundColor: cover ? coverColor : "",
|
|
11849
|
-
...style
|
|
11850
|
-
},
|
|
11851
|
-
onClick: () => {
|
|
11852
|
-
clickCover();
|
|
11853
|
-
},
|
|
11854
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
11855
|
-
"div",
|
|
11856
|
-
{
|
|
11857
|
-
className: toastBem("inner"),
|
|
11858
|
-
style: {
|
|
11859
|
-
textAlign: textAlignCenter ? "center" : "left",
|
|
11860
|
-
backgroundColor: bgColor
|
|
11861
|
-
},
|
|
11862
|
-
children: [
|
|
11863
|
-
hasIcon() ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: toastBem("icon-wrapper"), children: iconName() }) : null,
|
|
11864
|
-
title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-toast-title", children: title }) : null,
|
|
11865
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: toastBem("text"), children: msg })
|
|
11866
|
-
]
|
|
11867
|
-
}
|
|
11868
|
-
)
|
|
11869
|
-
}
|
|
11870
|
-
) : null });
|
|
11871
|
-
};
|
|
11872
|
-
Toast.defaultProps = defaultProps$O;
|
|
11873
|
-
Toast.displayName = "NutToast";
|
|
11874
|
-
const defaultProps$N = {
|
|
11742
|
+
...ComponentDefaults,
|
|
11875
11743
|
range: false,
|
|
11876
|
-
hiddenRange: false,
|
|
11877
|
-
hiddenTag: false,
|
|
11878
11744
|
min: 0,
|
|
11879
11745
|
max: 100,
|
|
11880
11746
|
step: 1,
|
|
11881
|
-
modelValue: 0,
|
|
11882
11747
|
vertical: false,
|
|
11883
11748
|
marks: {}
|
|
11884
11749
|
};
|
|
11885
|
-
let startValue;
|
|
11886
|
-
let currentValue;
|
|
11887
11750
|
const Range = (props) => {
|
|
11888
|
-
const { locale } = useConfig$1();
|
|
11889
11751
|
const {
|
|
11890
11752
|
className,
|
|
11891
11753
|
range,
|
|
11892
11754
|
disabled,
|
|
11893
|
-
activeColor,
|
|
11894
|
-
inactiveColor,
|
|
11895
|
-
buttonColor,
|
|
11896
|
-
hiddenRange,
|
|
11897
|
-
hiddenTag,
|
|
11898
|
-
modelValue,
|
|
11899
11755
|
button,
|
|
11900
11756
|
vertical,
|
|
11901
11757
|
marks,
|
|
11902
|
-
dragStart,
|
|
11903
|
-
dragEnd,
|
|
11904
11758
|
onChange,
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
const
|
|
11917
|
-
const [
|
|
11759
|
+
onStart,
|
|
11760
|
+
onEnd,
|
|
11761
|
+
minDescription,
|
|
11762
|
+
maxDescription,
|
|
11763
|
+
currentDescription,
|
|
11764
|
+
min,
|
|
11765
|
+
max,
|
|
11766
|
+
step,
|
|
11767
|
+
value,
|
|
11768
|
+
defaultValue
|
|
11769
|
+
} = { ...defaultProps$O, ...props };
|
|
11770
|
+
const classPrefix2 = "nut-range";
|
|
11771
|
+
const [buttonIndex, setButtonIndex] = useState(0);
|
|
11772
|
+
const [dragStatus, setDragStatus] = useState("start");
|
|
11918
11773
|
const touch = useTouch();
|
|
11919
11774
|
const root2 = useRef(null);
|
|
11920
|
-
const [marksList,
|
|
11921
|
-
const [
|
|
11922
|
-
const
|
|
11923
|
-
|
|
11924
|
-
SetToastMsg(msg);
|
|
11925
|
-
SetShow(true);
|
|
11775
|
+
const [marksList, setMarksList] = useState([]);
|
|
11776
|
+
const [startValue, setStartValue] = useState(0);
|
|
11777
|
+
const handleChange = (value2) => {
|
|
11778
|
+
onChange && onChange(value2);
|
|
11926
11779
|
};
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
}, [modelValue]);
|
|
11780
|
+
const [current, setCurrent] = usePropsValue({
|
|
11781
|
+
value,
|
|
11782
|
+
defaultValue,
|
|
11783
|
+
finalValue: 0,
|
|
11784
|
+
onChange: handleChange
|
|
11785
|
+
});
|
|
11786
|
+
const [exactValue, setEaxctValue] = useState(
|
|
11787
|
+
() => value || defaultValue || 0
|
|
11788
|
+
);
|
|
11937
11789
|
useEffect(() => {
|
|
11938
11790
|
if (marks) {
|
|
11939
11791
|
const marksKeys = Object.keys(marks);
|
|
11940
11792
|
const list = marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point >= min && point <= max);
|
|
11941
|
-
|
|
11793
|
+
setMarksList(list);
|
|
11942
11794
|
}
|
|
11943
11795
|
}, [marks]);
|
|
11944
11796
|
const scope = () => {
|
|
11945
|
-
return
|
|
11797
|
+
return max - min;
|
|
11946
11798
|
};
|
|
11947
|
-
const classes =
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
].filter(Boolean).join(" ");
|
|
11955
|
-
}, [disabled, vertical, hiddenRange]);
|
|
11956
|
-
const containerClasses = useCallback(() => {
|
|
11957
|
-
const prefixCls2 = "nut-range-container";
|
|
11958
|
-
return [prefixCls2, `${vertical ? `${prefixCls2}-vertical` : ""}`, className].filter(Boolean).join(" ");
|
|
11959
|
-
}, [vertical, className]);
|
|
11799
|
+
const classes = classNames(classPrefix2, {
|
|
11800
|
+
[`${classPrefix2}-disabled`]: disabled,
|
|
11801
|
+
[`${classPrefix2}-vertical`]: vertical
|
|
11802
|
+
});
|
|
11803
|
+
const containerClasses = classNames(`${classPrefix2}-container`, className, {
|
|
11804
|
+
[`${classPrefix2}-container-vertical`]: vertical
|
|
11805
|
+
});
|
|
11960
11806
|
const markClassName = useCallback(
|
|
11961
11807
|
(mark) => {
|
|
11962
|
-
const
|
|
11963
|
-
let lowerBound =
|
|
11964
|
-
let upperBound =
|
|
11965
|
-
if (range) {
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
upperBound = right;
|
|
11808
|
+
const classPrefix22 = "nut-range-mark";
|
|
11809
|
+
let lowerBound = min;
|
|
11810
|
+
let upperBound = max;
|
|
11811
|
+
if (range && Array.isArray(current)) {
|
|
11812
|
+
lowerBound = current[0];
|
|
11813
|
+
upperBound = current[1];
|
|
11969
11814
|
} else {
|
|
11970
|
-
upperBound =
|
|
11815
|
+
upperBound = current;
|
|
11971
11816
|
}
|
|
11972
11817
|
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
11973
11818
|
return [
|
|
11974
|
-
`${
|
|
11975
|
-
`${isActive ? `${
|
|
11976
|
-
].
|
|
11819
|
+
`${classPrefix22}-text`,
|
|
11820
|
+
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
11821
|
+
].join(" ");
|
|
11977
11822
|
},
|
|
11978
|
-
[range,
|
|
11823
|
+
[range, current, min, max]
|
|
11979
11824
|
);
|
|
11980
|
-
const [rangeName, setRangeName] = useState(classes());
|
|
11981
|
-
const [containerName, setContainerName] = useState(containerClasses());
|
|
11982
|
-
useEffect(() => {
|
|
11983
|
-
setRangeName(classes());
|
|
11984
|
-
setContainerName(containerClasses());
|
|
11985
|
-
}, [classes, containerClasses]);
|
|
11986
|
-
const wrapperStyle = () => {
|
|
11987
|
-
return {
|
|
11988
|
-
background: inactiveColor
|
|
11989
|
-
};
|
|
11990
|
-
};
|
|
11991
|
-
const buttonStyle = () => {
|
|
11992
|
-
return {
|
|
11993
|
-
borderColor: buttonColor
|
|
11994
|
-
};
|
|
11995
|
-
};
|
|
11996
11825
|
const isRange = (val) => {
|
|
11997
11826
|
return !!range && Array.isArray(val);
|
|
11998
11827
|
};
|
|
11999
11828
|
const calcMainAxis = () => {
|
|
12000
|
-
const modelVal =
|
|
11829
|
+
const modelVal = current;
|
|
12001
11830
|
if (isRange(modelVal)) {
|
|
12002
11831
|
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
12003
11832
|
}
|
|
12004
|
-
return `${(modelVal -
|
|
11833
|
+
return `${(modelVal - min) * 100 / scope()}%`;
|
|
12005
11834
|
};
|
|
12006
11835
|
const calcOffset = () => {
|
|
12007
|
-
const modelVal =
|
|
11836
|
+
const modelVal = current;
|
|
12008
11837
|
if (isRange(modelVal)) {
|
|
12009
|
-
return `${(modelVal[0] -
|
|
11838
|
+
return `${(modelVal[0] - min) * 100 / scope()}%`;
|
|
12010
11839
|
}
|
|
12011
11840
|
return `0%`;
|
|
12012
11841
|
};
|
|
@@ -12015,74 +11844,61 @@ const Range = (props) => {
|
|
|
12015
11844
|
return {
|
|
12016
11845
|
height: calcMainAxis(),
|
|
12017
11846
|
top: calcOffset(),
|
|
12018
|
-
background: activeColor,
|
|
12019
11847
|
transition: dragStatus ? "none" : void 0
|
|
12020
11848
|
};
|
|
12021
11849
|
}
|
|
12022
11850
|
return {
|
|
12023
11851
|
width: calcMainAxis(),
|
|
12024
11852
|
left: calcOffset(),
|
|
12025
|
-
background: activeColor,
|
|
12026
11853
|
transition: dragStatus ? "none" : void 0
|
|
12027
11854
|
};
|
|
12028
11855
|
};
|
|
12029
11856
|
const marksStyle = (mark) => {
|
|
12030
11857
|
let style = {
|
|
12031
|
-
left: `${(mark -
|
|
11858
|
+
left: `${(mark - min) / scope() * 100}%`
|
|
12032
11859
|
};
|
|
12033
11860
|
if (vertical) {
|
|
12034
11861
|
style = {
|
|
12035
|
-
top: `${(mark -
|
|
11862
|
+
top: `${(mark - min) / scope() * 100}%`
|
|
12036
11863
|
};
|
|
12037
11864
|
}
|
|
12038
11865
|
return style;
|
|
12039
11866
|
};
|
|
12040
|
-
const
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
if (range) {
|
|
12044
|
-
const [left, right] = modelValue;
|
|
12045
|
-
lowerBound = left;
|
|
12046
|
-
upperBound = right;
|
|
11867
|
+
const tickClass = (mark) => {
|
|
11868
|
+
if (range && Array.isArray(current)) {
|
|
11869
|
+
return mark <= current[1] && mark >= current[0];
|
|
12047
11870
|
}
|
|
12048
|
-
|
|
12049
|
-
const style = {
|
|
12050
|
-
background: !isActive ? inactiveColor : activeColor
|
|
12051
|
-
};
|
|
12052
|
-
return style;
|
|
11871
|
+
return mark <= current;
|
|
12053
11872
|
};
|
|
12054
|
-
const format = (
|
|
12055
|
-
|
|
12056
|
-
return Math.round(
|
|
11873
|
+
const format = (value2) => {
|
|
11874
|
+
value2 = Math.max(+min, Math.min(value2, +max));
|
|
11875
|
+
return Math.round(value2 / +step) * +step;
|
|
12057
11876
|
};
|
|
12058
11877
|
const isSameValue = (newValue, oldValue) => {
|
|
12059
11878
|
return JSON.stringify(newValue) === JSON.stringify(oldValue);
|
|
12060
11879
|
};
|
|
12061
|
-
const handleOverlap = (
|
|
12062
|
-
if (
|
|
12063
|
-
return
|
|
11880
|
+
const handleOverlap = (value2) => {
|
|
11881
|
+
if (value2[0] > value2[1]) {
|
|
11882
|
+
return value2.slice(0).reverse();
|
|
12064
11883
|
}
|
|
12065
|
-
return
|
|
11884
|
+
return value2;
|
|
12066
11885
|
};
|
|
12067
|
-
const updateValue = (
|
|
12068
|
-
if (isRange(
|
|
12069
|
-
|
|
11886
|
+
const updateValue = (value2, end) => {
|
|
11887
|
+
if (isRange(value2)) {
|
|
11888
|
+
value2 = handleOverlap(value2).map(format);
|
|
12070
11889
|
} else {
|
|
12071
|
-
|
|
12072
|
-
}
|
|
12073
|
-
const modelVal = initValue || initValue === 0 ? initValue : modelValue;
|
|
12074
|
-
if (!isSameValue(value, modelVal)) {
|
|
12075
|
-
SetInitValue(value);
|
|
11890
|
+
value2 = format(value2);
|
|
12076
11891
|
}
|
|
12077
|
-
if (
|
|
12078
|
-
|
|
11892
|
+
if (!isSameValue(value2, current)) {
|
|
11893
|
+
setCurrent(value2);
|
|
12079
11894
|
}
|
|
11895
|
+
end && onEnd && onEnd(value2);
|
|
12080
11896
|
};
|
|
12081
11897
|
const click = async (event) => {
|
|
12082
11898
|
if (disabled || !root2.current) {
|
|
12083
11899
|
return;
|
|
12084
11900
|
}
|
|
12085
|
-
|
|
11901
|
+
setDragStatus("");
|
|
12086
11902
|
const rect = await getRectByTaro(root2.current);
|
|
12087
11903
|
let delta = (event.detail.x ? event.detail.x : event.clientX) - rect.left;
|
|
12088
11904
|
let total = rect.width;
|
|
@@ -12090,18 +11906,18 @@ const Range = (props) => {
|
|
|
12090
11906
|
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
12091
11907
|
total = rect.height;
|
|
12092
11908
|
}
|
|
12093
|
-
const
|
|
12094
|
-
|
|
12095
|
-
if (isRange(
|
|
12096
|
-
const [left, right] =
|
|
11909
|
+
const value2 = min + delta / total * scope();
|
|
11910
|
+
setEaxctValue(current);
|
|
11911
|
+
if (isRange(current)) {
|
|
11912
|
+
const [left, right] = current;
|
|
12097
11913
|
const middle = (left + right) / 2;
|
|
12098
|
-
if (
|
|
12099
|
-
updateValue([
|
|
11914
|
+
if (value2 <= middle) {
|
|
11915
|
+
updateValue([value2, right], true);
|
|
12100
11916
|
} else {
|
|
12101
|
-
updateValue([left,
|
|
11917
|
+
updateValue([left, value2], true);
|
|
12102
11918
|
}
|
|
12103
11919
|
} else {
|
|
12104
|
-
updateValue(
|
|
11920
|
+
updateValue(value2, true);
|
|
12105
11921
|
}
|
|
12106
11922
|
};
|
|
12107
11923
|
const onTouchStart = (event) => {
|
|
@@ -12109,24 +11925,23 @@ const Range = (props) => {
|
|
|
12109
11925
|
return;
|
|
12110
11926
|
}
|
|
12111
11927
|
touch.start(event);
|
|
12112
|
-
|
|
12113
|
-
if (isRange(
|
|
12114
|
-
|
|
11928
|
+
setEaxctValue(current);
|
|
11929
|
+
if (isRange(current)) {
|
|
11930
|
+
setStartValue(current.map(format));
|
|
12115
11931
|
} else {
|
|
12116
|
-
|
|
11932
|
+
setStartValue(format(current));
|
|
12117
11933
|
}
|
|
12118
|
-
|
|
11934
|
+
setDragStatus("start");
|
|
12119
11935
|
};
|
|
12120
11936
|
const onTouchMove = async (event) => {
|
|
12121
11937
|
if (disabled || !root2.current) {
|
|
12122
11938
|
return;
|
|
12123
11939
|
}
|
|
12124
11940
|
if (dragStatus === "start") {
|
|
12125
|
-
|
|
12126
|
-
onDragStart && onDragStart();
|
|
11941
|
+
onStart && onStart();
|
|
12127
11942
|
}
|
|
12128
11943
|
touch.move(event);
|
|
12129
|
-
|
|
11944
|
+
setDragStatus("draging");
|
|
12130
11945
|
const rect = await getRectByTaro(root2.current);
|
|
12131
11946
|
let delta = touch.deltaX;
|
|
12132
11947
|
let total = rect.width;
|
|
@@ -12136,137 +11951,97 @@ const Range = (props) => {
|
|
|
12136
11951
|
total = rect.height;
|
|
12137
11952
|
diff = delta / total * scope();
|
|
12138
11953
|
}
|
|
11954
|
+
let newValue;
|
|
12139
11955
|
if (isRange(startValue)) {
|
|
12140
|
-
|
|
11956
|
+
newValue = exactValue.slice();
|
|
11957
|
+
newValue[buttonIndex] = startValue[buttonIndex] + diff;
|
|
12141
11958
|
} else {
|
|
12142
|
-
|
|
11959
|
+
newValue = startValue + diff;
|
|
12143
11960
|
}
|
|
12144
|
-
|
|
11961
|
+
setEaxctValue(newValue);
|
|
11962
|
+
updateValue(newValue);
|
|
12145
11963
|
};
|
|
12146
11964
|
const onTouchEnd = (event) => {
|
|
12147
11965
|
if (disabled) {
|
|
12148
11966
|
return;
|
|
12149
11967
|
}
|
|
12150
11968
|
if (dragStatus === "draging") {
|
|
12151
|
-
updateValue(
|
|
12152
|
-
dragEnd && dragEnd();
|
|
12153
|
-
onDragEnd && onDragEnd();
|
|
11969
|
+
updateValue(current, true);
|
|
12154
11970
|
}
|
|
12155
|
-
|
|
11971
|
+
setDragStatus("");
|
|
12156
11972
|
};
|
|
12157
11973
|
const curValue = (idx) => {
|
|
12158
|
-
const modelVal =
|
|
12159
|
-
const
|
|
12160
|
-
return
|
|
11974
|
+
const modelVal = current;
|
|
11975
|
+
const value2 = typeof idx === "number" ? modelVal[idx] : modelVal;
|
|
11976
|
+
return value2;
|
|
12161
11977
|
};
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
11978
|
+
const renderButton = (index) => {
|
|
11979
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", children: currentDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: currentDescription ? currentDescription(curValue(index)) : curValue(index) }) }) });
|
|
11980
|
+
};
|
|
11981
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: containerClasses, children: [
|
|
11982
|
+
minDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min", children: minDescription || min }),
|
|
11983
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: root2, className: classes, onClick: (e) => click(e), children: [
|
|
11984
|
+
marksList.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-mark", children: marksList.map((marks2) => {
|
|
11985
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
11986
|
+
"span",
|
|
11987
|
+
{
|
|
11988
|
+
className: markClassName(marks2),
|
|
11989
|
+
style: marksStyle(marks2),
|
|
11990
|
+
children: [
|
|
11991
|
+
marks2,
|
|
11992
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11993
|
+
"span",
|
|
11994
|
+
{
|
|
11995
|
+
className: classNames("nut-range-tick", {
|
|
11996
|
+
active: tickClass(marks2)
|
|
11997
|
+
})
|
|
11998
|
+
}
|
|
11999
|
+
)
|
|
12000
|
+
]
|
|
12001
|
+
},
|
|
12002
|
+
marks2
|
|
12003
|
+
);
|
|
12004
|
+
}) }),
|
|
12005
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-bar", style: barStyle(), children: range ? [0, 1].map((item, index) => {
|
|
12006
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12007
|
+
"div",
|
|
12008
|
+
{
|
|
12009
|
+
className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
|
|
12194
12010
|
${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
|
|
12217
|
-
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
index
|
|
12221
|
-
);
|
|
12222
|
-
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12223
|
-
"div",
|
|
12224
|
-
{
|
|
12225
|
-
role: "slider",
|
|
12226
|
-
className: "nut-range-button-wrapper",
|
|
12227
|
-
tabIndex: disabled ? -1 : 0,
|
|
12228
|
-
"aria-valuemin": +min,
|
|
12229
|
-
"aria-valuenow": curValue(),
|
|
12230
|
-
"aria-valuemax": +max,
|
|
12231
|
-
"aria-orientation": vertical ? "vertical" : "horizontal",
|
|
12232
|
-
onTouchStart: (e) => {
|
|
12233
|
-
onTouchStart(e);
|
|
12234
|
-
},
|
|
12235
|
-
onTouchMove: (e) => {
|
|
12236
|
-
onTouchMove(e);
|
|
12237
|
-
},
|
|
12238
|
-
onTouchEnd: (e) => {
|
|
12239
|
-
onTouchEnd();
|
|
12240
|
-
},
|
|
12241
|
-
onTouchCancel: (e) => {
|
|
12242
|
-
onTouchEnd();
|
|
12243
|
-
},
|
|
12244
|
-
onClick: (e) => {
|
|
12245
|
-
e.stopPropagation();
|
|
12246
|
-
},
|
|
12247
|
-
children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", style: buttonStyle(), children: !hiddenTag ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: curValueDesc || curValue() }) : null })
|
|
12248
|
-
}
|
|
12249
|
-
) })
|
|
12250
|
-
]
|
|
12251
|
-
}
|
|
12252
|
-
),
|
|
12253
|
-
!hiddenRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDesc || +max }) : null,
|
|
12254
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12255
|
-
Toast,
|
|
12256
|
-
{
|
|
12257
|
-
type: "text",
|
|
12258
|
-
visible: show,
|
|
12259
|
-
msg: toastMsg,
|
|
12260
|
-
onClose: () => {
|
|
12261
|
-
SetShow(false);
|
|
12011
|
+
onTouchStart: (e) => {
|
|
12012
|
+
if (typeof index === "number") {
|
|
12013
|
+
setButtonIndex(index);
|
|
12014
|
+
}
|
|
12015
|
+
onTouchStart(e);
|
|
12016
|
+
},
|
|
12017
|
+
onTouchMove: (e) => onTouchMove(e),
|
|
12018
|
+
onTouchEnd: (e) => onTouchEnd(),
|
|
12019
|
+
onTouchCancel: (e) => onTouchEnd(),
|
|
12020
|
+
onClick: (e) => e.stopPropagation(),
|
|
12021
|
+
children: renderButton(index)
|
|
12022
|
+
},
|
|
12023
|
+
index
|
|
12024
|
+
);
|
|
12025
|
+
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12026
|
+
View,
|
|
12027
|
+
{
|
|
12028
|
+
catchMove: true,
|
|
12029
|
+
className: "nut-range-button-wrapper",
|
|
12030
|
+
onTouchStart: (e) => onTouchStart(e),
|
|
12031
|
+
onTouchMove: (e) => onTouchMove(e),
|
|
12032
|
+
onTouchEnd: (e) => onTouchEnd(),
|
|
12033
|
+
onTouchCancel: (e) => onTouchEnd(),
|
|
12034
|
+
onClick: (e) => e.stopPropagation(),
|
|
12035
|
+
children: renderButton()
|
|
12262
12036
|
}
|
|
12263
|
-
}
|
|
12264
|
-
)
|
|
12037
|
+
) })
|
|
12038
|
+
] }),
|
|
12039
|
+
maxDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDescription || max })
|
|
12265
12040
|
] });
|
|
12266
12041
|
};
|
|
12267
|
-
Range.defaultProps = defaultProps$
|
|
12042
|
+
Range.defaultProps = defaultProps$O;
|
|
12268
12043
|
Range.displayName = "NutRange";
|
|
12269
|
-
const defaultProps$
|
|
12044
|
+
const defaultProps$N = {
|
|
12270
12045
|
...ComponentDefaults,
|
|
12271
12046
|
count: 5,
|
|
12272
12047
|
min: 0,
|
|
@@ -12291,7 +12066,7 @@ const Rate = (props) => {
|
|
|
12291
12066
|
allowHalf,
|
|
12292
12067
|
onChange
|
|
12293
12068
|
} = {
|
|
12294
|
-
...defaultProps$
|
|
12069
|
+
...defaultProps$N,
|
|
12295
12070
|
...props
|
|
12296
12071
|
};
|
|
12297
12072
|
const classPrefix2 = "nut-rate";
|
|
@@ -12376,9 +12151,9 @@ const Rate = (props) => {
|
|
|
12376
12151
|
}
|
|
12377
12152
|
);
|
|
12378
12153
|
};
|
|
12379
|
-
Rate.defaultProps = defaultProps$
|
|
12154
|
+
Rate.defaultProps = defaultProps$N;
|
|
12380
12155
|
Rate.displayName = "NutRate";
|
|
12381
|
-
const defaultProps$
|
|
12156
|
+
const defaultProps$M = {
|
|
12382
12157
|
...ComponentDefaults,
|
|
12383
12158
|
placeholder: "",
|
|
12384
12159
|
shape: "square",
|
|
@@ -12426,7 +12201,7 @@ const SearchBar = (props) => {
|
|
|
12426
12201
|
onClickRightinIcon,
|
|
12427
12202
|
onClickRightoutIcon
|
|
12428
12203
|
} = {
|
|
12429
|
-
...defaultProps$
|
|
12204
|
+
...defaultProps$M,
|
|
12430
12205
|
...props
|
|
12431
12206
|
};
|
|
12432
12207
|
const alignClass = `${align}`;
|
|
@@ -12612,9 +12387,9 @@ const SearchBar = (props) => {
|
|
|
12612
12387
|
}
|
|
12613
12388
|
);
|
|
12614
12389
|
};
|
|
12615
|
-
SearchBar.defaultProps = defaultProps$
|
|
12390
|
+
SearchBar.defaultProps = defaultProps$M;
|
|
12616
12391
|
SearchBar.displayName = "NutSearchBar";
|
|
12617
|
-
const defaultProps$
|
|
12392
|
+
const defaultProps$L = {
|
|
12618
12393
|
...ComponentDefaults,
|
|
12619
12394
|
title: "",
|
|
12620
12395
|
description: "",
|
|
@@ -12777,9 +12552,9 @@ const ShortPassword = (props) => {
|
|
|
12777
12552
|
}
|
|
12778
12553
|
) });
|
|
12779
12554
|
};
|
|
12780
|
-
ShortPassword.defaultProps = defaultProps$
|
|
12555
|
+
ShortPassword.defaultProps = defaultProps$L;
|
|
12781
12556
|
ShortPassword.displayName = "NutShortPassword";
|
|
12782
|
-
const defaultProps$
|
|
12557
|
+
const defaultProps$K = {
|
|
12783
12558
|
canvasId: "spcanvas",
|
|
12784
12559
|
type: "png",
|
|
12785
12560
|
lineWidth: 2,
|
|
@@ -12801,7 +12576,7 @@ const Signature = (props) => {
|
|
|
12801
12576
|
onClear,
|
|
12802
12577
|
...rest
|
|
12803
12578
|
} = {
|
|
12804
|
-
...defaultProps$
|
|
12579
|
+
...defaultProps$K,
|
|
12805
12580
|
...props
|
|
12806
12581
|
};
|
|
12807
12582
|
const b2 = cn("signature");
|
|
@@ -12965,9 +12740,9 @@ const Signature = (props) => {
|
|
|
12965
12740
|
)
|
|
12966
12741
|
] });
|
|
12967
12742
|
};
|
|
12968
|
-
Signature.defaultProps = defaultProps$
|
|
12743
|
+
Signature.defaultProps = defaultProps$K;
|
|
12969
12744
|
Signature.displayName = "NutSignature";
|
|
12970
|
-
const defaultProps$
|
|
12745
|
+
const defaultProps$J = {
|
|
12971
12746
|
...ComponentDefaults,
|
|
12972
12747
|
disabled: false,
|
|
12973
12748
|
activeText: "",
|
|
@@ -12984,7 +12759,7 @@ const Switch = (props) => {
|
|
|
12984
12759
|
style,
|
|
12985
12760
|
onChange
|
|
12986
12761
|
} = {
|
|
12987
|
-
...defaultProps$
|
|
12762
|
+
...defaultProps$J,
|
|
12988
12763
|
...props
|
|
12989
12764
|
};
|
|
12990
12765
|
const classPrefix2 = "nut-switch";
|
|
@@ -13006,9 +12781,9 @@ const Switch = (props) => {
|
|
|
13006
12781
|
activeText && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: value ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__label open`, children: activeText }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__label close`, children: inactiveText }) })
|
|
13007
12782
|
] }) });
|
|
13008
12783
|
};
|
|
13009
|
-
Switch.defaultProps = defaultProps$
|
|
12784
|
+
Switch.defaultProps = defaultProps$J;
|
|
13010
12785
|
Switch.displayName = "NutSwitch";
|
|
13011
|
-
const defaultProps$
|
|
12786
|
+
const defaultProps$I = {
|
|
13012
12787
|
...ComponentDefaults,
|
|
13013
12788
|
defaultValue: "",
|
|
13014
12789
|
showCount: false,
|
|
@@ -13036,7 +12811,7 @@ const TextArea = (props) => {
|
|
|
13036
12811
|
onBlur,
|
|
13037
12812
|
onFocus,
|
|
13038
12813
|
...rest
|
|
13039
|
-
} = { ...defaultProps$
|
|
12814
|
+
} = { ...defaultProps$I, ...props };
|
|
13040
12815
|
const classPrefix2 = "nut-textarea";
|
|
13041
12816
|
const compositionRef = useRef(false);
|
|
13042
12817
|
const format = (value2) => {
|
|
@@ -13118,9 +12893,9 @@ const TextArea = (props) => {
|
|
|
13118
12893
|
}
|
|
13119
12894
|
);
|
|
13120
12895
|
};
|
|
13121
|
-
TextArea.defaultProps = defaultProps$
|
|
12896
|
+
TextArea.defaultProps = defaultProps$I;
|
|
13122
12897
|
TextArea.displayName = "NutTextArea";
|
|
13123
|
-
const defaultProps$
|
|
12898
|
+
const defaultProps$H = {
|
|
13124
12899
|
...ComponentDefaults,
|
|
13125
12900
|
percent: 0,
|
|
13126
12901
|
showText: false,
|
|
@@ -13139,7 +12914,7 @@ const Progress = (props) => {
|
|
|
13139
12914
|
children,
|
|
13140
12915
|
...rest
|
|
13141
12916
|
} = {
|
|
13142
|
-
...defaultProps$
|
|
12917
|
+
...defaultProps$H,
|
|
13143
12918
|
...props
|
|
13144
12919
|
};
|
|
13145
12920
|
const classPrefix2 = "nut-progress";
|
|
@@ -13176,7 +12951,7 @@ const Progress = (props) => {
|
|
|
13176
12951
|
}
|
|
13177
12952
|
) }) }) });
|
|
13178
12953
|
};
|
|
13179
|
-
Progress.defaultProps = defaultProps$
|
|
12954
|
+
Progress.defaultProps = defaultProps$H;
|
|
13180
12955
|
Progress.displayName = "NutProgress";
|
|
13181
12956
|
class UploadOptions {
|
|
13182
12957
|
constructor() {
|
|
@@ -13321,7 +13096,7 @@ const funcInterceptor = (interceptor, {
|
|
|
13321
13096
|
done();
|
|
13322
13097
|
}
|
|
13323
13098
|
};
|
|
13324
|
-
const defaultProps$
|
|
13099
|
+
const defaultProps$G = {
|
|
13325
13100
|
...ComponentDefaults,
|
|
13326
13101
|
url: "",
|
|
13327
13102
|
maxCount: 1,
|
|
@@ -13409,7 +13184,7 @@ const InternalUploader = (props, ref) => {
|
|
|
13409
13184
|
beforeXhrUpload,
|
|
13410
13185
|
beforeDelete,
|
|
13411
13186
|
...restProps
|
|
13412
|
-
} = { ...defaultProps$
|
|
13187
|
+
} = { ...defaultProps$G, ...props };
|
|
13413
13188
|
const [fileList, setFileList] = useState(defaultValue || []);
|
|
13414
13189
|
const [uploadQueue, setUploadQueue] = useState([]);
|
|
13415
13190
|
useEffect(() => {
|
|
@@ -13772,9 +13547,9 @@ const InternalUploader = (props, ref) => {
|
|
|
13772
13547
|
] });
|
|
13773
13548
|
};
|
|
13774
13549
|
const Uploader = React__default.forwardRef(InternalUploader);
|
|
13775
|
-
Uploader.defaultProps = defaultProps$
|
|
13550
|
+
Uploader.defaultProps = defaultProps$G;
|
|
13776
13551
|
Uploader.displayName = "NutUploader";
|
|
13777
|
-
const defaultProps$
|
|
13552
|
+
const defaultProps$F = {
|
|
13778
13553
|
cancelText: "",
|
|
13779
13554
|
optionTag: "name",
|
|
13780
13555
|
optionSubTag: "subname",
|
|
@@ -13808,7 +13583,7 @@ const ActionSheet = (props) => {
|
|
|
13808
13583
|
className,
|
|
13809
13584
|
style,
|
|
13810
13585
|
...rest
|
|
13811
|
-
} = { ...defaultProps$
|
|
13586
|
+
} = { ...defaultProps$F, ...props };
|
|
13812
13587
|
const b2 = cn("actionsheet");
|
|
13813
13588
|
const isHighlight = (item) => {
|
|
13814
13589
|
return props.chooseTagValue && props.chooseTagValue === item[props.optionTag || "name"] ? props.color : "#1a1a1a";
|
|
@@ -13853,7 +13628,7 @@ const ActionSheet = (props) => {
|
|
|
13853
13628
|
}
|
|
13854
13629
|
);
|
|
13855
13630
|
};
|
|
13856
|
-
ActionSheet.defaultProps = defaultProps$
|
|
13631
|
+
ActionSheet.defaultProps = defaultProps$F;
|
|
13857
13632
|
ActionSheet.displayName = "NutActionSheet";
|
|
13858
13633
|
const Content = (props) => {
|
|
13859
13634
|
const { visible, title, footer, footerDirection, onClick, children } = props;
|
|
@@ -13948,7 +13723,7 @@ const DialogWrap = (props) => {
|
|
|
13948
13723
|
};
|
|
13949
13724
|
DialogWrap.defaultProps = defaultDialogProps;
|
|
13950
13725
|
DialogWrap.displayName = "NutDialogWrap";
|
|
13951
|
-
const defaultProps$
|
|
13726
|
+
const defaultProps$E = {
|
|
13952
13727
|
confirmText: "",
|
|
13953
13728
|
cancelText: "",
|
|
13954
13729
|
overlay: true,
|
|
@@ -14046,9 +13821,9 @@ const BaseDialog = forwardRef(
|
|
|
14046
13821
|
);
|
|
14047
13822
|
}
|
|
14048
13823
|
);
|
|
14049
|
-
BaseDialog.defaultProps = defaultProps$
|
|
13824
|
+
BaseDialog.defaultProps = defaultProps$E;
|
|
14050
13825
|
BaseDialog.displayName = "NutDialog";
|
|
14051
|
-
const defaultProps$
|
|
13826
|
+
const defaultProps$D = {
|
|
14052
13827
|
...ComponentDefaults,
|
|
14053
13828
|
attract: false,
|
|
14054
13829
|
direction: void 0,
|
|
@@ -14062,7 +13837,7 @@ const defaultProps$C = {
|
|
|
14062
13837
|
};
|
|
14063
13838
|
const Drag = (props) => {
|
|
14064
13839
|
const { attract, direction, boundary, children, className, style, ...reset } = {
|
|
14065
|
-
...defaultProps$
|
|
13840
|
+
...defaultProps$D,
|
|
14066
13841
|
...props
|
|
14067
13842
|
};
|
|
14068
13843
|
const classPrefix2 = "nut-drag";
|
|
@@ -14159,14 +13934,14 @@ const Drag = (props) => {
|
|
|
14159
13934
|
}
|
|
14160
13935
|
);
|
|
14161
13936
|
};
|
|
14162
|
-
Drag.defaultProps = defaultProps$
|
|
13937
|
+
Drag.defaultProps = defaultProps$D;
|
|
14163
13938
|
Drag.displayName = "NutDrag";
|
|
14164
13939
|
const defaultStatus = {
|
|
14165
13940
|
empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
|
|
14166
13941
|
error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
|
|
14167
13942
|
network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
|
|
14168
13943
|
};
|
|
14169
|
-
const defaultProps$
|
|
13944
|
+
const defaultProps$C = {
|
|
14170
13945
|
...ComponentDefaults,
|
|
14171
13946
|
description: "",
|
|
14172
13947
|
imageSize: "",
|
|
@@ -14175,7 +13950,7 @@ const defaultProps$B = {
|
|
|
14175
13950
|
const classPrefix$6 = `nut-empty`;
|
|
14176
13951
|
const Empty = (props) => {
|
|
14177
13952
|
const { locale } = useConfig$1();
|
|
14178
|
-
defaultProps$
|
|
13953
|
+
defaultProps$C.description = locale.noData || defaultProps$C.description;
|
|
14179
13954
|
const {
|
|
14180
13955
|
image,
|
|
14181
13956
|
imageSize,
|
|
@@ -14185,7 +13960,7 @@ const Empty = (props) => {
|
|
|
14185
13960
|
status,
|
|
14186
13961
|
...rest
|
|
14187
13962
|
} = {
|
|
14188
|
-
...defaultProps$
|
|
13963
|
+
...defaultProps$C,
|
|
14189
13964
|
...props
|
|
14190
13965
|
};
|
|
14191
13966
|
const [imgStyle, setImgStyle] = useState({});
|
|
@@ -14214,9 +13989,9 @@ const Empty = (props) => {
|
|
|
14214
13989
|
children
|
|
14215
13990
|
] }) });
|
|
14216
13991
|
};
|
|
14217
|
-
Empty.defaultProps = defaultProps$
|
|
13992
|
+
Empty.defaultProps = defaultProps$C;
|
|
14218
13993
|
Empty.displayName = "NutEmpty";
|
|
14219
|
-
const defaultProps$
|
|
13994
|
+
const defaultProps$B = {
|
|
14220
13995
|
...ComponentDefaults,
|
|
14221
13996
|
hasMore: true,
|
|
14222
13997
|
upperThreshold: 40,
|
|
@@ -14246,7 +14021,7 @@ const Infiniteloading = (props) => {
|
|
|
14246
14021
|
onLoadMore,
|
|
14247
14022
|
onScrollChange
|
|
14248
14023
|
} = {
|
|
14249
|
-
...defaultProps$
|
|
14024
|
+
...defaultProps$B,
|
|
14250
14025
|
...props
|
|
14251
14026
|
};
|
|
14252
14027
|
const [isInfiniting, setIsInfiniting] = useState(false);
|
|
@@ -14369,9 +14144,9 @@ const Infiniteloading = (props) => {
|
|
|
14369
14144
|
}
|
|
14370
14145
|
);
|
|
14371
14146
|
};
|
|
14372
|
-
Infiniteloading.defaultProps = defaultProps$
|
|
14147
|
+
Infiniteloading.defaultProps = defaultProps$B;
|
|
14373
14148
|
Infiniteloading.displayName = "NutInfiniteloading";
|
|
14374
|
-
const defaultProps$
|
|
14149
|
+
const defaultProps$A = {
|
|
14375
14150
|
...ComponentDefaults,
|
|
14376
14151
|
// 滚动方向 across 横向 vertical 纵向
|
|
14377
14152
|
direction: "across",
|
|
@@ -14416,7 +14191,7 @@ const NoticeBar = (props) => {
|
|
|
14416
14191
|
onClick,
|
|
14417
14192
|
onClickItem
|
|
14418
14193
|
} = {
|
|
14419
|
-
...defaultProps$
|
|
14194
|
+
...defaultProps$A,
|
|
14420
14195
|
...props
|
|
14421
14196
|
};
|
|
14422
14197
|
const wrap = useRef(null);
|
|
@@ -14822,9 +14597,9 @@ const NoticeBar = (props) => {
|
|
|
14822
14597
|
) : null
|
|
14823
14598
|
] });
|
|
14824
14599
|
};
|
|
14825
|
-
NoticeBar.defaultProps = defaultProps$
|
|
14600
|
+
NoticeBar.defaultProps = defaultProps$A;
|
|
14826
14601
|
NoticeBar.displayName = "NutNoticeBar";
|
|
14827
|
-
const defaultProps$
|
|
14602
|
+
const defaultProps$z = {
|
|
14828
14603
|
id: "",
|
|
14829
14604
|
msg: "",
|
|
14830
14605
|
color: "",
|
|
@@ -14858,7 +14633,7 @@ const Notify = (props) => {
|
|
|
14858
14633
|
onClosed,
|
|
14859
14634
|
onClick,
|
|
14860
14635
|
...rest
|
|
14861
|
-
} = { ...defaultProps$
|
|
14636
|
+
} = { ...defaultProps$z, ...props };
|
|
14862
14637
|
let timer;
|
|
14863
14638
|
const [showNotify, SetShow] = useState(false);
|
|
14864
14639
|
useEffect(() => {
|
|
@@ -14926,7 +14701,7 @@ const Notify = (props) => {
|
|
|
14926
14701
|
}
|
|
14927
14702
|
) });
|
|
14928
14703
|
};
|
|
14929
|
-
Notify.defaultProps = defaultProps$
|
|
14704
|
+
Notify.defaultProps = defaultProps$z;
|
|
14930
14705
|
Notify.displayName = "NutNotify";
|
|
14931
14706
|
function fillRef(ref, node) {
|
|
14932
14707
|
if (typeof ref === "function") {
|
|
@@ -14970,7 +14745,7 @@ class Trigger extends React__default.Component {
|
|
|
14970
14745
|
return trigger;
|
|
14971
14746
|
}
|
|
14972
14747
|
}
|
|
14973
|
-
const defaultProps$
|
|
14748
|
+
const defaultProps$y = {
|
|
14974
14749
|
...ComponentDefaults,
|
|
14975
14750
|
list: [],
|
|
14976
14751
|
theme: "light",
|
|
@@ -14997,7 +14772,7 @@ const Popover = (props) => {
|
|
|
14997
14772
|
onChoose,
|
|
14998
14773
|
...reset
|
|
14999
14774
|
} = {
|
|
15000
|
-
...defaultProps$
|
|
14775
|
+
...defaultProps$y,
|
|
15001
14776
|
...props
|
|
15002
14777
|
};
|
|
15003
14778
|
const goodItem = useRef(null);
|
|
@@ -15100,7 +14875,7 @@ const Popover = (props) => {
|
|
|
15100
14875
|
) : null
|
|
15101
14876
|
] });
|
|
15102
14877
|
};
|
|
15103
|
-
Popover.defaultProps = defaultProps$
|
|
14878
|
+
Popover.defaultProps = defaultProps$y;
|
|
15104
14879
|
Popover.displayName = "NutPopover";
|
|
15105
14880
|
function clamp$1(v, min, max) {
|
|
15106
14881
|
return Math.max(min, Math.min(v, max));
|
|
@@ -19692,7 +19467,7 @@ function rubberbandIfOutOfBounds(position, min, max, dimension, constant = 0.15)
|
|
|
19692
19467
|
return position;
|
|
19693
19468
|
}
|
|
19694
19469
|
const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
|
|
19695
|
-
const defaultProps$
|
|
19470
|
+
const defaultProps$x = {
|
|
19696
19471
|
pullingText: "",
|
|
19697
19472
|
canReleaseText: "",
|
|
19698
19473
|
refreshingText: "",
|
|
@@ -19707,7 +19482,7 @@ const defaultProps$w = {
|
|
|
19707
19482
|
const PullToRefresh = (p) => {
|
|
19708
19483
|
const { locale } = useConfig$1();
|
|
19709
19484
|
const props = {
|
|
19710
|
-
...defaultProps$
|
|
19485
|
+
...defaultProps$x,
|
|
19711
19486
|
...p,
|
|
19712
19487
|
...{
|
|
19713
19488
|
pullingText: p.pullingText || locale.pullToRefresh.pullingText,
|
|
@@ -19844,10 +19619,10 @@ const PullToRefresh = (p) => {
|
|
|
19844
19619
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-pulltorefresh-content", children: props.children })
|
|
19845
19620
|
] });
|
|
19846
19621
|
};
|
|
19847
|
-
PullToRefresh.defaultProps = defaultProps$
|
|
19622
|
+
PullToRefresh.defaultProps = defaultProps$x;
|
|
19848
19623
|
PullToRefresh.displayName = "NutPullToRefresh";
|
|
19849
19624
|
const AvatarContext = createContext({});
|
|
19850
|
-
const defaultProps$
|
|
19625
|
+
const defaultProps$w = {
|
|
19851
19626
|
...ComponentDefaults,
|
|
19852
19627
|
size: "",
|
|
19853
19628
|
shape: "round",
|
|
@@ -19877,7 +19652,7 @@ const Avatar = (props) => {
|
|
|
19877
19652
|
onError,
|
|
19878
19653
|
...rest
|
|
19879
19654
|
} = {
|
|
19880
|
-
...defaultProps$
|
|
19655
|
+
...defaultProps$w,
|
|
19881
19656
|
...props
|
|
19882
19657
|
};
|
|
19883
19658
|
const [maxSum, setMaxSum] = useState(0);
|
|
@@ -19966,9 +19741,9 @@ const Avatar = (props) => {
|
|
|
19966
19741
|
}
|
|
19967
19742
|
) });
|
|
19968
19743
|
};
|
|
19969
|
-
Avatar.defaultProps = defaultProps$
|
|
19744
|
+
Avatar.defaultProps = defaultProps$w;
|
|
19970
19745
|
Avatar.displayName = "NutAvatar";
|
|
19971
|
-
const defaultProps$
|
|
19746
|
+
const defaultProps$v = {
|
|
19972
19747
|
width: "100px",
|
|
19973
19748
|
height: "100px",
|
|
19974
19749
|
row: 1,
|
|
@@ -19996,7 +19771,7 @@ const Skeleton = (props) => {
|
|
|
19996
19771
|
avatarShape,
|
|
19997
19772
|
...restProps
|
|
19998
19773
|
} = {
|
|
19999
|
-
...defaultProps$
|
|
19774
|
+
...defaultProps$v,
|
|
20000
19775
|
...props
|
|
20001
19776
|
};
|
|
20002
19777
|
const b2 = cn("skeleton");
|
|
@@ -20053,7 +19828,7 @@ const Skeleton = (props) => {
|
|
|
20053
19828
|
] })
|
|
20054
19829
|
] }) });
|
|
20055
19830
|
};
|
|
20056
|
-
Skeleton.defaultProps = defaultProps$
|
|
19831
|
+
Skeleton.defaultProps = defaultProps$v;
|
|
20057
19832
|
Skeleton.displayName = "NutSkeleton";
|
|
20058
19833
|
function preventDefault(event, isStopPropagation) {
|
|
20059
19834
|
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
@@ -20063,7 +19838,7 @@ function preventDefault(event, isStopPropagation) {
|
|
|
20063
19838
|
event.stopPropagation();
|
|
20064
19839
|
}
|
|
20065
19840
|
}
|
|
20066
|
-
const defaultProps$
|
|
19841
|
+
const defaultProps$u = {
|
|
20067
19842
|
name: ""
|
|
20068
19843
|
};
|
|
20069
19844
|
const Swipe = forwardRef((props, instanceRef) => {
|
|
@@ -20082,7 +19857,7 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
20082
19857
|
};
|
|
20083
19858
|
nextTick(() => getWidth());
|
|
20084
19859
|
});
|
|
20085
|
-
const { children, className, style } = { ...defaultProps$
|
|
19860
|
+
const { children, className, style } = { ...defaultProps$u, ...props };
|
|
20086
19861
|
const root2 = useRef();
|
|
20087
19862
|
const opened = useRef(false);
|
|
20088
19863
|
const lockClick = useRef(false);
|
|
@@ -20242,8 +20017,156 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
20242
20017
|
}
|
|
20243
20018
|
);
|
|
20244
20019
|
});
|
|
20245
|
-
Swipe.defaultProps = defaultProps$
|
|
20020
|
+
Swipe.defaultProps = defaultProps$u;
|
|
20246
20021
|
Swipe.displayName = "NutSwipe";
|
|
20022
|
+
const defaultProps$t = {
|
|
20023
|
+
id: "",
|
|
20024
|
+
style: {},
|
|
20025
|
+
icon: null,
|
|
20026
|
+
iconSize: "20",
|
|
20027
|
+
msg: "",
|
|
20028
|
+
bottom: "30px",
|
|
20029
|
+
// center为false时生效,距离底部位置
|
|
20030
|
+
duration: 2,
|
|
20031
|
+
// 时长,duration为0则一直展示
|
|
20032
|
+
center: true,
|
|
20033
|
+
// toast是否居中展示
|
|
20034
|
+
type: "text",
|
|
20035
|
+
title: "",
|
|
20036
|
+
customClass: "",
|
|
20037
|
+
// 自定义样式名
|
|
20038
|
+
size: "base",
|
|
20039
|
+
// 设置字体大小,默认base,可选large\small\base
|
|
20040
|
+
textAlignCenter: true,
|
|
20041
|
+
// 文字是否居中显示,true为居中,false为left
|
|
20042
|
+
bgColor: "rgba(0, 0, 0, .8)",
|
|
20043
|
+
cover: false,
|
|
20044
|
+
// 是否展示透明遮罩层
|
|
20045
|
+
coverColor: "rgba(0, 0, 0, 0)",
|
|
20046
|
+
// 遮罩颜色设定
|
|
20047
|
+
closeOnClickOverlay: false,
|
|
20048
|
+
// 是否点击遮罩可关闭
|
|
20049
|
+
visible: false,
|
|
20050
|
+
onClose: () => {
|
|
20051
|
+
}
|
|
20052
|
+
// 未实现
|
|
20053
|
+
};
|
|
20054
|
+
const Toast = (props) => {
|
|
20055
|
+
const {
|
|
20056
|
+
children,
|
|
20057
|
+
id,
|
|
20058
|
+
style,
|
|
20059
|
+
icon,
|
|
20060
|
+
iconSize,
|
|
20061
|
+
msg,
|
|
20062
|
+
bottom,
|
|
20063
|
+
duration,
|
|
20064
|
+
center,
|
|
20065
|
+
type,
|
|
20066
|
+
title,
|
|
20067
|
+
customClass,
|
|
20068
|
+
size,
|
|
20069
|
+
textAlignCenter,
|
|
20070
|
+
bgColor,
|
|
20071
|
+
cover,
|
|
20072
|
+
coverColor,
|
|
20073
|
+
closeOnClickOverlay,
|
|
20074
|
+
visible,
|
|
20075
|
+
onClose,
|
|
20076
|
+
...rest
|
|
20077
|
+
} = { ...defaultProps$t, ...props };
|
|
20078
|
+
let timer;
|
|
20079
|
+
const [openState, SetOpenState] = useState(false);
|
|
20080
|
+
useEffect(() => {
|
|
20081
|
+
if (visible) {
|
|
20082
|
+
SetOpenState(true);
|
|
20083
|
+
show();
|
|
20084
|
+
} else {
|
|
20085
|
+
hide();
|
|
20086
|
+
}
|
|
20087
|
+
}, [visible]);
|
|
20088
|
+
const clearTimer = () => {
|
|
20089
|
+
if (timer) {
|
|
20090
|
+
clearTimeout(timer);
|
|
20091
|
+
timer = null;
|
|
20092
|
+
}
|
|
20093
|
+
};
|
|
20094
|
+
const hide = () => {
|
|
20095
|
+
SetOpenState(false);
|
|
20096
|
+
onClose();
|
|
20097
|
+
};
|
|
20098
|
+
const show = () => {
|
|
20099
|
+
clearTimer();
|
|
20100
|
+
if (duration) {
|
|
20101
|
+
timer = window.setTimeout(() => {
|
|
20102
|
+
hide();
|
|
20103
|
+
}, duration * 1e3);
|
|
20104
|
+
}
|
|
20105
|
+
};
|
|
20106
|
+
const clickCover = () => {
|
|
20107
|
+
if (closeOnClickOverlay) {
|
|
20108
|
+
hide();
|
|
20109
|
+
}
|
|
20110
|
+
};
|
|
20111
|
+
const toastBem = cn("toast");
|
|
20112
|
+
const hasIcon = () => {
|
|
20113
|
+
if (type !== "text") {
|
|
20114
|
+
return true;
|
|
20115
|
+
}
|
|
20116
|
+
return !!icon;
|
|
20117
|
+
};
|
|
20118
|
+
const iconName = () => {
|
|
20119
|
+
if (icon) {
|
|
20120
|
+
return icon;
|
|
20121
|
+
}
|
|
20122
|
+
return {
|
|
20123
|
+
success: /* @__PURE__ */ jsxRuntimeExports.jsx(a$4, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
20124
|
+
fail: /* @__PURE__ */ jsxRuntimeExports.jsx(a$l, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
20125
|
+
warn: /* @__PURE__ */ jsxRuntimeExports.jsx(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
20126
|
+
loading: /* @__PURE__ */ jsxRuntimeExports.jsx(r$f, { color: "#ffffff", width: iconSize, height: iconSize })
|
|
20127
|
+
}[type];
|
|
20128
|
+
};
|
|
20129
|
+
const classes = classNames({
|
|
20130
|
+
"nut-toast-center": center,
|
|
20131
|
+
"nut-toast-has-icon": icon,
|
|
20132
|
+
"nut-toast-cover": cover,
|
|
20133
|
+
"nut-toast-loading": type === "loading",
|
|
20134
|
+
[`${customClass}`]: true,
|
|
20135
|
+
[`nut-toast-${size}`]: true
|
|
20136
|
+
});
|
|
20137
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: openState ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
20138
|
+
"div",
|
|
20139
|
+
{
|
|
20140
|
+
className: `${toastBem()} ${classes}`,
|
|
20141
|
+
id,
|
|
20142
|
+
style: {
|
|
20143
|
+
bottom: center ? "auto" : `${bottom}`,
|
|
20144
|
+
backgroundColor: cover ? coverColor : "",
|
|
20145
|
+
...style
|
|
20146
|
+
},
|
|
20147
|
+
onClick: () => {
|
|
20148
|
+
clickCover();
|
|
20149
|
+
},
|
|
20150
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
20151
|
+
"div",
|
|
20152
|
+
{
|
|
20153
|
+
className: toastBem("inner"),
|
|
20154
|
+
style: {
|
|
20155
|
+
textAlign: textAlignCenter ? "center" : "left",
|
|
20156
|
+
backgroundColor: bgColor
|
|
20157
|
+
},
|
|
20158
|
+
children: [
|
|
20159
|
+
hasIcon() ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: toastBem("icon-wrapper"), children: iconName() }) : null,
|
|
20160
|
+
title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-toast-title", children: title }) : null,
|
|
20161
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: toastBem("text"), children: msg })
|
|
20162
|
+
]
|
|
20163
|
+
}
|
|
20164
|
+
)
|
|
20165
|
+
}
|
|
20166
|
+
) : null });
|
|
20167
|
+
};
|
|
20168
|
+
Toast.defaultProps = defaultProps$t;
|
|
20169
|
+
Toast.displayName = "NutToast";
|
|
20247
20170
|
const defaultProps$s = {
|
|
20248
20171
|
...ComponentDefaults,
|
|
20249
20172
|
type: "shake",
|
|
@@ -20532,9 +20455,11 @@ const Audio = (props) => {
|
|
|
20532
20455
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("progress-bar-wrapper"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
20533
20456
|
Range,
|
|
20534
20457
|
{
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
20458
|
+
value: percent,
|
|
20459
|
+
onChange: (val) => setPercent(val),
|
|
20460
|
+
currentDescription: null,
|
|
20461
|
+
maxDescription: null,
|
|
20462
|
+
minDescription: null,
|
|
20538
20463
|
"inactive-color": "#cccccc",
|
|
20539
20464
|
"active-color": "#fa2c19"
|
|
20540
20465
|
}
|