@nutui/nutui-react-taro 2.0.0-alpha.6 → 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 +10 -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-a8d2148e.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-56e46dd3.js → tabs.taro-66164782.js} +10 -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 +410 -483
- package/dist/nutui.react.umd.js +410 -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,7 +6823,11 @@ const Tabs = (props) => {
|
|
|
6818
6823
|
current = value;
|
|
6819
6824
|
}
|
|
6820
6825
|
});
|
|
6821
|
-
|
|
6826
|
+
if (current !== "" && current !== value) {
|
|
6827
|
+
setValue(current);
|
|
6828
|
+
} else {
|
|
6829
|
+
forceUpdate();
|
|
6830
|
+
}
|
|
6822
6831
|
}, [children]);
|
|
6823
6832
|
const classes = classNames(
|
|
6824
6833
|
classPrefix$a,
|
|
@@ -8749,7 +8758,6 @@ const defaultProps$10 = {
|
|
|
8749
8758
|
popup: true,
|
|
8750
8759
|
visible: false,
|
|
8751
8760
|
options: [],
|
|
8752
|
-
value: [],
|
|
8753
8761
|
title: "",
|
|
8754
8762
|
optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
|
|
8755
8763
|
format: {},
|
|
@@ -8764,8 +8772,7 @@ const defaultProps$10 = {
|
|
|
8764
8772
|
onChange: () => {
|
|
8765
8773
|
},
|
|
8766
8774
|
onPathChange: () => {
|
|
8767
|
-
}
|
|
8768
|
-
...Popup.defaultProps
|
|
8775
|
+
}
|
|
8769
8776
|
};
|
|
8770
8777
|
const InternalCascader = (props, ref) => {
|
|
8771
8778
|
const {
|
|
@@ -8775,6 +8782,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8775
8782
|
visible,
|
|
8776
8783
|
options,
|
|
8777
8784
|
value,
|
|
8785
|
+
defaultValue,
|
|
8778
8786
|
title,
|
|
8779
8787
|
optionKey: optionKey2,
|
|
8780
8788
|
format: format2,
|
|
@@ -8790,6 +8798,15 @@ const InternalCascader = (props, ref) => {
|
|
|
8790
8798
|
const [tabvalue, setTabvalue] = useState("c1");
|
|
8791
8799
|
const [optionsData, setOptionsData] = useState([]);
|
|
8792
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
|
+
});
|
|
8793
8810
|
const [state] = useState({
|
|
8794
8811
|
optionsData: [],
|
|
8795
8812
|
panes: [
|
|
@@ -8799,7 +8816,6 @@ const InternalCascader = (props, ref) => {
|
|
|
8799
8816
|
paneKey: ""
|
|
8800
8817
|
}
|
|
8801
8818
|
],
|
|
8802
|
-
innerValue: value,
|
|
8803
8819
|
tree: new Tree$1([], {}),
|
|
8804
8820
|
tabsCursor: 0,
|
|
8805
8821
|
// 选中的tab项
|
|
@@ -8819,12 +8835,12 @@ const InternalCascader = (props, ref) => {
|
|
|
8819
8835
|
});
|
|
8820
8836
|
useEffect(() => {
|
|
8821
8837
|
initData();
|
|
8822
|
-
}, [options]);
|
|
8838
|
+
}, [options, format2]);
|
|
8823
8839
|
useEffect(() => {
|
|
8824
|
-
if (
|
|
8825
|
-
|
|
8840
|
+
if (defaultValue && defaultValue !== innerValue) {
|
|
8841
|
+
setInnerValue(defaultValue);
|
|
8826
8842
|
}
|
|
8827
|
-
}, [
|
|
8843
|
+
}, [defaultValue]);
|
|
8828
8844
|
const initData = async () => {
|
|
8829
8845
|
state.lazyLoadMap.clear();
|
|
8830
8846
|
if (format2 && Object.keys(format2).length > 0) {
|
|
@@ -8859,24 +8875,24 @@ const InternalCascader = (props, ref) => {
|
|
|
8859
8875
|
setOptionsData(state.panes);
|
|
8860
8876
|
};
|
|
8861
8877
|
const syncValue = async () => {
|
|
8862
|
-
const
|
|
8863
|
-
if (
|
|
8878
|
+
const currentValue = innerValue;
|
|
8879
|
+
if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
|
|
8864
8880
|
return;
|
|
8865
8881
|
}
|
|
8866
|
-
if (
|
|
8882
|
+
if (currentValue.length === 0) {
|
|
8867
8883
|
state.tabsCursor = 0;
|
|
8868
8884
|
return;
|
|
8869
8885
|
}
|
|
8870
|
-
let needToSync =
|
|
8871
|
-
if (isLazy() && Array.isArray(
|
|
8886
|
+
let needToSync = currentValue;
|
|
8887
|
+
if (isLazy() && Array.isArray(currentValue) && currentValue.length) {
|
|
8872
8888
|
needToSync = [];
|
|
8873
8889
|
const parent = state.tree.nodes.find(
|
|
8874
|
-
(node) => node.value ===
|
|
8890
|
+
(node) => node.value === currentValue[0]
|
|
8875
8891
|
);
|
|
8876
8892
|
if (parent) {
|
|
8877
8893
|
needToSync = [parent.value];
|
|
8878
8894
|
state.initLoading = true;
|
|
8879
|
-
const last = await
|
|
8895
|
+
const last = await currentValue.slice(1).reduce(async (p, value2) => {
|
|
8880
8896
|
var _a;
|
|
8881
8897
|
const parent2 = await p;
|
|
8882
8898
|
await invokeLazyLoad(parent2);
|
|
@@ -8892,7 +8908,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8892
8908
|
state.initLoading = false;
|
|
8893
8909
|
}
|
|
8894
8910
|
}
|
|
8895
|
-
if (needToSync.length &&
|
|
8911
|
+
if (needToSync.length && currentValue === defaultValue) {
|
|
8896
8912
|
const pathNodes = state.tree.getPathNodesByValue(needToSync);
|
|
8897
8913
|
pathNodes.forEach((node, index) => {
|
|
8898
8914
|
state.tabsCursor = index;
|
|
@@ -8949,6 +8965,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8949
8965
|
const optionParams = pathNodes.map((item) => item.value);
|
|
8950
8966
|
onChange(optionParams, pathNodes);
|
|
8951
8967
|
onPathChange(optionParams, pathNodes);
|
|
8968
|
+
setInnerValue(optionParams);
|
|
8952
8969
|
}
|
|
8953
8970
|
setOptionsData(state.panes);
|
|
8954
8971
|
close();
|
|
@@ -9642,7 +9659,7 @@ const InternalPicker = (props, ref) => {
|
|
|
9642
9659
|
(_a = props.onConfirm) == null ? void 0 : _a.call(props, setSelectedOptions(), val);
|
|
9643
9660
|
}
|
|
9644
9661
|
});
|
|
9645
|
-
const [
|
|
9662
|
+
const [currentValue, setCurrentValue] = useState([]);
|
|
9646
9663
|
const [columnIndex, setColumnIndex] = useState(0);
|
|
9647
9664
|
const pickerRef = useRef(null);
|
|
9648
9665
|
const [refs, setRefs] = useRefs();
|
|
@@ -9832,7 +9849,7 @@ const InternalPicker = (props, ref) => {
|
|
|
9832
9849
|
setPickingStatus(false);
|
|
9833
9850
|
};
|
|
9834
9851
|
const pickerChange = (data) => {
|
|
9835
|
-
const prevDefaultValue =
|
|
9852
|
+
const prevDefaultValue = currentValue;
|
|
9836
9853
|
let changeIndex = 0;
|
|
9837
9854
|
const list = data.detail.value;
|
|
9838
9855
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
@@ -9875,7 +9892,7 @@ const InternalPicker = (props, ref) => {
|
|
|
9875
9892
|
PickerView,
|
|
9876
9893
|
{
|
|
9877
9894
|
ref: pickerRef,
|
|
9878
|
-
value:
|
|
9895
|
+
value: currentValue,
|
|
9879
9896
|
immediateChange: true,
|
|
9880
9897
|
onPickStart: pickerStart,
|
|
9881
9898
|
onChange: pickerChange,
|
|
@@ -11722,289 +11739,103 @@ Radio.defaultProps = defaultProps$P;
|
|
|
11722
11739
|
Radio.displayName = "NutRadio";
|
|
11723
11740
|
Radio.RadioGroup = RadioGroup;
|
|
11724
11741
|
const defaultProps$O = {
|
|
11725
|
-
|
|
11726
|
-
style: {},
|
|
11727
|
-
icon: null,
|
|
11728
|
-
iconSize: "20",
|
|
11729
|
-
msg: "",
|
|
11730
|
-
bottom: "30px",
|
|
11731
|
-
// center为false时生效,距离底部位置
|
|
11732
|
-
duration: 2,
|
|
11733
|
-
// 时长,duration为0则一直展示
|
|
11734
|
-
center: true,
|
|
11735
|
-
// toast是否居中展示
|
|
11736
|
-
type: "text",
|
|
11737
|
-
title: "",
|
|
11738
|
-
customClass: "",
|
|
11739
|
-
// 自定义样式名
|
|
11740
|
-
size: "base",
|
|
11741
|
-
// 设置字体大小,默认base,可选large\small\base
|
|
11742
|
-
textAlignCenter: true,
|
|
11743
|
-
// 文字是否居中显示,true为居中,false为left
|
|
11744
|
-
bgColor: "rgba(0, 0, 0, .8)",
|
|
11745
|
-
cover: false,
|
|
11746
|
-
// 是否展示透明遮罩层
|
|
11747
|
-
coverColor: "rgba(0, 0, 0, 0)",
|
|
11748
|
-
// 遮罩颜色设定
|
|
11749
|
-
closeOnClickOverlay: false,
|
|
11750
|
-
// 是否点击遮罩可关闭
|
|
11751
|
-
visible: false,
|
|
11752
|
-
onClose: () => {
|
|
11753
|
-
}
|
|
11754
|
-
// 未实现
|
|
11755
|
-
};
|
|
11756
|
-
const Toast = (props) => {
|
|
11757
|
-
const {
|
|
11758
|
-
children,
|
|
11759
|
-
id,
|
|
11760
|
-
style,
|
|
11761
|
-
icon,
|
|
11762
|
-
iconSize,
|
|
11763
|
-
msg,
|
|
11764
|
-
bottom,
|
|
11765
|
-
duration,
|
|
11766
|
-
center,
|
|
11767
|
-
type,
|
|
11768
|
-
title,
|
|
11769
|
-
customClass,
|
|
11770
|
-
size,
|
|
11771
|
-
textAlignCenter,
|
|
11772
|
-
bgColor,
|
|
11773
|
-
cover,
|
|
11774
|
-
coverColor,
|
|
11775
|
-
closeOnClickOverlay,
|
|
11776
|
-
visible,
|
|
11777
|
-
onClose,
|
|
11778
|
-
...rest
|
|
11779
|
-
} = { ...defaultProps$O, ...props };
|
|
11780
|
-
let timer;
|
|
11781
|
-
const [openState, SetOpenState] = useState(false);
|
|
11782
|
-
useEffect(() => {
|
|
11783
|
-
if (visible) {
|
|
11784
|
-
SetOpenState(true);
|
|
11785
|
-
show();
|
|
11786
|
-
} else {
|
|
11787
|
-
hide();
|
|
11788
|
-
}
|
|
11789
|
-
}, [visible]);
|
|
11790
|
-
const clearTimer = () => {
|
|
11791
|
-
if (timer) {
|
|
11792
|
-
clearTimeout(timer);
|
|
11793
|
-
timer = null;
|
|
11794
|
-
}
|
|
11795
|
-
};
|
|
11796
|
-
const hide = () => {
|
|
11797
|
-
SetOpenState(false);
|
|
11798
|
-
onClose();
|
|
11799
|
-
};
|
|
11800
|
-
const show = () => {
|
|
11801
|
-
clearTimer();
|
|
11802
|
-
if (duration) {
|
|
11803
|
-
timer = window.setTimeout(() => {
|
|
11804
|
-
hide();
|
|
11805
|
-
}, duration * 1e3);
|
|
11806
|
-
}
|
|
11807
|
-
};
|
|
11808
|
-
const clickCover = () => {
|
|
11809
|
-
if (closeOnClickOverlay) {
|
|
11810
|
-
hide();
|
|
11811
|
-
}
|
|
11812
|
-
};
|
|
11813
|
-
const toastBem = cn("toast");
|
|
11814
|
-
const hasIcon = () => {
|
|
11815
|
-
if (type !== "text") {
|
|
11816
|
-
return true;
|
|
11817
|
-
}
|
|
11818
|
-
return !!icon;
|
|
11819
|
-
};
|
|
11820
|
-
const iconName = () => {
|
|
11821
|
-
if (icon) {
|
|
11822
|
-
return icon;
|
|
11823
|
-
}
|
|
11824
|
-
return {
|
|
11825
|
-
success: /* @__PURE__ */ jsxRuntimeExports.jsx(a$4, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
11826
|
-
fail: /* @__PURE__ */ jsxRuntimeExports.jsx(a$l, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
11827
|
-
warn: /* @__PURE__ */ jsxRuntimeExports.jsx(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
11828
|
-
loading: /* @__PURE__ */ jsxRuntimeExports.jsx(r$f, { color: "#ffffff", width: iconSize, height: iconSize })
|
|
11829
|
-
}[type];
|
|
11830
|
-
};
|
|
11831
|
-
const classes = classNames({
|
|
11832
|
-
"nut-toast-center": center,
|
|
11833
|
-
"nut-toast-has-icon": icon,
|
|
11834
|
-
"nut-toast-cover": cover,
|
|
11835
|
-
"nut-toast-loading": type === "loading",
|
|
11836
|
-
[`${customClass}`]: true,
|
|
11837
|
-
[`nut-toast-${size}`]: true
|
|
11838
|
-
});
|
|
11839
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: openState ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11840
|
-
"div",
|
|
11841
|
-
{
|
|
11842
|
-
className: `${toastBem()} ${classes}`,
|
|
11843
|
-
id,
|
|
11844
|
-
style: {
|
|
11845
|
-
bottom: center ? "auto" : `${bottom}`,
|
|
11846
|
-
backgroundColor: cover ? coverColor : "",
|
|
11847
|
-
...style
|
|
11848
|
-
},
|
|
11849
|
-
onClick: () => {
|
|
11850
|
-
clickCover();
|
|
11851
|
-
},
|
|
11852
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
11853
|
-
"div",
|
|
11854
|
-
{
|
|
11855
|
-
className: toastBem("inner"),
|
|
11856
|
-
style: {
|
|
11857
|
-
textAlign: textAlignCenter ? "center" : "left",
|
|
11858
|
-
backgroundColor: bgColor
|
|
11859
|
-
},
|
|
11860
|
-
children: [
|
|
11861
|
-
hasIcon() ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: toastBem("icon-wrapper"), children: iconName() }) : null,
|
|
11862
|
-
title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-toast-title", children: title }) : null,
|
|
11863
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: toastBem("text"), children: msg })
|
|
11864
|
-
]
|
|
11865
|
-
}
|
|
11866
|
-
)
|
|
11867
|
-
}
|
|
11868
|
-
) : null });
|
|
11869
|
-
};
|
|
11870
|
-
Toast.defaultProps = defaultProps$O;
|
|
11871
|
-
Toast.displayName = "NutToast";
|
|
11872
|
-
const defaultProps$N = {
|
|
11742
|
+
...ComponentDefaults,
|
|
11873
11743
|
range: false,
|
|
11874
|
-
hiddenRange: false,
|
|
11875
|
-
hiddenTag: false,
|
|
11876
11744
|
min: 0,
|
|
11877
11745
|
max: 100,
|
|
11878
11746
|
step: 1,
|
|
11879
|
-
modelValue: 0,
|
|
11880
11747
|
vertical: false,
|
|
11881
11748
|
marks: {}
|
|
11882
11749
|
};
|
|
11883
|
-
let startValue;
|
|
11884
|
-
let currentValue;
|
|
11885
11750
|
const Range = (props) => {
|
|
11886
|
-
const { locale } = useConfig$1();
|
|
11887
11751
|
const {
|
|
11888
11752
|
className,
|
|
11889
11753
|
range,
|
|
11890
11754
|
disabled,
|
|
11891
|
-
activeColor,
|
|
11892
|
-
inactiveColor,
|
|
11893
|
-
buttonColor,
|
|
11894
|
-
hiddenRange,
|
|
11895
|
-
hiddenTag,
|
|
11896
|
-
modelValue,
|
|
11897
11755
|
button,
|
|
11898
11756
|
vertical,
|
|
11899
11757
|
marks,
|
|
11900
|
-
dragStart,
|
|
11901
|
-
dragEnd,
|
|
11902
11758
|
onChange,
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
const
|
|
11915
|
-
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");
|
|
11916
11773
|
const touch = useTouch();
|
|
11917
11774
|
const root2 = useRef(null);
|
|
11918
|
-
const [marksList,
|
|
11919
|
-
const [
|
|
11920
|
-
const
|
|
11921
|
-
|
|
11922
|
-
SetToastMsg(msg);
|
|
11923
|
-
SetShow(true);
|
|
11775
|
+
const [marksList, setMarksList] = useState([]);
|
|
11776
|
+
const [startValue, setStartValue] = useState(0);
|
|
11777
|
+
const handleChange = (value2) => {
|
|
11778
|
+
onChange && onChange(value2);
|
|
11924
11779
|
};
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
}, [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
|
+
);
|
|
11935
11789
|
useEffect(() => {
|
|
11936
11790
|
if (marks) {
|
|
11937
11791
|
const marksKeys = Object.keys(marks);
|
|
11938
11792
|
const list = marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point >= min && point <= max);
|
|
11939
|
-
|
|
11793
|
+
setMarksList(list);
|
|
11940
11794
|
}
|
|
11941
11795
|
}, [marks]);
|
|
11942
11796
|
const scope = () => {
|
|
11943
|
-
return
|
|
11797
|
+
return max - min;
|
|
11944
11798
|
};
|
|
11945
|
-
const classes =
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
].filter(Boolean).join(" ");
|
|
11953
|
-
}, [disabled, vertical, hiddenRange]);
|
|
11954
|
-
const containerClasses = useCallback(() => {
|
|
11955
|
-
const prefixCls2 = "nut-range-container";
|
|
11956
|
-
return [prefixCls2, `${vertical ? `${prefixCls2}-vertical` : ""}`, className].filter(Boolean).join(" ");
|
|
11957
|
-
}, [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
|
+
});
|
|
11958
11806
|
const markClassName = useCallback(
|
|
11959
11807
|
(mark) => {
|
|
11960
|
-
const
|
|
11961
|
-
let lowerBound =
|
|
11962
|
-
let upperBound =
|
|
11963
|
-
if (range) {
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
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];
|
|
11967
11814
|
} else {
|
|
11968
|
-
upperBound =
|
|
11815
|
+
upperBound = current;
|
|
11969
11816
|
}
|
|
11970
11817
|
const isActive = mark <= upperBound && mark >= lowerBound;
|
|
11971
11818
|
return [
|
|
11972
|
-
`${
|
|
11973
|
-
`${isActive ? `${
|
|
11974
|
-
].
|
|
11819
|
+
`${classPrefix22}-text`,
|
|
11820
|
+
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
11821
|
+
].join(" ");
|
|
11975
11822
|
},
|
|
11976
|
-
[range,
|
|
11823
|
+
[range, current, min, max]
|
|
11977
11824
|
);
|
|
11978
|
-
const [rangeName, setRangeName] = useState(classes());
|
|
11979
|
-
const [containerName, setContainerName] = useState(containerClasses());
|
|
11980
|
-
useEffect(() => {
|
|
11981
|
-
setRangeName(classes());
|
|
11982
|
-
setContainerName(containerClasses());
|
|
11983
|
-
}, [classes, containerClasses]);
|
|
11984
|
-
const wrapperStyle = () => {
|
|
11985
|
-
return {
|
|
11986
|
-
background: inactiveColor
|
|
11987
|
-
};
|
|
11988
|
-
};
|
|
11989
|
-
const buttonStyle = () => {
|
|
11990
|
-
return {
|
|
11991
|
-
borderColor: buttonColor
|
|
11992
|
-
};
|
|
11993
|
-
};
|
|
11994
11825
|
const isRange = (val) => {
|
|
11995
11826
|
return !!range && Array.isArray(val);
|
|
11996
11827
|
};
|
|
11997
11828
|
const calcMainAxis = () => {
|
|
11998
|
-
const modelVal =
|
|
11829
|
+
const modelVal = current;
|
|
11999
11830
|
if (isRange(modelVal)) {
|
|
12000
11831
|
return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
|
|
12001
11832
|
}
|
|
12002
|
-
return `${(modelVal -
|
|
11833
|
+
return `${(modelVal - min) * 100 / scope()}%`;
|
|
12003
11834
|
};
|
|
12004
11835
|
const calcOffset = () => {
|
|
12005
|
-
const modelVal =
|
|
11836
|
+
const modelVal = current;
|
|
12006
11837
|
if (isRange(modelVal)) {
|
|
12007
|
-
return `${(modelVal[0] -
|
|
11838
|
+
return `${(modelVal[0] - min) * 100 / scope()}%`;
|
|
12008
11839
|
}
|
|
12009
11840
|
return `0%`;
|
|
12010
11841
|
};
|
|
@@ -12013,74 +11844,61 @@ const Range = (props) => {
|
|
|
12013
11844
|
return {
|
|
12014
11845
|
height: calcMainAxis(),
|
|
12015
11846
|
top: calcOffset(),
|
|
12016
|
-
background: activeColor,
|
|
12017
11847
|
transition: dragStatus ? "none" : void 0
|
|
12018
11848
|
};
|
|
12019
11849
|
}
|
|
12020
11850
|
return {
|
|
12021
11851
|
width: calcMainAxis(),
|
|
12022
11852
|
left: calcOffset(),
|
|
12023
|
-
background: activeColor,
|
|
12024
11853
|
transition: dragStatus ? "none" : void 0
|
|
12025
11854
|
};
|
|
12026
11855
|
};
|
|
12027
11856
|
const marksStyle = (mark) => {
|
|
12028
11857
|
let style = {
|
|
12029
|
-
left: `${(mark -
|
|
11858
|
+
left: `${(mark - min) / scope() * 100}%`
|
|
12030
11859
|
};
|
|
12031
11860
|
if (vertical) {
|
|
12032
11861
|
style = {
|
|
12033
|
-
top: `${(mark -
|
|
11862
|
+
top: `${(mark - min) / scope() * 100}%`
|
|
12034
11863
|
};
|
|
12035
11864
|
}
|
|
12036
11865
|
return style;
|
|
12037
11866
|
};
|
|
12038
|
-
const
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
if (range) {
|
|
12042
|
-
const [left, right] = modelValue;
|
|
12043
|
-
lowerBound = left;
|
|
12044
|
-
upperBound = right;
|
|
11867
|
+
const tickClass = (mark) => {
|
|
11868
|
+
if (range && Array.isArray(current)) {
|
|
11869
|
+
return mark <= current[1] && mark >= current[0];
|
|
12045
11870
|
}
|
|
12046
|
-
|
|
12047
|
-
const style = {
|
|
12048
|
-
background: !isActive ? inactiveColor : activeColor
|
|
12049
|
-
};
|
|
12050
|
-
return style;
|
|
11871
|
+
return mark <= current;
|
|
12051
11872
|
};
|
|
12052
|
-
const format = (
|
|
12053
|
-
|
|
12054
|
-
return Math.round(
|
|
11873
|
+
const format = (value2) => {
|
|
11874
|
+
value2 = Math.max(+min, Math.min(value2, +max));
|
|
11875
|
+
return Math.round(value2 / +step) * +step;
|
|
12055
11876
|
};
|
|
12056
11877
|
const isSameValue = (newValue, oldValue) => {
|
|
12057
11878
|
return JSON.stringify(newValue) === JSON.stringify(oldValue);
|
|
12058
11879
|
};
|
|
12059
|
-
const handleOverlap = (
|
|
12060
|
-
if (
|
|
12061
|
-
return
|
|
11880
|
+
const handleOverlap = (value2) => {
|
|
11881
|
+
if (value2[0] > value2[1]) {
|
|
11882
|
+
return value2.slice(0).reverse();
|
|
12062
11883
|
}
|
|
12063
|
-
return
|
|
11884
|
+
return value2;
|
|
12064
11885
|
};
|
|
12065
|
-
const updateValue = (
|
|
12066
|
-
if (isRange(
|
|
12067
|
-
|
|
11886
|
+
const updateValue = (value2, end) => {
|
|
11887
|
+
if (isRange(value2)) {
|
|
11888
|
+
value2 = handleOverlap(value2).map(format);
|
|
12068
11889
|
} else {
|
|
12069
|
-
|
|
11890
|
+
value2 = format(value2);
|
|
12070
11891
|
}
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
SetInitValue(value);
|
|
12074
|
-
}
|
|
12075
|
-
if ((marks || end) && !isSameValue(value, startValue)) {
|
|
12076
|
-
onChange && onChange(value);
|
|
11892
|
+
if (!isSameValue(value2, current)) {
|
|
11893
|
+
setCurrent(value2);
|
|
12077
11894
|
}
|
|
11895
|
+
end && onEnd && onEnd(value2);
|
|
12078
11896
|
};
|
|
12079
11897
|
const click = async (event) => {
|
|
12080
11898
|
if (disabled || !root2.current) {
|
|
12081
11899
|
return;
|
|
12082
11900
|
}
|
|
12083
|
-
|
|
11901
|
+
setDragStatus("");
|
|
12084
11902
|
const rect = await getRectByTaro(root2.current);
|
|
12085
11903
|
let delta = (event.detail.x ? event.detail.x : event.clientX) - rect.left;
|
|
12086
11904
|
let total = rect.width;
|
|
@@ -12088,18 +11906,18 @@ const Range = (props) => {
|
|
|
12088
11906
|
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
12089
11907
|
total = rect.height;
|
|
12090
11908
|
}
|
|
12091
|
-
const
|
|
12092
|
-
|
|
12093
|
-
if (isRange(
|
|
12094
|
-
const [left, right] =
|
|
11909
|
+
const value2 = min + delta / total * scope();
|
|
11910
|
+
setEaxctValue(current);
|
|
11911
|
+
if (isRange(current)) {
|
|
11912
|
+
const [left, right] = current;
|
|
12095
11913
|
const middle = (left + right) / 2;
|
|
12096
|
-
if (
|
|
12097
|
-
updateValue([
|
|
11914
|
+
if (value2 <= middle) {
|
|
11915
|
+
updateValue([value2, right], true);
|
|
12098
11916
|
} else {
|
|
12099
|
-
updateValue([left,
|
|
11917
|
+
updateValue([left, value2], true);
|
|
12100
11918
|
}
|
|
12101
11919
|
} else {
|
|
12102
|
-
updateValue(
|
|
11920
|
+
updateValue(value2, true);
|
|
12103
11921
|
}
|
|
12104
11922
|
};
|
|
12105
11923
|
const onTouchStart = (event) => {
|
|
@@ -12107,24 +11925,23 @@ const Range = (props) => {
|
|
|
12107
11925
|
return;
|
|
12108
11926
|
}
|
|
12109
11927
|
touch.start(event);
|
|
12110
|
-
|
|
12111
|
-
if (isRange(
|
|
12112
|
-
|
|
11928
|
+
setEaxctValue(current);
|
|
11929
|
+
if (isRange(current)) {
|
|
11930
|
+
setStartValue(current.map(format));
|
|
12113
11931
|
} else {
|
|
12114
|
-
|
|
11932
|
+
setStartValue(format(current));
|
|
12115
11933
|
}
|
|
12116
|
-
|
|
11934
|
+
setDragStatus("start");
|
|
12117
11935
|
};
|
|
12118
11936
|
const onTouchMove = async (event) => {
|
|
12119
11937
|
if (disabled || !root2.current) {
|
|
12120
11938
|
return;
|
|
12121
11939
|
}
|
|
12122
11940
|
if (dragStatus === "start") {
|
|
12123
|
-
|
|
12124
|
-
onDragStart && onDragStart();
|
|
11941
|
+
onStart && onStart();
|
|
12125
11942
|
}
|
|
12126
11943
|
touch.move(event);
|
|
12127
|
-
|
|
11944
|
+
setDragStatus("draging");
|
|
12128
11945
|
const rect = await getRectByTaro(root2.current);
|
|
12129
11946
|
let delta = touch.deltaX;
|
|
12130
11947
|
let total = rect.width;
|
|
@@ -12134,137 +11951,97 @@ const Range = (props) => {
|
|
|
12134
11951
|
total = rect.height;
|
|
12135
11952
|
diff = delta / total * scope();
|
|
12136
11953
|
}
|
|
11954
|
+
let newValue;
|
|
12137
11955
|
if (isRange(startValue)) {
|
|
12138
|
-
|
|
11956
|
+
newValue = exactValue.slice();
|
|
11957
|
+
newValue[buttonIndex] = startValue[buttonIndex] + diff;
|
|
12139
11958
|
} else {
|
|
12140
|
-
|
|
11959
|
+
newValue = startValue + diff;
|
|
12141
11960
|
}
|
|
12142
|
-
|
|
11961
|
+
setEaxctValue(newValue);
|
|
11962
|
+
updateValue(newValue);
|
|
12143
11963
|
};
|
|
12144
11964
|
const onTouchEnd = (event) => {
|
|
12145
11965
|
if (disabled) {
|
|
12146
11966
|
return;
|
|
12147
11967
|
}
|
|
12148
11968
|
if (dragStatus === "draging") {
|
|
12149
|
-
updateValue(
|
|
12150
|
-
dragEnd && dragEnd();
|
|
12151
|
-
onDragEnd && onDragEnd();
|
|
11969
|
+
updateValue(current, true);
|
|
12152
11970
|
}
|
|
12153
|
-
|
|
11971
|
+
setDragStatus("");
|
|
12154
11972
|
};
|
|
12155
11973
|
const curValue = (idx) => {
|
|
12156
|
-
const modelVal =
|
|
12157
|
-
const
|
|
12158
|
-
return
|
|
11974
|
+
const modelVal = current;
|
|
11975
|
+
const value2 = typeof idx === "number" ? modelVal[idx] : modelVal;
|
|
11976
|
+
return value2;
|
|
12159
11977
|
};
|
|
12160
|
-
|
|
12161
|
-
|
|
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
|
-
|
|
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" : ""}
|
|
12192
12010
|
${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
|
|
12217
|
-
|
|
12218
|
-
index
|
|
12219
|
-
);
|
|
12220
|
-
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12221
|
-
"div",
|
|
12222
|
-
{
|
|
12223
|
-
role: "slider",
|
|
12224
|
-
className: "nut-range-button-wrapper",
|
|
12225
|
-
tabIndex: disabled ? -1 : 0,
|
|
12226
|
-
"aria-valuemin": +min,
|
|
12227
|
-
"aria-valuenow": curValue(),
|
|
12228
|
-
"aria-valuemax": +max,
|
|
12229
|
-
"aria-orientation": vertical ? "vertical" : "horizontal",
|
|
12230
|
-
onTouchStart: (e) => {
|
|
12231
|
-
onTouchStart(e);
|
|
12232
|
-
},
|
|
12233
|
-
onTouchMove: (e) => {
|
|
12234
|
-
onTouchMove(e);
|
|
12235
|
-
},
|
|
12236
|
-
onTouchEnd: (e) => {
|
|
12237
|
-
onTouchEnd();
|
|
12238
|
-
},
|
|
12239
|
-
onTouchCancel: (e) => {
|
|
12240
|
-
onTouchEnd();
|
|
12241
|
-
},
|
|
12242
|
-
onClick: (e) => {
|
|
12243
|
-
e.stopPropagation();
|
|
12244
|
-
},
|
|
12245
|
-
children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", style: buttonStyle(), children: !hiddenTag ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: curValueDesc || curValue() }) : null })
|
|
12246
|
-
}
|
|
12247
|
-
) })
|
|
12248
|
-
]
|
|
12249
|
-
}
|
|
12250
|
-
),
|
|
12251
|
-
!hiddenRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDesc || +max }) : null,
|
|
12252
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12253
|
-
Toast,
|
|
12254
|
-
{
|
|
12255
|
-
type: "text",
|
|
12256
|
-
visible: show,
|
|
12257
|
-
msg: toastMsg,
|
|
12258
|
-
onClose: () => {
|
|
12259
|
-
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()
|
|
12260
12036
|
}
|
|
12261
|
-
}
|
|
12262
|
-
)
|
|
12037
|
+
) })
|
|
12038
|
+
] }),
|
|
12039
|
+
maxDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDescription || max })
|
|
12263
12040
|
] });
|
|
12264
12041
|
};
|
|
12265
|
-
Range.defaultProps = defaultProps$
|
|
12042
|
+
Range.defaultProps = defaultProps$O;
|
|
12266
12043
|
Range.displayName = "NutRange";
|
|
12267
|
-
const defaultProps$
|
|
12044
|
+
const defaultProps$N = {
|
|
12268
12045
|
...ComponentDefaults,
|
|
12269
12046
|
count: 5,
|
|
12270
12047
|
min: 0,
|
|
@@ -12289,7 +12066,7 @@ const Rate = (props) => {
|
|
|
12289
12066
|
allowHalf,
|
|
12290
12067
|
onChange
|
|
12291
12068
|
} = {
|
|
12292
|
-
...defaultProps$
|
|
12069
|
+
...defaultProps$N,
|
|
12293
12070
|
...props
|
|
12294
12071
|
};
|
|
12295
12072
|
const classPrefix2 = "nut-rate";
|
|
@@ -12374,9 +12151,9 @@ const Rate = (props) => {
|
|
|
12374
12151
|
}
|
|
12375
12152
|
);
|
|
12376
12153
|
};
|
|
12377
|
-
Rate.defaultProps = defaultProps$
|
|
12154
|
+
Rate.defaultProps = defaultProps$N;
|
|
12378
12155
|
Rate.displayName = "NutRate";
|
|
12379
|
-
const defaultProps$
|
|
12156
|
+
const defaultProps$M = {
|
|
12380
12157
|
...ComponentDefaults,
|
|
12381
12158
|
placeholder: "",
|
|
12382
12159
|
shape: "square",
|
|
@@ -12424,7 +12201,7 @@ const SearchBar = (props) => {
|
|
|
12424
12201
|
onClickRightinIcon,
|
|
12425
12202
|
onClickRightoutIcon
|
|
12426
12203
|
} = {
|
|
12427
|
-
...defaultProps$
|
|
12204
|
+
...defaultProps$M,
|
|
12428
12205
|
...props
|
|
12429
12206
|
};
|
|
12430
12207
|
const alignClass = `${align}`;
|
|
@@ -12610,9 +12387,9 @@ const SearchBar = (props) => {
|
|
|
12610
12387
|
}
|
|
12611
12388
|
);
|
|
12612
12389
|
};
|
|
12613
|
-
SearchBar.defaultProps = defaultProps$
|
|
12390
|
+
SearchBar.defaultProps = defaultProps$M;
|
|
12614
12391
|
SearchBar.displayName = "NutSearchBar";
|
|
12615
|
-
const defaultProps$
|
|
12392
|
+
const defaultProps$L = {
|
|
12616
12393
|
...ComponentDefaults,
|
|
12617
12394
|
title: "",
|
|
12618
12395
|
description: "",
|
|
@@ -12775,9 +12552,9 @@ const ShortPassword = (props) => {
|
|
|
12775
12552
|
}
|
|
12776
12553
|
) });
|
|
12777
12554
|
};
|
|
12778
|
-
ShortPassword.defaultProps = defaultProps$
|
|
12555
|
+
ShortPassword.defaultProps = defaultProps$L;
|
|
12779
12556
|
ShortPassword.displayName = "NutShortPassword";
|
|
12780
|
-
const defaultProps$
|
|
12557
|
+
const defaultProps$K = {
|
|
12781
12558
|
canvasId: "spcanvas",
|
|
12782
12559
|
type: "png",
|
|
12783
12560
|
lineWidth: 2,
|
|
@@ -12799,7 +12576,7 @@ const Signature = (props) => {
|
|
|
12799
12576
|
onClear,
|
|
12800
12577
|
...rest
|
|
12801
12578
|
} = {
|
|
12802
|
-
...defaultProps$
|
|
12579
|
+
...defaultProps$K,
|
|
12803
12580
|
...props
|
|
12804
12581
|
};
|
|
12805
12582
|
const b2 = cn("signature");
|
|
@@ -12963,9 +12740,9 @@ const Signature = (props) => {
|
|
|
12963
12740
|
)
|
|
12964
12741
|
] });
|
|
12965
12742
|
};
|
|
12966
|
-
Signature.defaultProps = defaultProps$
|
|
12743
|
+
Signature.defaultProps = defaultProps$K;
|
|
12967
12744
|
Signature.displayName = "NutSignature";
|
|
12968
|
-
const defaultProps$
|
|
12745
|
+
const defaultProps$J = {
|
|
12969
12746
|
...ComponentDefaults,
|
|
12970
12747
|
disabled: false,
|
|
12971
12748
|
activeText: "",
|
|
@@ -12982,7 +12759,7 @@ const Switch = (props) => {
|
|
|
12982
12759
|
style,
|
|
12983
12760
|
onChange
|
|
12984
12761
|
} = {
|
|
12985
|
-
...defaultProps$
|
|
12762
|
+
...defaultProps$J,
|
|
12986
12763
|
...props
|
|
12987
12764
|
};
|
|
12988
12765
|
const classPrefix2 = "nut-switch";
|
|
@@ -13004,9 +12781,9 @@ const Switch = (props) => {
|
|
|
13004
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 }) })
|
|
13005
12782
|
] }) });
|
|
13006
12783
|
};
|
|
13007
|
-
Switch.defaultProps = defaultProps$
|
|
12784
|
+
Switch.defaultProps = defaultProps$J;
|
|
13008
12785
|
Switch.displayName = "NutSwitch";
|
|
13009
|
-
const defaultProps$
|
|
12786
|
+
const defaultProps$I = {
|
|
13010
12787
|
...ComponentDefaults,
|
|
13011
12788
|
defaultValue: "",
|
|
13012
12789
|
showCount: false,
|
|
@@ -13034,7 +12811,7 @@ const TextArea = (props) => {
|
|
|
13034
12811
|
onBlur,
|
|
13035
12812
|
onFocus,
|
|
13036
12813
|
...rest
|
|
13037
|
-
} = { ...defaultProps$
|
|
12814
|
+
} = { ...defaultProps$I, ...props };
|
|
13038
12815
|
const classPrefix2 = "nut-textarea";
|
|
13039
12816
|
const compositionRef = useRef(false);
|
|
13040
12817
|
const format = (value2) => {
|
|
@@ -13116,9 +12893,9 @@ const TextArea = (props) => {
|
|
|
13116
12893
|
}
|
|
13117
12894
|
);
|
|
13118
12895
|
};
|
|
13119
|
-
TextArea.defaultProps = defaultProps$
|
|
12896
|
+
TextArea.defaultProps = defaultProps$I;
|
|
13120
12897
|
TextArea.displayName = "NutTextArea";
|
|
13121
|
-
const defaultProps$
|
|
12898
|
+
const defaultProps$H = {
|
|
13122
12899
|
...ComponentDefaults,
|
|
13123
12900
|
percent: 0,
|
|
13124
12901
|
showText: false,
|
|
@@ -13137,7 +12914,7 @@ const Progress = (props) => {
|
|
|
13137
12914
|
children,
|
|
13138
12915
|
...rest
|
|
13139
12916
|
} = {
|
|
13140
|
-
...defaultProps$
|
|
12917
|
+
...defaultProps$H,
|
|
13141
12918
|
...props
|
|
13142
12919
|
};
|
|
13143
12920
|
const classPrefix2 = "nut-progress";
|
|
@@ -13174,7 +12951,7 @@ const Progress = (props) => {
|
|
|
13174
12951
|
}
|
|
13175
12952
|
) }) }) });
|
|
13176
12953
|
};
|
|
13177
|
-
Progress.defaultProps = defaultProps$
|
|
12954
|
+
Progress.defaultProps = defaultProps$H;
|
|
13178
12955
|
Progress.displayName = "NutProgress";
|
|
13179
12956
|
class UploadOptions {
|
|
13180
12957
|
constructor() {
|
|
@@ -13319,7 +13096,7 @@ const funcInterceptor = (interceptor, {
|
|
|
13319
13096
|
done();
|
|
13320
13097
|
}
|
|
13321
13098
|
};
|
|
13322
|
-
const defaultProps$
|
|
13099
|
+
const defaultProps$G = {
|
|
13323
13100
|
...ComponentDefaults,
|
|
13324
13101
|
url: "",
|
|
13325
13102
|
maxCount: 1,
|
|
@@ -13407,7 +13184,7 @@ const InternalUploader = (props, ref) => {
|
|
|
13407
13184
|
beforeXhrUpload,
|
|
13408
13185
|
beforeDelete,
|
|
13409
13186
|
...restProps
|
|
13410
|
-
} = { ...defaultProps$
|
|
13187
|
+
} = { ...defaultProps$G, ...props };
|
|
13411
13188
|
const [fileList, setFileList] = useState(defaultValue || []);
|
|
13412
13189
|
const [uploadQueue, setUploadQueue] = useState([]);
|
|
13413
13190
|
useEffect(() => {
|
|
@@ -13770,9 +13547,9 @@ const InternalUploader = (props, ref) => {
|
|
|
13770
13547
|
] });
|
|
13771
13548
|
};
|
|
13772
13549
|
const Uploader = React__default.forwardRef(InternalUploader);
|
|
13773
|
-
Uploader.defaultProps = defaultProps$
|
|
13550
|
+
Uploader.defaultProps = defaultProps$G;
|
|
13774
13551
|
Uploader.displayName = "NutUploader";
|
|
13775
|
-
const defaultProps$
|
|
13552
|
+
const defaultProps$F = {
|
|
13776
13553
|
cancelText: "",
|
|
13777
13554
|
optionTag: "name",
|
|
13778
13555
|
optionSubTag: "subname",
|
|
@@ -13806,7 +13583,7 @@ const ActionSheet = (props) => {
|
|
|
13806
13583
|
className,
|
|
13807
13584
|
style,
|
|
13808
13585
|
...rest
|
|
13809
|
-
} = { ...defaultProps$
|
|
13586
|
+
} = { ...defaultProps$F, ...props };
|
|
13810
13587
|
const b2 = cn("actionsheet");
|
|
13811
13588
|
const isHighlight = (item) => {
|
|
13812
13589
|
return props.chooseTagValue && props.chooseTagValue === item[props.optionTag || "name"] ? props.color : "#1a1a1a";
|
|
@@ -13851,7 +13628,7 @@ const ActionSheet = (props) => {
|
|
|
13851
13628
|
}
|
|
13852
13629
|
);
|
|
13853
13630
|
};
|
|
13854
|
-
ActionSheet.defaultProps = defaultProps$
|
|
13631
|
+
ActionSheet.defaultProps = defaultProps$F;
|
|
13855
13632
|
ActionSheet.displayName = "NutActionSheet";
|
|
13856
13633
|
const Content = (props) => {
|
|
13857
13634
|
const { visible, title, footer, footerDirection, onClick, children } = props;
|
|
@@ -13946,7 +13723,7 @@ const DialogWrap = (props) => {
|
|
|
13946
13723
|
};
|
|
13947
13724
|
DialogWrap.defaultProps = defaultDialogProps;
|
|
13948
13725
|
DialogWrap.displayName = "NutDialogWrap";
|
|
13949
|
-
const defaultProps$
|
|
13726
|
+
const defaultProps$E = {
|
|
13950
13727
|
confirmText: "",
|
|
13951
13728
|
cancelText: "",
|
|
13952
13729
|
overlay: true,
|
|
@@ -14044,9 +13821,9 @@ const BaseDialog = forwardRef(
|
|
|
14044
13821
|
);
|
|
14045
13822
|
}
|
|
14046
13823
|
);
|
|
14047
|
-
BaseDialog.defaultProps = defaultProps$
|
|
13824
|
+
BaseDialog.defaultProps = defaultProps$E;
|
|
14048
13825
|
BaseDialog.displayName = "NutDialog";
|
|
14049
|
-
const defaultProps$
|
|
13826
|
+
const defaultProps$D = {
|
|
14050
13827
|
...ComponentDefaults,
|
|
14051
13828
|
attract: false,
|
|
14052
13829
|
direction: void 0,
|
|
@@ -14060,7 +13837,7 @@ const defaultProps$C = {
|
|
|
14060
13837
|
};
|
|
14061
13838
|
const Drag = (props) => {
|
|
14062
13839
|
const { attract, direction, boundary, children, className, style, ...reset } = {
|
|
14063
|
-
...defaultProps$
|
|
13840
|
+
...defaultProps$D,
|
|
14064
13841
|
...props
|
|
14065
13842
|
};
|
|
14066
13843
|
const classPrefix2 = "nut-drag";
|
|
@@ -14157,14 +13934,14 @@ const Drag = (props) => {
|
|
|
14157
13934
|
}
|
|
14158
13935
|
);
|
|
14159
13936
|
};
|
|
14160
|
-
Drag.defaultProps = defaultProps$
|
|
13937
|
+
Drag.defaultProps = defaultProps$D;
|
|
14161
13938
|
Drag.displayName = "NutDrag";
|
|
14162
13939
|
const defaultStatus = {
|
|
14163
13940
|
empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
|
|
14164
13941
|
error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
|
|
14165
13942
|
network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
|
|
14166
13943
|
};
|
|
14167
|
-
const defaultProps$
|
|
13944
|
+
const defaultProps$C = {
|
|
14168
13945
|
...ComponentDefaults,
|
|
14169
13946
|
description: "",
|
|
14170
13947
|
imageSize: "",
|
|
@@ -14173,7 +13950,7 @@ const defaultProps$B = {
|
|
|
14173
13950
|
const classPrefix$6 = `nut-empty`;
|
|
14174
13951
|
const Empty = (props) => {
|
|
14175
13952
|
const { locale } = useConfig$1();
|
|
14176
|
-
defaultProps$
|
|
13953
|
+
defaultProps$C.description = locale.noData || defaultProps$C.description;
|
|
14177
13954
|
const {
|
|
14178
13955
|
image,
|
|
14179
13956
|
imageSize,
|
|
@@ -14183,7 +13960,7 @@ const Empty = (props) => {
|
|
|
14183
13960
|
status,
|
|
14184
13961
|
...rest
|
|
14185
13962
|
} = {
|
|
14186
|
-
...defaultProps$
|
|
13963
|
+
...defaultProps$C,
|
|
14187
13964
|
...props
|
|
14188
13965
|
};
|
|
14189
13966
|
const [imgStyle, setImgStyle] = useState({});
|
|
@@ -14212,9 +13989,9 @@ const Empty = (props) => {
|
|
|
14212
13989
|
children
|
|
14213
13990
|
] }) });
|
|
14214
13991
|
};
|
|
14215
|
-
Empty.defaultProps = defaultProps$
|
|
13992
|
+
Empty.defaultProps = defaultProps$C;
|
|
14216
13993
|
Empty.displayName = "NutEmpty";
|
|
14217
|
-
const defaultProps$
|
|
13994
|
+
const defaultProps$B = {
|
|
14218
13995
|
...ComponentDefaults,
|
|
14219
13996
|
hasMore: true,
|
|
14220
13997
|
upperThreshold: 40,
|
|
@@ -14244,7 +14021,7 @@ const Infiniteloading = (props) => {
|
|
|
14244
14021
|
onLoadMore,
|
|
14245
14022
|
onScrollChange
|
|
14246
14023
|
} = {
|
|
14247
|
-
...defaultProps$
|
|
14024
|
+
...defaultProps$B,
|
|
14248
14025
|
...props
|
|
14249
14026
|
};
|
|
14250
14027
|
const [isInfiniting, setIsInfiniting] = useState(false);
|
|
@@ -14367,9 +14144,9 @@ const Infiniteloading = (props) => {
|
|
|
14367
14144
|
}
|
|
14368
14145
|
);
|
|
14369
14146
|
};
|
|
14370
|
-
Infiniteloading.defaultProps = defaultProps$
|
|
14147
|
+
Infiniteloading.defaultProps = defaultProps$B;
|
|
14371
14148
|
Infiniteloading.displayName = "NutInfiniteloading";
|
|
14372
|
-
const defaultProps$
|
|
14149
|
+
const defaultProps$A = {
|
|
14373
14150
|
...ComponentDefaults,
|
|
14374
14151
|
// 滚动方向 across 横向 vertical 纵向
|
|
14375
14152
|
direction: "across",
|
|
@@ -14414,7 +14191,7 @@ const NoticeBar = (props) => {
|
|
|
14414
14191
|
onClick,
|
|
14415
14192
|
onClickItem
|
|
14416
14193
|
} = {
|
|
14417
|
-
...defaultProps$
|
|
14194
|
+
...defaultProps$A,
|
|
14418
14195
|
...props
|
|
14419
14196
|
};
|
|
14420
14197
|
const wrap = useRef(null);
|
|
@@ -14820,9 +14597,9 @@ const NoticeBar = (props) => {
|
|
|
14820
14597
|
) : null
|
|
14821
14598
|
] });
|
|
14822
14599
|
};
|
|
14823
|
-
NoticeBar.defaultProps = defaultProps$
|
|
14600
|
+
NoticeBar.defaultProps = defaultProps$A;
|
|
14824
14601
|
NoticeBar.displayName = "NutNoticeBar";
|
|
14825
|
-
const defaultProps$
|
|
14602
|
+
const defaultProps$z = {
|
|
14826
14603
|
id: "",
|
|
14827
14604
|
msg: "",
|
|
14828
14605
|
color: "",
|
|
@@ -14856,7 +14633,7 @@ const Notify = (props) => {
|
|
|
14856
14633
|
onClosed,
|
|
14857
14634
|
onClick,
|
|
14858
14635
|
...rest
|
|
14859
|
-
} = { ...defaultProps$
|
|
14636
|
+
} = { ...defaultProps$z, ...props };
|
|
14860
14637
|
let timer;
|
|
14861
14638
|
const [showNotify, SetShow] = useState(false);
|
|
14862
14639
|
useEffect(() => {
|
|
@@ -14924,7 +14701,7 @@ const Notify = (props) => {
|
|
|
14924
14701
|
}
|
|
14925
14702
|
) });
|
|
14926
14703
|
};
|
|
14927
|
-
Notify.defaultProps = defaultProps$
|
|
14704
|
+
Notify.defaultProps = defaultProps$z;
|
|
14928
14705
|
Notify.displayName = "NutNotify";
|
|
14929
14706
|
function fillRef(ref, node) {
|
|
14930
14707
|
if (typeof ref === "function") {
|
|
@@ -14968,7 +14745,7 @@ class Trigger extends React__default.Component {
|
|
|
14968
14745
|
return trigger;
|
|
14969
14746
|
}
|
|
14970
14747
|
}
|
|
14971
|
-
const defaultProps$
|
|
14748
|
+
const defaultProps$y = {
|
|
14972
14749
|
...ComponentDefaults,
|
|
14973
14750
|
list: [],
|
|
14974
14751
|
theme: "light",
|
|
@@ -14995,7 +14772,7 @@ const Popover = (props) => {
|
|
|
14995
14772
|
onChoose,
|
|
14996
14773
|
...reset
|
|
14997
14774
|
} = {
|
|
14998
|
-
...defaultProps$
|
|
14775
|
+
...defaultProps$y,
|
|
14999
14776
|
...props
|
|
15000
14777
|
};
|
|
15001
14778
|
const goodItem = useRef(null);
|
|
@@ -15098,7 +14875,7 @@ const Popover = (props) => {
|
|
|
15098
14875
|
) : null
|
|
15099
14876
|
] });
|
|
15100
14877
|
};
|
|
15101
|
-
Popover.defaultProps = defaultProps$
|
|
14878
|
+
Popover.defaultProps = defaultProps$y;
|
|
15102
14879
|
Popover.displayName = "NutPopover";
|
|
15103
14880
|
function clamp$1(v, min, max) {
|
|
15104
14881
|
return Math.max(min, Math.min(v, max));
|
|
@@ -19690,7 +19467,7 @@ function rubberbandIfOutOfBounds(position, min, max, dimension, constant = 0.15)
|
|
|
19690
19467
|
return position;
|
|
19691
19468
|
}
|
|
19692
19469
|
const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
|
|
19693
|
-
const defaultProps$
|
|
19470
|
+
const defaultProps$x = {
|
|
19694
19471
|
pullingText: "",
|
|
19695
19472
|
canReleaseText: "",
|
|
19696
19473
|
refreshingText: "",
|
|
@@ -19705,7 +19482,7 @@ const defaultProps$w = {
|
|
|
19705
19482
|
const PullToRefresh = (p) => {
|
|
19706
19483
|
const { locale } = useConfig$1();
|
|
19707
19484
|
const props = {
|
|
19708
|
-
...defaultProps$
|
|
19485
|
+
...defaultProps$x,
|
|
19709
19486
|
...p,
|
|
19710
19487
|
...{
|
|
19711
19488
|
pullingText: p.pullingText || locale.pullToRefresh.pullingText,
|
|
@@ -19842,10 +19619,10 @@ const PullToRefresh = (p) => {
|
|
|
19842
19619
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-pulltorefresh-content", children: props.children })
|
|
19843
19620
|
] });
|
|
19844
19621
|
};
|
|
19845
|
-
PullToRefresh.defaultProps = defaultProps$
|
|
19622
|
+
PullToRefresh.defaultProps = defaultProps$x;
|
|
19846
19623
|
PullToRefresh.displayName = "NutPullToRefresh";
|
|
19847
19624
|
const AvatarContext = createContext({});
|
|
19848
|
-
const defaultProps$
|
|
19625
|
+
const defaultProps$w = {
|
|
19849
19626
|
...ComponentDefaults,
|
|
19850
19627
|
size: "",
|
|
19851
19628
|
shape: "round",
|
|
@@ -19875,7 +19652,7 @@ const Avatar = (props) => {
|
|
|
19875
19652
|
onError,
|
|
19876
19653
|
...rest
|
|
19877
19654
|
} = {
|
|
19878
|
-
...defaultProps$
|
|
19655
|
+
...defaultProps$w,
|
|
19879
19656
|
...props
|
|
19880
19657
|
};
|
|
19881
19658
|
const [maxSum, setMaxSum] = useState(0);
|
|
@@ -19964,9 +19741,9 @@ const Avatar = (props) => {
|
|
|
19964
19741
|
}
|
|
19965
19742
|
) });
|
|
19966
19743
|
};
|
|
19967
|
-
Avatar.defaultProps = defaultProps$
|
|
19744
|
+
Avatar.defaultProps = defaultProps$w;
|
|
19968
19745
|
Avatar.displayName = "NutAvatar";
|
|
19969
|
-
const defaultProps$
|
|
19746
|
+
const defaultProps$v = {
|
|
19970
19747
|
width: "100px",
|
|
19971
19748
|
height: "100px",
|
|
19972
19749
|
row: 1,
|
|
@@ -19994,7 +19771,7 @@ const Skeleton = (props) => {
|
|
|
19994
19771
|
avatarShape,
|
|
19995
19772
|
...restProps
|
|
19996
19773
|
} = {
|
|
19997
|
-
...defaultProps$
|
|
19774
|
+
...defaultProps$v,
|
|
19998
19775
|
...props
|
|
19999
19776
|
};
|
|
20000
19777
|
const b2 = cn("skeleton");
|
|
@@ -20051,7 +19828,7 @@ const Skeleton = (props) => {
|
|
|
20051
19828
|
] })
|
|
20052
19829
|
] }) });
|
|
20053
19830
|
};
|
|
20054
|
-
Skeleton.defaultProps = defaultProps$
|
|
19831
|
+
Skeleton.defaultProps = defaultProps$v;
|
|
20055
19832
|
Skeleton.displayName = "NutSkeleton";
|
|
20056
19833
|
function preventDefault(event, isStopPropagation) {
|
|
20057
19834
|
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
@@ -20061,7 +19838,7 @@ function preventDefault(event, isStopPropagation) {
|
|
|
20061
19838
|
event.stopPropagation();
|
|
20062
19839
|
}
|
|
20063
19840
|
}
|
|
20064
|
-
const defaultProps$
|
|
19841
|
+
const defaultProps$u = {
|
|
20065
19842
|
name: ""
|
|
20066
19843
|
};
|
|
20067
19844
|
const Swipe = forwardRef((props, instanceRef) => {
|
|
@@ -20080,7 +19857,7 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
20080
19857
|
};
|
|
20081
19858
|
nextTick(() => getWidth());
|
|
20082
19859
|
});
|
|
20083
|
-
const { children, className, style } = { ...defaultProps$
|
|
19860
|
+
const { children, className, style } = { ...defaultProps$u, ...props };
|
|
20084
19861
|
const root2 = useRef();
|
|
20085
19862
|
const opened = useRef(false);
|
|
20086
19863
|
const lockClick = useRef(false);
|
|
@@ -20240,8 +20017,156 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
20240
20017
|
}
|
|
20241
20018
|
);
|
|
20242
20019
|
});
|
|
20243
|
-
Swipe.defaultProps = defaultProps$
|
|
20020
|
+
Swipe.defaultProps = defaultProps$u;
|
|
20244
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";
|
|
20245
20170
|
const defaultProps$s = {
|
|
20246
20171
|
...ComponentDefaults,
|
|
20247
20172
|
type: "shake",
|
|
@@ -20530,9 +20455,11 @@ const Audio = (props) => {
|
|
|
20530
20455
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("progress-bar-wrapper"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
20531
20456
|
Range,
|
|
20532
20457
|
{
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20458
|
+
value: percent,
|
|
20459
|
+
onChange: (val) => setPercent(val),
|
|
20460
|
+
currentDescription: null,
|
|
20461
|
+
maxDescription: null,
|
|
20462
|
+
minDescription: null,
|
|
20536
20463
|
"inactive-color": "#cccccc",
|
|
20537
20464
|
"active-color": "#fa2c19"
|
|
20538
20465
|
}
|