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