@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/esm/Audio.js +7 -6
  3. package/dist/esm/Cascader.js +2 -2
  4. package/dist/esm/ImagePreview.js +1 -1
  5. package/dist/esm/Range/style/index.js +1 -1
  6. package/dist/esm/Range.js +5 -7
  7. package/dist/esm/Step.js +1 -1
  8. package/dist/esm/Steps.js +1 -1
  9. package/dist/esm/Swiper.js +1 -1
  10. package/dist/esm/SwiperItem.js +1 -1
  11. package/dist/esm/Tabs.js +1 -1
  12. package/dist/esm/{audio.taro-ec96ef80.js → audio.taro-bbd39f93.js} +2 -2
  13. package/dist/esm/{cascader.taro-0a2694ed.js → cascader.taro-fb7a0230.js} +21 -13
  14. package/dist/esm/nutui-react.es.js +5 -5
  15. package/dist/esm/range.taro-615e193a.js +259 -0
  16. package/dist/esm/step.taro-3bc01c0c.js +1 -1
  17. package/dist/esm/steps.taro-77e301ab.js +1 -1
  18. package/dist/esm/swiper.taro-74cf9306.js +1 -1
  19. package/dist/esm/swiperitem-80df464a.js +1 -1
  20. package/dist/esm/{tabs.taro-b75f20ff.js → tabs.taro-66164782.js} +8 -1
  21. package/dist/locales/base.js +1 -1
  22. package/dist/locales/en-US.js +1 -1
  23. package/dist/locales/id-ID.js +1 -1
  24. package/dist/locales/zh-CN.js +1 -1
  25. package/dist/locales/zh-TW.js +1 -1
  26. package/dist/locales/zh-UG.js +1 -1
  27. package/dist/nutui.react.mjs +408 -483
  28. package/dist/nutui.react.umd.js +408 -483
  29. package/dist/packages/range/range.scss +24 -49
  30. package/dist/style.css +1 -1
  31. package/dist/style.mjs +1 -1
  32. package/dist/styles/variables-jmapp.scss +11 -17
  33. package/dist/styles/variables.scss +11 -14
  34. package/dist/types/index.d.ts +20 -26
  35. package/package.json +1 -1
  36. package/dist/esm/range.taro-52cda918.js +0 -325
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react-taro v2.0.0-alpha.7 Fri May 12 2023 15:36:41 GMT+0800 (China Standard Time)
11
+ * @nutui/nutui-react-taro v2.0.0-alpha.8 Fri May 12 2023 19:09:01 GMT+0800 (China Standard Time)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -6771,6 +6771,10 @@ var __publicField = (obj, key, value) => {
6771
6771
  );
6772
6772
  return children ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes, children: !disabled && children }) : null;
6773
6773
  };
6774
+ function useForceUpdate$1() {
6775
+ const [, updateState] = React.useState();
6776
+ return React.useCallback(() => updateState({}), []);
6777
+ }
6774
6778
  const defaultProps$17 = {
6775
6779
  ...ComponentDefaults,
6776
6780
  tabStyle: {},
@@ -6826,6 +6830,7 @@ var __publicField = (obj, key, value) => {
6826
6830
  return titles2;
6827
6831
  };
6828
6832
  const titles = React.useRef(getTitles());
6833
+ const forceUpdate = useForceUpdate$1();
6829
6834
  React.useEffect(() => {
6830
6835
  titles.current = getTitles();
6831
6836
  let current = "";
@@ -6834,8 +6839,10 @@ var __publicField = (obj, key, value) => {
6834
6839
  current = value;
6835
6840
  }
6836
6841
  });
6837
- if (current !== "") {
6842
+ if (current !== "" && current !== value) {
6838
6843
  setValue(current);
6844
+ } else {
6845
+ forceUpdate();
6839
6846
  }
6840
6847
  }, [children]);
6841
6848
  const classes = classNames(
@@ -8767,7 +8774,6 @@ var __publicField = (obj, key, value) => {
8767
8774
  popup: true,
8768
8775
  visible: false,
8769
8776
  options: [],
8770
- value: [],
8771
8777
  title: "",
8772
8778
  optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
8773
8779
  format: {},
@@ -8782,8 +8788,7 @@ var __publicField = (obj, key, value) => {
8782
8788
  onChange: () => {
8783
8789
  },
8784
8790
  onPathChange: () => {
8785
- },
8786
- ...Popup.defaultProps
8791
+ }
8787
8792
  };
8788
8793
  const InternalCascader = (props, ref) => {
8789
8794
  const {
@@ -8793,6 +8798,7 @@ var __publicField = (obj, key, value) => {
8793
8798
  visible,
8794
8799
  options,
8795
8800
  value,
8801
+ defaultValue,
8796
8802
  title,
8797
8803
  optionKey: optionKey2,
8798
8804
  format: format2,
@@ -8808,6 +8814,15 @@ var __publicField = (obj, key, value) => {
8808
8814
  const [tabvalue, setTabvalue] = React.useState("c1");
8809
8815
  const [optionsData, setOptionsData] = React.useState([]);
8810
8816
  const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
8817
+ const [innerValue, setInnerValue] = usePropsValue({
8818
+ value,
8819
+ defaultValue,
8820
+ finalValue: defaultValue,
8821
+ onChange: (val) => {
8822
+ var _a;
8823
+ (_a = props.onChange) == null ? void 0 : _a.call(props, val);
8824
+ }
8825
+ });
8811
8826
  const [state] = React.useState({
8812
8827
  optionsData: [],
8813
8828
  panes: [
@@ -8817,7 +8832,6 @@ var __publicField = (obj, key, value) => {
8817
8832
  paneKey: ""
8818
8833
  }
8819
8834
  ],
8820
- innerValue: value,
8821
8835
  tree: new Tree$1([], {}),
8822
8836
  tabsCursor: 0,
8823
8837
  // 选中的tab项
@@ -8837,12 +8851,12 @@ var __publicField = (obj, key, value) => {
8837
8851
  });
8838
8852
  React.useEffect(() => {
8839
8853
  initData();
8840
- }, [options]);
8854
+ }, [options, format2]);
8841
8855
  React.useEffect(() => {
8842
- if (value !== state.innerValue) {
8843
- state.innerValue = value;
8856
+ if (defaultValue && defaultValue !== innerValue) {
8857
+ setInnerValue(defaultValue);
8844
8858
  }
8845
- }, [value]);
8859
+ }, [defaultValue]);
8846
8860
  const initData = async () => {
8847
8861
  state.lazyLoadMap.clear();
8848
8862
  if (format2 && Object.keys(format2).length > 0) {
@@ -8877,24 +8891,24 @@ var __publicField = (obj, key, value) => {
8877
8891
  setOptionsData(state.panes);
8878
8892
  };
8879
8893
  const syncValue = async () => {
8880
- const currentValue2 = state.innerValue;
8881
- if (currentValue2 === void 0 || !state.tree.nodes.length) {
8894
+ const currentValue = innerValue;
8895
+ if (currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length) {
8882
8896
  return;
8883
8897
  }
8884
- if (currentValue2.length === 0) {
8898
+ if (currentValue.length === 0) {
8885
8899
  state.tabsCursor = 0;
8886
8900
  return;
8887
8901
  }
8888
- let needToSync = currentValue2;
8889
- if (isLazy() && Array.isArray(currentValue2) && currentValue2.length) {
8902
+ let needToSync = currentValue;
8903
+ if (isLazy() && Array.isArray(currentValue) && currentValue.length) {
8890
8904
  needToSync = [];
8891
8905
  const parent = state.tree.nodes.find(
8892
- (node) => node.value === currentValue2[0]
8906
+ (node) => node.value === currentValue[0]
8893
8907
  );
8894
8908
  if (parent) {
8895
8909
  needToSync = [parent.value];
8896
8910
  state.initLoading = true;
8897
- const last = await currentValue2.slice(1).reduce(async (p, value2) => {
8911
+ const last = await currentValue.slice(1).reduce(async (p, value2) => {
8898
8912
  var _a;
8899
8913
  const parent2 = await p;
8900
8914
  await invokeLazyLoad(parent2);
@@ -8910,7 +8924,7 @@ var __publicField = (obj, key, value) => {
8910
8924
  state.initLoading = false;
8911
8925
  }
8912
8926
  }
8913
- if (needToSync.length && currentValue2 === value) {
8927
+ if (needToSync.length && currentValue === defaultValue) {
8914
8928
  const pathNodes = state.tree.getPathNodesByValue(needToSync);
8915
8929
  pathNodes.forEach((node, index) => {
8916
8930
  state.tabsCursor = index;
@@ -8967,6 +8981,7 @@ var __publicField = (obj, key, value) => {
8967
8981
  const optionParams = pathNodes.map((item) => item.value);
8968
8982
  onChange(optionParams, pathNodes);
8969
8983
  onPathChange(optionParams, pathNodes);
8984
+ setInnerValue(optionParams);
8970
8985
  }
8971
8986
  setOptionsData(state.panes);
8972
8987
  close();
@@ -9660,7 +9675,7 @@ var __publicField = (obj, key, value) => {
9660
9675
  (_a = props.onConfirm) == null ? void 0 : _a.call(props, setSelectedOptions(), val);
9661
9676
  }
9662
9677
  });
9663
- const [currentValue2, setCurrentValue] = React.useState([]);
9678
+ const [currentValue, setCurrentValue] = React.useState([]);
9664
9679
  const [columnIndex, setColumnIndex] = React.useState(0);
9665
9680
  const pickerRef = React.useRef(null);
9666
9681
  const [refs, setRefs] = useRefs();
@@ -9850,7 +9865,7 @@ var __publicField = (obj, key, value) => {
9850
9865
  setPickingStatus(false);
9851
9866
  };
9852
9867
  const pickerChange = (data) => {
9853
- const prevDefaultValue = currentValue2;
9868
+ const prevDefaultValue = currentValue;
9854
9869
  let changeIndex = 0;
9855
9870
  const list = data.detail.value;
9856
9871
  for (let i = 0, len = list.length; i < len; i++) {
@@ -9893,7 +9908,7 @@ var __publicField = (obj, key, value) => {
9893
9908
  components.PickerView,
9894
9909
  {
9895
9910
  ref: pickerRef,
9896
- value: currentValue2,
9911
+ value: currentValue,
9897
9912
  immediateChange: true,
9898
9913
  onPickStart: pickerStart,
9899
9914
  onChange: pickerChange,
@@ -11740,289 +11755,103 @@ var __publicField = (obj, key, value) => {
11740
11755
  Radio.displayName = "NutRadio";
11741
11756
  Radio.RadioGroup = RadioGroup;
11742
11757
  const defaultProps$O = {
11743
- id: "",
11744
- style: {},
11745
- icon: null,
11746
- iconSize: "20",
11747
- msg: "",
11748
- bottom: "30px",
11749
- // center为false时生效,距离底部位置
11750
- duration: 2,
11751
- // 时长,duration为0则一直展示
11752
- center: true,
11753
- // toast是否居中展示
11754
- type: "text",
11755
- title: "",
11756
- customClass: "",
11757
- // 自定义样式名
11758
- size: "base",
11759
- // 设置字体大小,默认base,可选large\small\base
11760
- textAlignCenter: true,
11761
- // 文字是否居中显示,true为居中,false为left
11762
- bgColor: "rgba(0, 0, 0, .8)",
11763
- cover: false,
11764
- // 是否展示透明遮罩层
11765
- coverColor: "rgba(0, 0, 0, 0)",
11766
- // 遮罩颜色设定
11767
- closeOnClickOverlay: false,
11768
- // 是否点击遮罩可关闭
11769
- visible: false,
11770
- onClose: () => {
11771
- }
11772
- // 未实现
11773
- };
11774
- const Toast = (props) => {
11775
- const {
11776
- children,
11777
- id,
11778
- style,
11779
- icon,
11780
- iconSize,
11781
- msg,
11782
- bottom,
11783
- duration,
11784
- center,
11785
- type,
11786
- title,
11787
- customClass,
11788
- size,
11789
- textAlignCenter,
11790
- bgColor,
11791
- cover,
11792
- coverColor,
11793
- closeOnClickOverlay,
11794
- visible,
11795
- onClose,
11796
- ...rest
11797
- } = { ...defaultProps$O, ...props };
11798
- let timer;
11799
- const [openState, SetOpenState] = React.useState(false);
11800
- React.useEffect(() => {
11801
- if (visible) {
11802
- SetOpenState(true);
11803
- show();
11804
- } else {
11805
- hide();
11806
- }
11807
- }, [visible]);
11808
- const clearTimer = () => {
11809
- if (timer) {
11810
- clearTimeout(timer);
11811
- timer = null;
11812
- }
11813
- };
11814
- const hide = () => {
11815
- SetOpenState(false);
11816
- onClose();
11817
- };
11818
- const show = () => {
11819
- clearTimer();
11820
- if (duration) {
11821
- timer = window.setTimeout(() => {
11822
- hide();
11823
- }, duration * 1e3);
11824
- }
11825
- };
11826
- const clickCover = () => {
11827
- if (closeOnClickOverlay) {
11828
- hide();
11829
- }
11830
- };
11831
- const toastBem = cn("toast");
11832
- const hasIcon = () => {
11833
- if (type !== "text") {
11834
- return true;
11835
- }
11836
- return !!icon;
11837
- };
11838
- const iconName = () => {
11839
- if (icon) {
11840
- return icon;
11841
- }
11842
- return {
11843
- success: /* @__PURE__ */ jsxRuntimeExports.jsx(a$4, { color: "#ffffff", width: iconSize, height: iconSize }),
11844
- fail: /* @__PURE__ */ jsxRuntimeExports.jsx(a$l, { color: "#ffffff", width: iconSize, height: iconSize }),
11845
- warn: /* @__PURE__ */ jsxRuntimeExports.jsx(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
11846
- loading: /* @__PURE__ */ jsxRuntimeExports.jsx(r$f, { color: "#ffffff", width: iconSize, height: iconSize })
11847
- }[type];
11848
- };
11849
- const classes = classNames({
11850
- "nut-toast-center": center,
11851
- "nut-toast-has-icon": icon,
11852
- "nut-toast-cover": cover,
11853
- "nut-toast-loading": type === "loading",
11854
- [`${customClass}`]: true,
11855
- [`nut-toast-${size}`]: true
11856
- });
11857
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: openState ? /* @__PURE__ */ jsxRuntimeExports.jsx(
11858
- "div",
11859
- {
11860
- className: `${toastBem()} ${classes}`,
11861
- id,
11862
- style: {
11863
- bottom: center ? "auto" : `${bottom}`,
11864
- backgroundColor: cover ? coverColor : "",
11865
- ...style
11866
- },
11867
- onClick: () => {
11868
- clickCover();
11869
- },
11870
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
11871
- "div",
11872
- {
11873
- className: toastBem("inner"),
11874
- style: {
11875
- textAlign: textAlignCenter ? "center" : "left",
11876
- backgroundColor: bgColor
11877
- },
11878
- children: [
11879
- hasIcon() ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: toastBem("icon-wrapper"), children: iconName() }) : null,
11880
- title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-toast-title", children: title }) : null,
11881
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: toastBem("text"), children: msg })
11882
- ]
11883
- }
11884
- )
11885
- }
11886
- ) : null });
11887
- };
11888
- Toast.defaultProps = defaultProps$O;
11889
- Toast.displayName = "NutToast";
11890
- const defaultProps$N = {
11758
+ ...ComponentDefaults,
11891
11759
  range: false,
11892
- hiddenRange: false,
11893
- hiddenTag: false,
11894
11760
  min: 0,
11895
11761
  max: 100,
11896
11762
  step: 1,
11897
- modelValue: 0,
11898
11763
  vertical: false,
11899
11764
  marks: {}
11900
11765
  };
11901
- let startValue;
11902
- let currentValue;
11903
11766
  const Range = (props) => {
11904
- const { locale } = useConfig$1();
11905
11767
  const {
11906
11768
  className,
11907
11769
  range,
11908
11770
  disabled,
11909
- activeColor,
11910
- inactiveColor,
11911
- buttonColor,
11912
- hiddenRange,
11913
- hiddenTag,
11914
- modelValue,
11915
11771
  button,
11916
11772
  vertical,
11917
11773
  marks,
11918
- dragStart,
11919
- dragEnd,
11920
11774
  onChange,
11921
- onDragStart,
11922
- onDragEnd,
11923
- minDesc,
11924
- maxDesc,
11925
- curValueDesc
11926
- } = { ...defaultProps$N, ...props };
11927
- let { min, max, step } = { ...defaultProps$N, ...props };
11928
- min = Number(min);
11929
- max = Number(max);
11930
- step = Number(step);
11931
- const [buttonIndex, SetButtonIndex] = React.useState(0);
11932
- const [initValue, SetInitValue] = React.useState();
11933
- const [dragStatus, SetDragStatus] = React.useState("start");
11775
+ onStart,
11776
+ onEnd,
11777
+ minDescription,
11778
+ maxDescription,
11779
+ currentDescription,
11780
+ min,
11781
+ max,
11782
+ step,
11783
+ value,
11784
+ defaultValue
11785
+ } = { ...defaultProps$O, ...props };
11786
+ const classPrefix2 = "nut-range";
11787
+ const [buttonIndex, setButtonIndex] = React.useState(0);
11788
+ const [dragStatus, setDragStatus] = React.useState("start");
11934
11789
  const touch = useTouch();
11935
11790
  const root2 = React.useRef(null);
11936
- const [marksList, SetMarksList] = React.useState([]);
11937
- const [show, SetShow] = React.useState(false);
11938
- const [toastMsg, SetToastMsg] = React.useState("");
11939
- const toastShow = (msg) => {
11940
- SetToastMsg(msg);
11941
- SetShow(true);
11791
+ const [marksList, setMarksList] = React.useState([]);
11792
+ const [startValue, setStartValue] = React.useState(0);
11793
+ const handleChange = (value2) => {
11794
+ onChange && onChange(value2);
11942
11795
  };
11943
- React.useEffect(() => {
11944
- if (typeof modelValue === "number") {
11945
- if (!range && (modelValue < min || modelValue > max)) {
11946
- SetInitValue(0);
11947
- toastShow(`${modelValue} ${locale.range.rangeText}`);
11948
- return;
11949
- }
11950
- SetInitValue(modelValue);
11951
- }
11952
- }, [modelValue]);
11796
+ const [current, setCurrent] = usePropsValue({
11797
+ value,
11798
+ defaultValue,
11799
+ finalValue: 0,
11800
+ onChange: handleChange
11801
+ });
11802
+ const [exactValue, setEaxctValue] = React.useState(
11803
+ () => value || defaultValue || 0
11804
+ );
11953
11805
  React.useEffect(() => {
11954
11806
  if (marks) {
11955
11807
  const marksKeys = Object.keys(marks);
11956
11808
  const list = marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point >= min && point <= max);
11957
- SetMarksList(list);
11809
+ setMarksList(list);
11958
11810
  }
11959
11811
  }, [marks]);
11960
11812
  const scope = () => {
11961
- return Number(max) - Number(min);
11813
+ return max - min;
11962
11814
  };
11963
- const classes = React.useCallback(() => {
11964
- const prefixCls2 = "nut-range";
11965
- return [
11966
- prefixCls2,
11967
- `${disabled ? `${prefixCls2}-disabled` : ""}`,
11968
- `${vertical ? `${prefixCls2}-vertical` : ""}`,
11969
- `${!hiddenRange ? `${prefixCls2}-show-number` : ""}`
11970
- ].filter(Boolean).join(" ");
11971
- }, [disabled, vertical, hiddenRange]);
11972
- const containerClasses = React.useCallback(() => {
11973
- const prefixCls2 = "nut-range-container";
11974
- return [prefixCls2, `${vertical ? `${prefixCls2}-vertical` : ""}`, className].filter(Boolean).join(" ");
11975
- }, [vertical, className]);
11815
+ const classes = classNames(classPrefix2, {
11816
+ [`${classPrefix2}-disabled`]: disabled,
11817
+ [`${classPrefix2}-vertical`]: vertical
11818
+ });
11819
+ const containerClasses = classNames(`${classPrefix2}-container`, className, {
11820
+ [`${classPrefix2}-container-vertical`]: vertical
11821
+ });
11976
11822
  const markClassName = React.useCallback(
11977
11823
  (mark) => {
11978
- const classPrefix2 = "nut-range-mark";
11979
- let lowerBound = Number(min);
11980
- let upperBound = Number(max);
11981
- if (range) {
11982
- const [left, right] = modelValue;
11983
- lowerBound = left;
11984
- upperBound = right;
11824
+ const classPrefix22 = "nut-range-mark";
11825
+ let lowerBound = min;
11826
+ let upperBound = max;
11827
+ if (range && Array.isArray(current)) {
11828
+ lowerBound = current[0];
11829
+ upperBound = current[1];
11985
11830
  } else {
11986
- upperBound = modelValue;
11831
+ upperBound = current;
11987
11832
  }
11988
11833
  const isActive = mark <= upperBound && mark >= lowerBound;
11989
11834
  return [
11990
- `${classPrefix2}-text`,
11991
- `${isActive ? `${classPrefix2}-text-active` : ""}`
11992
- ].filter(Boolean).join(" ");
11835
+ `${classPrefix22}-text`,
11836
+ `${isActive ? `${classPrefix22}-text-active` : ""}`
11837
+ ].join(" ");
11993
11838
  },
11994
- [range, modelValue, min, max]
11839
+ [range, current, min, max]
11995
11840
  );
11996
- const [rangeName, setRangeName] = React.useState(classes());
11997
- const [containerName, setContainerName] = React.useState(containerClasses());
11998
- React.useEffect(() => {
11999
- setRangeName(classes());
12000
- setContainerName(containerClasses());
12001
- }, [classes, containerClasses]);
12002
- const wrapperStyle = () => {
12003
- return {
12004
- background: inactiveColor
12005
- };
12006
- };
12007
- const buttonStyle = () => {
12008
- return {
12009
- borderColor: buttonColor
12010
- };
12011
- };
12012
11841
  const isRange = (val) => {
12013
11842
  return !!range && Array.isArray(val);
12014
11843
  };
12015
11844
  const calcMainAxis = () => {
12016
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
11845
+ const modelVal = current;
12017
11846
  if (isRange(modelVal)) {
12018
11847
  return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
12019
11848
  }
12020
- return `${(modelVal - Number(min)) * 100 / scope()}%`;
11849
+ return `${(modelVal - min) * 100 / scope()}%`;
12021
11850
  };
12022
11851
  const calcOffset = () => {
12023
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
11852
+ const modelVal = current;
12024
11853
  if (isRange(modelVal)) {
12025
- return `${(modelVal[0] - Number(min)) * 100 / scope()}%`;
11854
+ return `${(modelVal[0] - min) * 100 / scope()}%`;
12026
11855
  }
12027
11856
  return `0%`;
12028
11857
  };
@@ -12031,74 +11860,61 @@ var __publicField = (obj, key, value) => {
12031
11860
  return {
12032
11861
  height: calcMainAxis(),
12033
11862
  top: calcOffset(),
12034
- background: activeColor,
12035
11863
  transition: dragStatus ? "none" : void 0
12036
11864
  };
12037
11865
  }
12038
11866
  return {
12039
11867
  width: calcMainAxis(),
12040
11868
  left: calcOffset(),
12041
- background: activeColor,
12042
11869
  transition: dragStatus ? "none" : void 0
12043
11870
  };
12044
11871
  };
12045
11872
  const marksStyle = (mark) => {
12046
11873
  let style = {
12047
- left: `${(mark - Number(min)) / scope() * 100}%`
11874
+ left: `${(mark - min) / scope() * 100}%`
12048
11875
  };
12049
11876
  if (vertical) {
12050
11877
  style = {
12051
- top: `${(mark - Number(min)) / scope() * 100}%`
11878
+ top: `${(mark - min) / scope() * 100}%`
12052
11879
  };
12053
11880
  }
12054
11881
  return style;
12055
11882
  };
12056
- const tickStyle = (mark) => {
12057
- let lowerBound = Number(min);
12058
- let upperBound = Number(max);
12059
- if (range) {
12060
- const [left, right] = modelValue;
12061
- lowerBound = left;
12062
- upperBound = right;
11883
+ const tickClass = (mark) => {
11884
+ if (range && Array.isArray(current)) {
11885
+ return mark <= current[1] && mark >= current[0];
12063
11886
  }
12064
- const isActive = mark <= upperBound && mark >= lowerBound;
12065
- const style = {
12066
- background: !isActive ? inactiveColor : activeColor
12067
- };
12068
- return style;
11887
+ return mark <= current;
12069
11888
  };
12070
- const format = (value) => {
12071
- value = Math.max(+min, Math.min(value, +max));
12072
- return Math.round(value / +step) * +step;
11889
+ const format = (value2) => {
11890
+ value2 = Math.max(+min, Math.min(value2, +max));
11891
+ return Math.round(value2 / +step) * +step;
12073
11892
  };
12074
11893
  const isSameValue = (newValue, oldValue) => {
12075
11894
  return JSON.stringify(newValue) === JSON.stringify(oldValue);
12076
11895
  };
12077
- const handleOverlap = (value) => {
12078
- if (value[0] > value[1]) {
12079
- return value.slice(0).reverse();
11896
+ const handleOverlap = (value2) => {
11897
+ if (value2[0] > value2[1]) {
11898
+ return value2.slice(0).reverse();
12080
11899
  }
12081
- return value;
11900
+ return value2;
12082
11901
  };
12083
- const updateValue = (value, end) => {
12084
- if (isRange(value)) {
12085
- value = handleOverlap(value).map(format);
11902
+ const updateValue = (value2, end) => {
11903
+ if (isRange(value2)) {
11904
+ value2 = handleOverlap(value2).map(format);
12086
11905
  } else {
12087
- value = format(value);
12088
- }
12089
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
12090
- if (!isSameValue(value, modelVal)) {
12091
- SetInitValue(value);
11906
+ value2 = format(value2);
12092
11907
  }
12093
- if ((marks || end) && !isSameValue(value, startValue)) {
12094
- onChange && onChange(value);
11908
+ if (!isSameValue(value2, current)) {
11909
+ setCurrent(value2);
12095
11910
  }
11911
+ end && onEnd && onEnd(value2);
12096
11912
  };
12097
11913
  const click = async (event) => {
12098
11914
  if (disabled || !root2.current) {
12099
11915
  return;
12100
11916
  }
12101
- SetDragStatus("");
11917
+ setDragStatus("");
12102
11918
  const rect = await getRectByTaro(root2.current);
12103
11919
  let delta = (event.detail.x ? event.detail.x : event.clientX) - rect.left;
12104
11920
  let total = rect.width;
@@ -12106,18 +11922,18 @@ var __publicField = (obj, key, value) => {
12106
11922
  delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
12107
11923
  total = rect.height;
12108
11924
  }
12109
- const value = Number(min) + delta / total * scope();
12110
- currentValue = initValue || initValue === 0 ? initValue : modelValue;
12111
- if (isRange(currentValue)) {
12112
- const [left, right] = currentValue;
11925
+ const value2 = min + delta / total * scope();
11926
+ setEaxctValue(current);
11927
+ if (isRange(current)) {
11928
+ const [left, right] = current;
12113
11929
  const middle = (left + right) / 2;
12114
- if (value <= middle) {
12115
- updateValue([value, right], true);
11930
+ if (value2 <= middle) {
11931
+ updateValue([value2, right], true);
12116
11932
  } else {
12117
- updateValue([left, value], true);
11933
+ updateValue([left, value2], true);
12118
11934
  }
12119
11935
  } else {
12120
- updateValue(value, true);
11936
+ updateValue(value2, true);
12121
11937
  }
12122
11938
  };
12123
11939
  const onTouchStart = (event) => {
@@ -12125,24 +11941,23 @@ var __publicField = (obj, key, value) => {
12125
11941
  return;
12126
11942
  }
12127
11943
  touch.start(event);
12128
- currentValue = initValue || initValue === 0 ? initValue : modelValue;
12129
- if (isRange(currentValue)) {
12130
- startValue = currentValue.map(format);
11944
+ setEaxctValue(current);
11945
+ if (isRange(current)) {
11946
+ setStartValue(current.map(format));
12131
11947
  } else {
12132
- startValue = format(currentValue);
11948
+ setStartValue(format(current));
12133
11949
  }
12134
- SetDragStatus("start");
11950
+ setDragStatus("start");
12135
11951
  };
12136
11952
  const onTouchMove = async (event) => {
12137
11953
  if (disabled || !root2.current) {
12138
11954
  return;
12139
11955
  }
12140
11956
  if (dragStatus === "start") {
12141
- dragStart && dragStart();
12142
- onDragStart && onDragStart();
11957
+ onStart && onStart();
12143
11958
  }
12144
11959
  touch.move(event);
12145
- SetDragStatus("draging");
11960
+ setDragStatus("draging");
12146
11961
  const rect = await getRectByTaro(root2.current);
12147
11962
  let delta = touch.deltaX;
12148
11963
  let total = rect.width;
@@ -12152,137 +11967,97 @@ var __publicField = (obj, key, value) => {
12152
11967
  total = rect.height;
12153
11968
  diff = delta / total * scope();
12154
11969
  }
11970
+ let newValue;
12155
11971
  if (isRange(startValue)) {
12156
- currentValue[buttonIndex] = startValue[buttonIndex] + diff;
11972
+ newValue = exactValue.slice();
11973
+ newValue[buttonIndex] = startValue[buttonIndex] + diff;
12157
11974
  } else {
12158
- currentValue = startValue + diff;
11975
+ newValue = startValue + diff;
12159
11976
  }
12160
- updateValue(currentValue);
11977
+ setEaxctValue(newValue);
11978
+ updateValue(newValue);
12161
11979
  };
12162
11980
  const onTouchEnd = (event) => {
12163
11981
  if (disabled) {
12164
11982
  return;
12165
11983
  }
12166
11984
  if (dragStatus === "draging") {
12167
- updateValue(currentValue, true);
12168
- dragEnd && dragEnd();
12169
- onDragEnd && onDragEnd();
11985
+ updateValue(current, true);
12170
11986
  }
12171
- SetDragStatus("");
11987
+ setDragStatus("");
12172
11988
  };
12173
11989
  const curValue = (idx) => {
12174
- const modelVal = initValue || initValue === 0 ? initValue : modelValue;
12175
- const value = typeof idx === "number" ? modelVal[idx] : modelVal;
12176
- return value;
11990
+ const modelVal = current;
11991
+ const value2 = typeof idx === "number" ? modelVal[idx] : modelVal;
11992
+ return value2;
12177
11993
  };
12178
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${containerName}`, children: [
12179
- !hiddenRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min", children: minDesc || +min }) : null,
12180
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
12181
- "div",
12182
- {
12183
- ref: root2,
12184
- style: wrapperStyle(),
12185
- className: `${rangeName}`,
12186
- onClick: (e) => {
12187
- click(e);
12188
- },
12189
- children: [
12190
- marksList.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-mark", children: marksList.map((marks2) => {
12191
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
12192
- "span",
12193
- {
12194
- className: markClassName(marks2),
12195
- style: marksStyle(marks2),
12196
- children: [
12197
- marks2,
12198
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-range-tick", style: tickStyle(marks2) })
12199
- ]
12200
- },
12201
- marks2
12202
- );
12203
- }) }) : null,
12204
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-bar", style: barStyle(), children: range ? [0, 1].map((item, index) => {
12205
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
12206
- "div",
12207
- {
12208
- role: "slider",
12209
- className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
11994
+ const renderButton = (index) => {
11995
+ 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) }) }) });
11996
+ };
11997
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: containerClasses, children: [
11998
+ minDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min", children: minDescription || min }),
11999
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: root2, className: classes, onClick: (e) => click(e), children: [
12000
+ marksList.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-mark", children: marksList.map((marks2) => {
12001
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
12002
+ "span",
12003
+ {
12004
+ className: markClassName(marks2),
12005
+ style: marksStyle(marks2),
12006
+ children: [
12007
+ marks2,
12008
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
12009
+ "span",
12010
+ {
12011
+ className: classNames("nut-range-tick", {
12012
+ active: tickClass(marks2)
12013
+ })
12014
+ }
12015
+ )
12016
+ ]
12017
+ },
12018
+ marks2
12019
+ );
12020
+ }) }),
12021
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-bar", style: barStyle(), children: range ? [0, 1].map((item, index) => {
12022
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12023
+ "div",
12024
+ {
12025
+ className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
12210
12026
  ${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
12211
- tabIndex: disabled ? -1 : 0,
12212
- "aria-valuemin": +min,
12213
- "aria-valuenow": curValue(index),
12214
- "aria-valuemax": +max,
12215
- "aria-orientation": vertical ? "vertical" : "horizontal",
12216
- onTouchStart: (e) => {
12217
- if (typeof index === "number") {
12218
- SetButtonIndex(index);
12219
- }
12220
- onTouchStart(e);
12221
- },
12222
- onTouchMove: (e) => {
12223
- onTouchMove(e);
12224
- },
12225
- onTouchEnd: (e) => {
12226
- onTouchEnd();
12227
- },
12228
- onTouchCancel: (e) => {
12229
- onTouchEnd();
12230
- },
12231
- onClick: (e) => {
12232
- e.stopPropagation();
12233
- },
12234
- children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", style: buttonStyle(), children: !hiddenTag ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: curValueDesc || curValue(index) }) : null })
12235
- },
12236
- index
12237
- );
12238
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
12239
- "div",
12240
- {
12241
- role: "slider",
12242
- className: "nut-range-button-wrapper",
12243
- tabIndex: disabled ? -1 : 0,
12244
- "aria-valuemin": +min,
12245
- "aria-valuenow": curValue(),
12246
- "aria-valuemax": +max,
12247
- "aria-orientation": vertical ? "vertical" : "horizontal",
12248
- onTouchStart: (e) => {
12249
- onTouchStart(e);
12250
- },
12251
- onTouchMove: (e) => {
12252
- onTouchMove(e);
12253
- },
12254
- onTouchEnd: (e) => {
12255
- onTouchEnd();
12256
- },
12257
- onTouchCancel: (e) => {
12258
- onTouchEnd();
12259
- },
12260
- onClick: (e) => {
12261
- e.stopPropagation();
12262
- },
12263
- children: button || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-range-button", style: buttonStyle(), children: !hiddenTag ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "number", children: curValueDesc || curValue() }) : null })
12264
- }
12265
- ) })
12266
- ]
12267
- }
12268
- ),
12269
- !hiddenRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDesc || +max }) : null,
12270
- /* @__PURE__ */ jsxRuntimeExports.jsx(
12271
- Toast,
12272
- {
12273
- type: "text",
12274
- visible: show,
12275
- msg: toastMsg,
12276
- onClose: () => {
12277
- SetShow(false);
12027
+ onTouchStart: (e) => {
12028
+ if (typeof index === "number") {
12029
+ setButtonIndex(index);
12030
+ }
12031
+ onTouchStart(e);
12032
+ },
12033
+ onTouchMove: (e) => onTouchMove(e),
12034
+ onTouchEnd: (e) => onTouchEnd(),
12035
+ onTouchCancel: (e) => onTouchEnd(),
12036
+ onClick: (e) => e.stopPropagation(),
12037
+ children: renderButton(index)
12038
+ },
12039
+ index
12040
+ );
12041
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
12042
+ components.View,
12043
+ {
12044
+ catchMove: true,
12045
+ className: "nut-range-button-wrapper",
12046
+ onTouchStart: (e) => onTouchStart(e),
12047
+ onTouchMove: (e) => onTouchMove(e),
12048
+ onTouchEnd: (e) => onTouchEnd(),
12049
+ onTouchCancel: (e) => onTouchEnd(),
12050
+ onClick: (e) => e.stopPropagation(),
12051
+ children: renderButton()
12278
12052
  }
12279
- }
12280
- )
12053
+ ) })
12054
+ ] }),
12055
+ maxDescription !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max", children: maxDescription || max })
12281
12056
  ] });
12282
12057
  };
12283
- Range.defaultProps = defaultProps$N;
12058
+ Range.defaultProps = defaultProps$O;
12284
12059
  Range.displayName = "NutRange";
12285
- const defaultProps$M = {
12060
+ const defaultProps$N = {
12286
12061
  ...ComponentDefaults,
12287
12062
  count: 5,
12288
12063
  min: 0,
@@ -12307,7 +12082,7 @@ var __publicField = (obj, key, value) => {
12307
12082
  allowHalf,
12308
12083
  onChange
12309
12084
  } = {
12310
- ...defaultProps$M,
12085
+ ...defaultProps$N,
12311
12086
  ...props
12312
12087
  };
12313
12088
  const classPrefix2 = "nut-rate";
@@ -12392,9 +12167,9 @@ var __publicField = (obj, key, value) => {
12392
12167
  }
12393
12168
  );
12394
12169
  };
12395
- Rate.defaultProps = defaultProps$M;
12170
+ Rate.defaultProps = defaultProps$N;
12396
12171
  Rate.displayName = "NutRate";
12397
- const defaultProps$L = {
12172
+ const defaultProps$M = {
12398
12173
  ...ComponentDefaults,
12399
12174
  placeholder: "",
12400
12175
  shape: "square",
@@ -12442,7 +12217,7 @@ var __publicField = (obj, key, value) => {
12442
12217
  onClickRightinIcon,
12443
12218
  onClickRightoutIcon
12444
12219
  } = {
12445
- ...defaultProps$L,
12220
+ ...defaultProps$M,
12446
12221
  ...props
12447
12222
  };
12448
12223
  const alignClass = `${align}`;
@@ -12628,9 +12403,9 @@ var __publicField = (obj, key, value) => {
12628
12403
  }
12629
12404
  );
12630
12405
  };
12631
- SearchBar.defaultProps = defaultProps$L;
12406
+ SearchBar.defaultProps = defaultProps$M;
12632
12407
  SearchBar.displayName = "NutSearchBar";
12633
- const defaultProps$K = {
12408
+ const defaultProps$L = {
12634
12409
  ...ComponentDefaults,
12635
12410
  title: "",
12636
12411
  description: "",
@@ -12793,9 +12568,9 @@ var __publicField = (obj, key, value) => {
12793
12568
  }
12794
12569
  ) });
12795
12570
  };
12796
- ShortPassword.defaultProps = defaultProps$K;
12571
+ ShortPassword.defaultProps = defaultProps$L;
12797
12572
  ShortPassword.displayName = "NutShortPassword";
12798
- const defaultProps$J = {
12573
+ const defaultProps$K = {
12799
12574
  canvasId: "spcanvas",
12800
12575
  type: "png",
12801
12576
  lineWidth: 2,
@@ -12817,7 +12592,7 @@ var __publicField = (obj, key, value) => {
12817
12592
  onClear,
12818
12593
  ...rest
12819
12594
  } = {
12820
- ...defaultProps$J,
12595
+ ...defaultProps$K,
12821
12596
  ...props
12822
12597
  };
12823
12598
  const b2 = cn("signature");
@@ -12981,9 +12756,9 @@ var __publicField = (obj, key, value) => {
12981
12756
  )
12982
12757
  ] });
12983
12758
  };
12984
- Signature.defaultProps = defaultProps$J;
12759
+ Signature.defaultProps = defaultProps$K;
12985
12760
  Signature.displayName = "NutSignature";
12986
- const defaultProps$I = {
12761
+ const defaultProps$J = {
12987
12762
  ...ComponentDefaults,
12988
12763
  disabled: false,
12989
12764
  activeText: "",
@@ -13000,7 +12775,7 @@ var __publicField = (obj, key, value) => {
13000
12775
  style,
13001
12776
  onChange
13002
12777
  } = {
13003
- ...defaultProps$I,
12778
+ ...defaultProps$J,
13004
12779
  ...props
13005
12780
  };
13006
12781
  const classPrefix2 = "nut-switch";
@@ -13022,9 +12797,9 @@ var __publicField = (obj, key, value) => {
13022
12797
  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 }) })
13023
12798
  ] }) });
13024
12799
  };
13025
- Switch.defaultProps = defaultProps$I;
12800
+ Switch.defaultProps = defaultProps$J;
13026
12801
  Switch.displayName = "NutSwitch";
13027
- const defaultProps$H = {
12802
+ const defaultProps$I = {
13028
12803
  ...ComponentDefaults,
13029
12804
  defaultValue: "",
13030
12805
  showCount: false,
@@ -13052,7 +12827,7 @@ var __publicField = (obj, key, value) => {
13052
12827
  onBlur,
13053
12828
  onFocus,
13054
12829
  ...rest
13055
- } = { ...defaultProps$H, ...props };
12830
+ } = { ...defaultProps$I, ...props };
13056
12831
  const classPrefix2 = "nut-textarea";
13057
12832
  const compositionRef = React.useRef(false);
13058
12833
  const format = (value2) => {
@@ -13134,9 +12909,9 @@ var __publicField = (obj, key, value) => {
13134
12909
  }
13135
12910
  );
13136
12911
  };
13137
- TextArea.defaultProps = defaultProps$H;
12912
+ TextArea.defaultProps = defaultProps$I;
13138
12913
  TextArea.displayName = "NutTextArea";
13139
- const defaultProps$G = {
12914
+ const defaultProps$H = {
13140
12915
  ...ComponentDefaults,
13141
12916
  percent: 0,
13142
12917
  showText: false,
@@ -13155,7 +12930,7 @@ var __publicField = (obj, key, value) => {
13155
12930
  children,
13156
12931
  ...rest
13157
12932
  } = {
13158
- ...defaultProps$G,
12933
+ ...defaultProps$H,
13159
12934
  ...props
13160
12935
  };
13161
12936
  const classPrefix2 = "nut-progress";
@@ -13192,7 +12967,7 @@ var __publicField = (obj, key, value) => {
13192
12967
  }
13193
12968
  ) }) }) });
13194
12969
  };
13195
- Progress.defaultProps = defaultProps$G;
12970
+ Progress.defaultProps = defaultProps$H;
13196
12971
  Progress.displayName = "NutProgress";
13197
12972
  class UploadOptions {
13198
12973
  constructor() {
@@ -13337,7 +13112,7 @@ var __publicField = (obj, key, value) => {
13337
13112
  done();
13338
13113
  }
13339
13114
  };
13340
- const defaultProps$F = {
13115
+ const defaultProps$G = {
13341
13116
  ...ComponentDefaults,
13342
13117
  url: "",
13343
13118
  maxCount: 1,
@@ -13425,7 +13200,7 @@ var __publicField = (obj, key, value) => {
13425
13200
  beforeXhrUpload,
13426
13201
  beforeDelete,
13427
13202
  ...restProps
13428
- } = { ...defaultProps$F, ...props };
13203
+ } = { ...defaultProps$G, ...props };
13429
13204
  const [fileList, setFileList] = React.useState(defaultValue || []);
13430
13205
  const [uploadQueue, setUploadQueue] = React.useState([]);
13431
13206
  React.useEffect(() => {
@@ -13788,9 +13563,9 @@ var __publicField = (obj, key, value) => {
13788
13563
  ] });
13789
13564
  };
13790
13565
  const Uploader = React.forwardRef(InternalUploader);
13791
- Uploader.defaultProps = defaultProps$F;
13566
+ Uploader.defaultProps = defaultProps$G;
13792
13567
  Uploader.displayName = "NutUploader";
13793
- const defaultProps$E = {
13568
+ const defaultProps$F = {
13794
13569
  cancelText: "",
13795
13570
  optionTag: "name",
13796
13571
  optionSubTag: "subname",
@@ -13824,7 +13599,7 @@ var __publicField = (obj, key, value) => {
13824
13599
  className,
13825
13600
  style,
13826
13601
  ...rest
13827
- } = { ...defaultProps$E, ...props };
13602
+ } = { ...defaultProps$F, ...props };
13828
13603
  const b2 = cn("actionsheet");
13829
13604
  const isHighlight = (item) => {
13830
13605
  return props.chooseTagValue && props.chooseTagValue === item[props.optionTag || "name"] ? props.color : "#1a1a1a";
@@ -13869,7 +13644,7 @@ var __publicField = (obj, key, value) => {
13869
13644
  }
13870
13645
  );
13871
13646
  };
13872
- ActionSheet.defaultProps = defaultProps$E;
13647
+ ActionSheet.defaultProps = defaultProps$F;
13873
13648
  ActionSheet.displayName = "NutActionSheet";
13874
13649
  const Content = (props) => {
13875
13650
  const { visible, title, footer, footerDirection, onClick, children } = props;
@@ -13964,7 +13739,7 @@ var __publicField = (obj, key, value) => {
13964
13739
  };
13965
13740
  DialogWrap.defaultProps = defaultDialogProps;
13966
13741
  DialogWrap.displayName = "NutDialogWrap";
13967
- const defaultProps$D = {
13742
+ const defaultProps$E = {
13968
13743
  confirmText: "",
13969
13744
  cancelText: "",
13970
13745
  overlay: true,
@@ -14062,9 +13837,9 @@ var __publicField = (obj, key, value) => {
14062
13837
  );
14063
13838
  }
14064
13839
  );
14065
- BaseDialog.defaultProps = defaultProps$D;
13840
+ BaseDialog.defaultProps = defaultProps$E;
14066
13841
  BaseDialog.displayName = "NutDialog";
14067
- const defaultProps$C = {
13842
+ const defaultProps$D = {
14068
13843
  ...ComponentDefaults,
14069
13844
  attract: false,
14070
13845
  direction: void 0,
@@ -14078,7 +13853,7 @@ var __publicField = (obj, key, value) => {
14078
13853
  };
14079
13854
  const Drag = (props) => {
14080
13855
  const { attract, direction, boundary, children, className, style, ...reset } = {
14081
- ...defaultProps$C,
13856
+ ...defaultProps$D,
14082
13857
  ...props
14083
13858
  };
14084
13859
  const classPrefix2 = "nut-drag";
@@ -14175,14 +13950,14 @@ var __publicField = (obj, key, value) => {
14175
13950
  }
14176
13951
  );
14177
13952
  };
14178
- Drag.defaultProps = defaultProps$C;
13953
+ Drag.defaultProps = defaultProps$D;
14179
13954
  Drag.displayName = "NutDrag";
14180
13955
  const defaultStatus = {
14181
13956
  empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
14182
13957
  error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
14183
13958
  network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
14184
13959
  };
14185
- const defaultProps$B = {
13960
+ const defaultProps$C = {
14186
13961
  ...ComponentDefaults,
14187
13962
  description: "",
14188
13963
  imageSize: "",
@@ -14191,7 +13966,7 @@ var __publicField = (obj, key, value) => {
14191
13966
  const classPrefix$6 = `nut-empty`;
14192
13967
  const Empty = (props) => {
14193
13968
  const { locale } = useConfig$1();
14194
- defaultProps$B.description = locale.noData || defaultProps$B.description;
13969
+ defaultProps$C.description = locale.noData || defaultProps$C.description;
14195
13970
  const {
14196
13971
  image,
14197
13972
  imageSize,
@@ -14201,7 +13976,7 @@ var __publicField = (obj, key, value) => {
14201
13976
  status,
14202
13977
  ...rest
14203
13978
  } = {
14204
- ...defaultProps$B,
13979
+ ...defaultProps$C,
14205
13980
  ...props
14206
13981
  };
14207
13982
  const [imgStyle, setImgStyle] = React.useState({});
@@ -14230,9 +14005,9 @@ var __publicField = (obj, key, value) => {
14230
14005
  children
14231
14006
  ] }) });
14232
14007
  };
14233
- Empty.defaultProps = defaultProps$B;
14008
+ Empty.defaultProps = defaultProps$C;
14234
14009
  Empty.displayName = "NutEmpty";
14235
- const defaultProps$A = {
14010
+ const defaultProps$B = {
14236
14011
  ...ComponentDefaults,
14237
14012
  hasMore: true,
14238
14013
  upperThreshold: 40,
@@ -14262,7 +14037,7 @@ var __publicField = (obj, key, value) => {
14262
14037
  onLoadMore,
14263
14038
  onScrollChange
14264
14039
  } = {
14265
- ...defaultProps$A,
14040
+ ...defaultProps$B,
14266
14041
  ...props
14267
14042
  };
14268
14043
  const [isInfiniting, setIsInfiniting] = React.useState(false);
@@ -14385,9 +14160,9 @@ var __publicField = (obj, key, value) => {
14385
14160
  }
14386
14161
  );
14387
14162
  };
14388
- Infiniteloading.defaultProps = defaultProps$A;
14163
+ Infiniteloading.defaultProps = defaultProps$B;
14389
14164
  Infiniteloading.displayName = "NutInfiniteloading";
14390
- const defaultProps$z = {
14165
+ const defaultProps$A = {
14391
14166
  ...ComponentDefaults,
14392
14167
  // 滚动方向 across 横向 vertical 纵向
14393
14168
  direction: "across",
@@ -14432,7 +14207,7 @@ var __publicField = (obj, key, value) => {
14432
14207
  onClick,
14433
14208
  onClickItem
14434
14209
  } = {
14435
- ...defaultProps$z,
14210
+ ...defaultProps$A,
14436
14211
  ...props
14437
14212
  };
14438
14213
  const wrap = React.useRef(null);
@@ -14838,9 +14613,9 @@ var __publicField = (obj, key, value) => {
14838
14613
  ) : null
14839
14614
  ] });
14840
14615
  };
14841
- NoticeBar.defaultProps = defaultProps$z;
14616
+ NoticeBar.defaultProps = defaultProps$A;
14842
14617
  NoticeBar.displayName = "NutNoticeBar";
14843
- const defaultProps$y = {
14618
+ const defaultProps$z = {
14844
14619
  id: "",
14845
14620
  msg: "",
14846
14621
  color: "",
@@ -14874,7 +14649,7 @@ var __publicField = (obj, key, value) => {
14874
14649
  onClosed,
14875
14650
  onClick,
14876
14651
  ...rest
14877
- } = { ...defaultProps$y, ...props };
14652
+ } = { ...defaultProps$z, ...props };
14878
14653
  let timer;
14879
14654
  const [showNotify, SetShow] = React.useState(false);
14880
14655
  React.useEffect(() => {
@@ -14942,7 +14717,7 @@ var __publicField = (obj, key, value) => {
14942
14717
  }
14943
14718
  ) });
14944
14719
  };
14945
- Notify.defaultProps = defaultProps$y;
14720
+ Notify.defaultProps = defaultProps$z;
14946
14721
  Notify.displayName = "NutNotify";
14947
14722
  function fillRef(ref, node) {
14948
14723
  if (typeof ref === "function") {
@@ -14986,7 +14761,7 @@ var __publicField = (obj, key, value) => {
14986
14761
  return trigger;
14987
14762
  }
14988
14763
  }
14989
- const defaultProps$x = {
14764
+ const defaultProps$y = {
14990
14765
  ...ComponentDefaults,
14991
14766
  list: [],
14992
14767
  theme: "light",
@@ -15013,7 +14788,7 @@ var __publicField = (obj, key, value) => {
15013
14788
  onChoose,
15014
14789
  ...reset
15015
14790
  } = {
15016
- ...defaultProps$x,
14791
+ ...defaultProps$y,
15017
14792
  ...props
15018
14793
  };
15019
14794
  const goodItem = React.useRef(null);
@@ -15116,7 +14891,7 @@ var __publicField = (obj, key, value) => {
15116
14891
  ) : null
15117
14892
  ] });
15118
14893
  };
15119
- Popover.defaultProps = defaultProps$x;
14894
+ Popover.defaultProps = defaultProps$y;
15120
14895
  Popover.displayName = "NutPopover";
15121
14896
  function clamp$1(v, min, max) {
15122
14897
  return Math.max(min, Math.min(v, max));
@@ -19708,7 +19483,7 @@ This message will only show in development mode. It won't appear in production.
19708
19483
  return position;
19709
19484
  }
19710
19485
  const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
19711
- const defaultProps$w = {
19486
+ const defaultProps$x = {
19712
19487
  pullingText: "",
19713
19488
  canReleaseText: "",
19714
19489
  refreshingText: "",
@@ -19723,7 +19498,7 @@ This message will only show in development mode. It won't appear in production.
19723
19498
  const PullToRefresh = (p) => {
19724
19499
  const { locale } = useConfig$1();
19725
19500
  const props = {
19726
- ...defaultProps$w,
19501
+ ...defaultProps$x,
19727
19502
  ...p,
19728
19503
  ...{
19729
19504
  pullingText: p.pullingText || locale.pullToRefresh.pullingText,
@@ -19860,10 +19635,10 @@ This message will only show in development mode. It won't appear in production.
19860
19635
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-pulltorefresh-content", children: props.children })
19861
19636
  ] });
19862
19637
  };
19863
- PullToRefresh.defaultProps = defaultProps$w;
19638
+ PullToRefresh.defaultProps = defaultProps$x;
19864
19639
  PullToRefresh.displayName = "NutPullToRefresh";
19865
19640
  const AvatarContext = React.createContext({});
19866
- const defaultProps$v = {
19641
+ const defaultProps$w = {
19867
19642
  ...ComponentDefaults,
19868
19643
  size: "",
19869
19644
  shape: "round",
@@ -19893,7 +19668,7 @@ This message will only show in development mode. It won't appear in production.
19893
19668
  onError,
19894
19669
  ...rest
19895
19670
  } = {
19896
- ...defaultProps$v,
19671
+ ...defaultProps$w,
19897
19672
  ...props
19898
19673
  };
19899
19674
  const [maxSum, setMaxSum] = React.useState(0);
@@ -19982,9 +19757,9 @@ This message will only show in development mode. It won't appear in production.
19982
19757
  }
19983
19758
  ) });
19984
19759
  };
19985
- Avatar.defaultProps = defaultProps$v;
19760
+ Avatar.defaultProps = defaultProps$w;
19986
19761
  Avatar.displayName = "NutAvatar";
19987
- const defaultProps$u = {
19762
+ const defaultProps$v = {
19988
19763
  width: "100px",
19989
19764
  height: "100px",
19990
19765
  row: 1,
@@ -20012,7 +19787,7 @@ This message will only show in development mode. It won't appear in production.
20012
19787
  avatarShape,
20013
19788
  ...restProps
20014
19789
  } = {
20015
- ...defaultProps$u,
19790
+ ...defaultProps$v,
20016
19791
  ...props
20017
19792
  };
20018
19793
  const b2 = cn("skeleton");
@@ -20069,7 +19844,7 @@ This message will only show in development mode. It won't appear in production.
20069
19844
  ] })
20070
19845
  ] }) });
20071
19846
  };
20072
- Skeleton.defaultProps = defaultProps$u;
19847
+ Skeleton.defaultProps = defaultProps$v;
20073
19848
  Skeleton.displayName = "NutSkeleton";
20074
19849
  function preventDefault(event, isStopPropagation) {
20075
19850
  if (typeof event.cancelable !== "boolean" || event.cancelable) {
@@ -20079,7 +19854,7 @@ This message will only show in development mode. It won't appear in production.
20079
19854
  event.stopPropagation();
20080
19855
  }
20081
19856
  }
20082
- const defaultProps$t = {
19857
+ const defaultProps$u = {
20083
19858
  name: ""
20084
19859
  };
20085
19860
  const Swipe = React.forwardRef((props, instanceRef) => {
@@ -20098,7 +19873,7 @@ This message will only show in development mode. It won't appear in production.
20098
19873
  };
20099
19874
  Taro.nextTick(() => getWidth());
20100
19875
  });
20101
- const { children, className, style } = { ...defaultProps$t, ...props };
19876
+ const { children, className, style } = { ...defaultProps$u, ...props };
20102
19877
  const root2 = React.useRef();
20103
19878
  const opened = React.useRef(false);
20104
19879
  const lockClick = React.useRef(false);
@@ -20258,8 +20033,156 @@ This message will only show in development mode. It won't appear in production.
20258
20033
  }
20259
20034
  );
20260
20035
  });
20261
- Swipe.defaultProps = defaultProps$t;
20036
+ Swipe.defaultProps = defaultProps$u;
20262
20037
  Swipe.displayName = "NutSwipe";
20038
+ const defaultProps$t = {
20039
+ id: "",
20040
+ style: {},
20041
+ icon: null,
20042
+ iconSize: "20",
20043
+ msg: "",
20044
+ bottom: "30px",
20045
+ // center为false时生效,距离底部位置
20046
+ duration: 2,
20047
+ // 时长,duration为0则一直展示
20048
+ center: true,
20049
+ // toast是否居中展示
20050
+ type: "text",
20051
+ title: "",
20052
+ customClass: "",
20053
+ // 自定义样式名
20054
+ size: "base",
20055
+ // 设置字体大小,默认base,可选large\small\base
20056
+ textAlignCenter: true,
20057
+ // 文字是否居中显示,true为居中,false为left
20058
+ bgColor: "rgba(0, 0, 0, .8)",
20059
+ cover: false,
20060
+ // 是否展示透明遮罩层
20061
+ coverColor: "rgba(0, 0, 0, 0)",
20062
+ // 遮罩颜色设定
20063
+ closeOnClickOverlay: false,
20064
+ // 是否点击遮罩可关闭
20065
+ visible: false,
20066
+ onClose: () => {
20067
+ }
20068
+ // 未实现
20069
+ };
20070
+ const Toast = (props) => {
20071
+ const {
20072
+ children,
20073
+ id,
20074
+ style,
20075
+ icon,
20076
+ iconSize,
20077
+ msg,
20078
+ bottom,
20079
+ duration,
20080
+ center,
20081
+ type,
20082
+ title,
20083
+ customClass,
20084
+ size,
20085
+ textAlignCenter,
20086
+ bgColor,
20087
+ cover,
20088
+ coverColor,
20089
+ closeOnClickOverlay,
20090
+ visible,
20091
+ onClose,
20092
+ ...rest
20093
+ } = { ...defaultProps$t, ...props };
20094
+ let timer;
20095
+ const [openState, SetOpenState] = React.useState(false);
20096
+ React.useEffect(() => {
20097
+ if (visible) {
20098
+ SetOpenState(true);
20099
+ show();
20100
+ } else {
20101
+ hide();
20102
+ }
20103
+ }, [visible]);
20104
+ const clearTimer = () => {
20105
+ if (timer) {
20106
+ clearTimeout(timer);
20107
+ timer = null;
20108
+ }
20109
+ };
20110
+ const hide = () => {
20111
+ SetOpenState(false);
20112
+ onClose();
20113
+ };
20114
+ const show = () => {
20115
+ clearTimer();
20116
+ if (duration) {
20117
+ timer = window.setTimeout(() => {
20118
+ hide();
20119
+ }, duration * 1e3);
20120
+ }
20121
+ };
20122
+ const clickCover = () => {
20123
+ if (closeOnClickOverlay) {
20124
+ hide();
20125
+ }
20126
+ };
20127
+ const toastBem = cn("toast");
20128
+ const hasIcon = () => {
20129
+ if (type !== "text") {
20130
+ return true;
20131
+ }
20132
+ return !!icon;
20133
+ };
20134
+ const iconName = () => {
20135
+ if (icon) {
20136
+ return icon;
20137
+ }
20138
+ return {
20139
+ success: /* @__PURE__ */ jsxRuntimeExports.jsx(a$4, { color: "#ffffff", width: iconSize, height: iconSize }),
20140
+ fail: /* @__PURE__ */ jsxRuntimeExports.jsx(a$l, { color: "#ffffff", width: iconSize, height: iconSize }),
20141
+ warn: /* @__PURE__ */ jsxRuntimeExports.jsx(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
20142
+ loading: /* @__PURE__ */ jsxRuntimeExports.jsx(r$f, { color: "#ffffff", width: iconSize, height: iconSize })
20143
+ }[type];
20144
+ };
20145
+ const classes = classNames({
20146
+ "nut-toast-center": center,
20147
+ "nut-toast-has-icon": icon,
20148
+ "nut-toast-cover": cover,
20149
+ "nut-toast-loading": type === "loading",
20150
+ [`${customClass}`]: true,
20151
+ [`nut-toast-${size}`]: true
20152
+ });
20153
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: openState ? /* @__PURE__ */ jsxRuntimeExports.jsx(
20154
+ "div",
20155
+ {
20156
+ className: `${toastBem()} ${classes}`,
20157
+ id,
20158
+ style: {
20159
+ bottom: center ? "auto" : `${bottom}`,
20160
+ backgroundColor: cover ? coverColor : "",
20161
+ ...style
20162
+ },
20163
+ onClick: () => {
20164
+ clickCover();
20165
+ },
20166
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
20167
+ "div",
20168
+ {
20169
+ className: toastBem("inner"),
20170
+ style: {
20171
+ textAlign: textAlignCenter ? "center" : "left",
20172
+ backgroundColor: bgColor
20173
+ },
20174
+ children: [
20175
+ hasIcon() ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: toastBem("icon-wrapper"), children: iconName() }) : null,
20176
+ title ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-toast-title", children: title }) : null,
20177
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: toastBem("text"), children: msg })
20178
+ ]
20179
+ }
20180
+ )
20181
+ }
20182
+ ) : null });
20183
+ };
20184
+ Toast.defaultProps = defaultProps$t;
20185
+ Toast.displayName = "NutToast";
20263
20186
  const defaultProps$s = {
20264
20187
  ...ComponentDefaults,
20265
20188
  type: "shake",
@@ -20548,9 +20471,11 @@ This message will only show in development mode. It won't appear in production.
20548
20471
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("progress-bar-wrapper"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20549
20472
  Range,
20550
20473
  {
20551
- modelValue: percent,
20552
- hiddenTag: true,
20553
- hiddenRange: true,
20474
+ value: percent,
20475
+ onChange: (val) => setPercent(val),
20476
+ currentDescription: null,
20477
+ maxDescription: null,
20478
+ minDescription: null,
20554
20479
  "inactive-color": "#cccccc",
20555
20480
  "active-color": "#fa2c19"
20556
20481
  }