@nutui/nutui-react-taro 3.0.12 → 3.0.13-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -9
- package/dist/cjs/packages/input/input.js +3 -0
- package/dist/cjs/packages/lottie/lottiemp.js +7 -6
- package/dist/cjs/packages/swiper/swiper.js +22 -21
- package/dist/cjs/packages/textarea/textarea.d.ts +2 -2
- package/dist/cjs/packages/textarea/textarea.js +27 -8
- package/dist/cjs/types/spec/lottie/taro.d.ts +1 -0
- package/dist/cjs/types/spec/swiper/base.d.ts +4 -0
- package/dist/cjs/types/spec/swiper/taro.d.ts +4 -0
- package/dist/es/packages/input/input.js +3 -0
- package/dist/es/packages/lottie/lottiemp.js +7 -6
- package/dist/es/packages/swiper/swiper.js +23 -22
- package/dist/es/packages/textarea/textarea.d.ts +2 -2
- package/dist/es/packages/textarea/textarea.js +28 -9
- package/dist/es/types/spec/lottie/taro.d.ts +1 -0
- package/dist/es/types/spec/swiper/base.d.ts +5 -1
- package/dist/es/types/spec/swiper/taro.d.ts +4 -0
- package/dist/nutui.react.umd.js +61 -35
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +40 -40
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +24 -24
- package/dist/style.css +1 -1
- package/dist/style.scss +29 -29
- package/package.json +1 -1
package/dist/nutui.react.umd.js
CHANGED
|
@@ -11537,6 +11537,9 @@
|
|
|
11537
11537
|
var _inputRef_current;
|
|
11538
11538
|
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur();
|
|
11539
11539
|
},
|
|
11540
|
+
get: function() {
|
|
11541
|
+
return inputRef.current;
|
|
11542
|
+
},
|
|
11540
11543
|
get nativeElement() {
|
|
11541
11544
|
return inputRef.current;
|
|
11542
11545
|
}
|
|
@@ -13992,14 +13995,13 @@
|
|
|
13992
13995
|
defaultValue: "",
|
|
13993
13996
|
showCount: false,
|
|
13994
13997
|
maxLength: 140,
|
|
13995
|
-
placeholder: "",
|
|
13996
13998
|
readOnly: false,
|
|
13997
13999
|
disabled: false,
|
|
13998
14000
|
autoSize: false,
|
|
13999
14001
|
plain: false,
|
|
14000
14002
|
status: "default"
|
|
14001
14003
|
});
|
|
14002
|
-
var TextArea = function(props) {
|
|
14004
|
+
var TextArea = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
14003
14005
|
var locale = useConfig().locale;
|
|
14004
14006
|
var _ref = _object_spread({}, defaultProps$L, props), className = _ref.className, value2 = _ref.value, defaultValue = _ref.defaultValue, showCount = _ref.showCount, maxLength = _ref.maxLength, rows = _ref.rows, placeholder = _ref.placeholder, readOnly = _ref.readOnly, disabled = _ref.disabled, autoSize = _ref.autoSize, style = _ref.style, plain = _ref.plain, status = _ref.status, onChange = _ref.onChange, onBlur = _ref.onBlur, onFocus = _ref.onFocus, rest = _object_without_properties(_ref, [
|
|
14005
14007
|
"className",
|
|
@@ -14033,15 +14035,16 @@
|
|
|
14033
14035
|
defaultValue,
|
|
14034
14036
|
finalValue: format2(defaultValue),
|
|
14035
14037
|
onChange
|
|
14036
|
-
}), 2),
|
|
14038
|
+
}), 2), innerValue = _usePropsValue[0], setInnerValue = _usePropsValue[1];
|
|
14039
|
+
var textareaRef = React.useRef(null);
|
|
14037
14040
|
var handleChange = function(event) {
|
|
14038
14041
|
var _event_detail;
|
|
14039
14042
|
var text2 = event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value;
|
|
14040
14043
|
if (text2) {
|
|
14041
14044
|
var value3 = compositionRef.current ? text2 : format2(text2);
|
|
14042
|
-
|
|
14045
|
+
setInnerValue(value3);
|
|
14043
14046
|
} else {
|
|
14044
|
-
|
|
14047
|
+
setInnerValue("");
|
|
14045
14048
|
}
|
|
14046
14049
|
};
|
|
14047
14050
|
var isDisabled = function() {
|
|
@@ -14055,10 +14058,29 @@
|
|
|
14055
14058
|
if (isDisabled()) return;
|
|
14056
14059
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
14057
14060
|
};
|
|
14061
|
+
React.useImperativeHandle(ref, function() {
|
|
14062
|
+
return {
|
|
14063
|
+
clear: function() {
|
|
14064
|
+
setInnerValue("");
|
|
14065
|
+
},
|
|
14066
|
+
focus: function() {
|
|
14067
|
+
var _textareaRef_current;
|
|
14068
|
+
return (_textareaRef_current = textareaRef.current) === null || _textareaRef_current === void 0 ? void 0 : _textareaRef_current.focus();
|
|
14069
|
+
},
|
|
14070
|
+
blur: function() {
|
|
14071
|
+
var _textareaRef_current;
|
|
14072
|
+
return (_textareaRef_current = textareaRef.current) === null || _textareaRef_current === void 0 ? void 0 : _textareaRef_current.blur();
|
|
14073
|
+
},
|
|
14074
|
+
get nativeElement() {
|
|
14075
|
+
return textareaRef.current;
|
|
14076
|
+
}
|
|
14077
|
+
};
|
|
14078
|
+
});
|
|
14058
14079
|
var _obj;
|
|
14059
14080
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(components.View, {
|
|
14060
14081
|
className: classNames(classPrefix2, (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-disabled"), disabled), _define_property(_obj, "".concat(classPrefix2, "-readonly"), readOnly), _define_property(_obj, "".concat(classPrefix2, "-rtl"), rtl), _define_property(_obj, "".concat(classPrefix2, "-plain"), plain), _define_property(_obj, "".concat(classPrefix2, "-container"), !plain), _define_property(_obj, "".concat(classPrefix2, "-").concat(status), status), _obj), className)
|
|
14061
14082
|
}, /* @__PURE__ */ React.createElement(components.Textarea, _object_spread_props(_object_spread({}, rest), {
|
|
14083
|
+
ref: textareaRef,
|
|
14062
14084
|
nativeProps: {
|
|
14063
14085
|
style,
|
|
14064
14086
|
readOnly,
|
|
@@ -14074,7 +14096,7 @@
|
|
|
14074
14096
|
style: Taro.getEnv() === "WEB" ? void 0 : style,
|
|
14075
14097
|
disabled: Taro.getEnv() === "WEB" ? disabled : disabled || readOnly,
|
|
14076
14098
|
// @ts-ignore
|
|
14077
|
-
value:
|
|
14099
|
+
value: innerValue,
|
|
14078
14100
|
onInput: handleChange,
|
|
14079
14101
|
onBlur: handleBlur,
|
|
14080
14102
|
onFocus: handleFocus,
|
|
@@ -14083,8 +14105,8 @@
|
|
|
14083
14105
|
placeholder: placeholder !== void 0 ? placeholder : locale.placeholder
|
|
14084
14106
|
})), showCount && /* @__PURE__ */ React.createElement(components.View, {
|
|
14085
14107
|
className: classNames("".concat(classPrefix2, "-limit"), _define_property({}, "".concat(classPrefix2, "-limit-disabled"), disabled))
|
|
14086
|
-
},
|
|
14087
|
-
};
|
|
14108
|
+
}, innerValue.length, "/", maxLength < 0 ? 0 : maxLength)));
|
|
14109
|
+
});
|
|
14088
14110
|
TextArea.displayName = "NutTextArea";
|
|
14089
14111
|
var defaultProps$K = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
14090
14112
|
percent: 0,
|
|
@@ -18713,15 +18735,18 @@
|
|
|
18713
18735
|
direction: "horizontal",
|
|
18714
18736
|
indicator: false,
|
|
18715
18737
|
autoPlay: false,
|
|
18738
|
+
autoplay: false,
|
|
18716
18739
|
loop: false,
|
|
18717
18740
|
defaultValue: 0,
|
|
18718
18741
|
style: {}
|
|
18719
18742
|
};
|
|
18720
18743
|
var classPrefix$4 = "nut-swiper";
|
|
18721
18744
|
var Swiper = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
18722
|
-
var _ref = _object_spread({}, defaultProps$i, props), width2 = _ref.width, height2 = _ref.height, className = _ref.className, children = _ref.children, indicator = _ref.indicator,
|
|
18745
|
+
var _ref = _object_spread({}, defaultProps$i, props), width2 = _ref.width, height2 = _ref.height, className = _ref.className, children = _ref.children, indicator = _ref.indicator, indicatorDots = _ref.indicatorDots, loop = _ref.loop;
|
|
18746
|
+
_ref.circular;
|
|
18747
|
+
var autoPlay = _ref.autoPlay, autoplay = _ref.autoplay;
|
|
18723
18748
|
_ref.duration;
|
|
18724
|
-
var direction = _ref.direction, defaultValue = _ref.defaultValue;
|
|
18749
|
+
var vertical = _ref.vertical, direction = _ref.direction, defaultValue = _ref.defaultValue, current = _ref.current;
|
|
18725
18750
|
_ref.onChange;
|
|
18726
18751
|
var style = _ref.style, rest = _object_without_properties(_ref, [
|
|
18727
18752
|
"width",
|
|
@@ -18729,15 +18754,20 @@
|
|
|
18729
18754
|
"className",
|
|
18730
18755
|
"children",
|
|
18731
18756
|
"indicator",
|
|
18757
|
+
"indicatorDots",
|
|
18732
18758
|
"loop",
|
|
18759
|
+
"circular",
|
|
18733
18760
|
"autoPlay",
|
|
18761
|
+
"autoplay",
|
|
18734
18762
|
"duration",
|
|
18763
|
+
"vertical",
|
|
18735
18764
|
"direction",
|
|
18736
18765
|
"defaultValue",
|
|
18766
|
+
"current",
|
|
18737
18767
|
"onChange",
|
|
18738
18768
|
"style"
|
|
18739
18769
|
]);
|
|
18740
|
-
var _useState = _sliced_to_array(React.useState(defaultValue), 2),
|
|
18770
|
+
var _useState = _sliced_to_array(React.useState(current || defaultValue), 2), innerValue = _useState[0], setInnerValue = _useState[1];
|
|
18741
18771
|
var childrenCount = React.useMemo(function() {
|
|
18742
18772
|
var c = 0;
|
|
18743
18773
|
React.Children.map(children, function(child, index2) {
|
|
@@ -18747,47 +18777,42 @@
|
|
|
18747
18777
|
}, [
|
|
18748
18778
|
children
|
|
18749
18779
|
]);
|
|
18750
|
-
React.useEffect(function() {
|
|
18751
|
-
setCurrent(defaultValue);
|
|
18752
|
-
}, [
|
|
18753
|
-
defaultValue
|
|
18754
|
-
]);
|
|
18755
18780
|
var renderIndicator = function() {
|
|
18756
18781
|
if (/* @__PURE__ */ React.isValidElement(indicator)) return indicator;
|
|
18757
|
-
if (indicator) {
|
|
18782
|
+
if (indicator || indicatorDots) {
|
|
18758
18783
|
var _obj;
|
|
18759
18784
|
return /* @__PURE__ */ React.createElement(components.View, {
|
|
18760
|
-
className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix$4, "-indicator"), true), _define_property(_obj, "".concat(classPrefix$4, "-indicator-vertical"), direction === "vertical"), _obj))
|
|
18785
|
+
className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix$4, "-indicator"), true), _define_property(_obj, "".concat(classPrefix$4, "-indicator-vertical"), direction === "vertical" || vertical), _obj))
|
|
18761
18786
|
}, /* @__PURE__ */ React.createElement(Indicator, {
|
|
18762
|
-
current,
|
|
18787
|
+
current: innerValue,
|
|
18763
18788
|
total: childrenCount,
|
|
18764
|
-
direction
|
|
18789
|
+
direction: vertical ? "vertical" : direction
|
|
18765
18790
|
}));
|
|
18766
18791
|
}
|
|
18767
18792
|
return null;
|
|
18768
18793
|
};
|
|
18769
18794
|
var handleOnChange = function(value2) {
|
|
18770
|
-
|
|
18795
|
+
setInnerValue(value2.detail.current);
|
|
18771
18796
|
};
|
|
18772
18797
|
React.useImperativeHandle(ref, function() {
|
|
18773
18798
|
return {
|
|
18774
18799
|
to: function(value2) {
|
|
18775
|
-
|
|
18800
|
+
setInnerValue(value2);
|
|
18776
18801
|
},
|
|
18777
18802
|
next: function() {
|
|
18778
18803
|
if (loop) {
|
|
18779
|
-
|
|
18804
|
+
setInnerValue((innerValue + 1) % childrenCount);
|
|
18780
18805
|
} else {
|
|
18781
|
-
|
|
18806
|
+
setInnerValue(innerValue + 1 >= childrenCount ? innerValue : innerValue + 1);
|
|
18782
18807
|
}
|
|
18783
18808
|
},
|
|
18784
18809
|
prev: function() {
|
|
18785
18810
|
if (loop) {
|
|
18786
|
-
var next =
|
|
18811
|
+
var next = innerValue - 1;
|
|
18787
18812
|
next = next < 0 ? childrenCount + next : next;
|
|
18788
|
-
|
|
18813
|
+
setInnerValue(next % childrenCount);
|
|
18789
18814
|
} else {
|
|
18790
|
-
|
|
18815
|
+
setInnerValue(innerValue - 1 <= 0 ? 0 : innerValue - 1);
|
|
18791
18816
|
}
|
|
18792
18817
|
}
|
|
18793
18818
|
};
|
|
@@ -18805,10 +18830,10 @@
|
|
|
18805
18830
|
height: !height2 ? pxTransform(150) : height2
|
|
18806
18831
|
}
|
|
18807
18832
|
}, /* @__PURE__ */ React.createElement(components.Swiper, _object_spread({
|
|
18808
|
-
current,
|
|
18833
|
+
current: innerValue,
|
|
18809
18834
|
circular: loop,
|
|
18810
|
-
autoplay: autoPlay,
|
|
18811
|
-
vertical: direction === "vertical",
|
|
18835
|
+
autoplay: autoplay || autoPlay,
|
|
18836
|
+
vertical: direction === "vertical" || vertical,
|
|
18812
18837
|
indicatorDots: false,
|
|
18813
18838
|
onChange: function(e) {
|
|
18814
18839
|
var _props_onChange;
|
|
@@ -39518,7 +39543,7 @@
|
|
|
39518
39543
|
var id = "nutLottie-".concat(uuid);
|
|
39519
39544
|
var animation = React.useRef();
|
|
39520
39545
|
var inited = React.useRef(false);
|
|
39521
|
-
var source = props.source, _props_loop = props.loop, loop = _props_loop === void 0 ? true : _props_loop, _props_autoPlay = props.autoPlay, autoPlay = _props_autoPlay === void 0 ? true : _props_autoPlay, onComplete = props.onComplete, style = props.style, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed;
|
|
39546
|
+
var source = props.source, _props_loop = props.loop, loop = _props_loop === void 0 ? true : _props_loop, _props_autoPlay = props.autoPlay, autoPlay = _props_autoPlay === void 0 ? true : _props_autoPlay, onComplete = props.onComplete, style = props.style, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_dpr = props.dpr, dpr = _props_dpr === void 0 ? true : _props_dpr;
|
|
39522
39547
|
var setSpeed = function() {
|
|
39523
39548
|
if (animation.current) {
|
|
39524
39549
|
animation.current.setSpeed(Math.abs(speed));
|
|
@@ -39528,7 +39553,7 @@
|
|
|
39528
39553
|
React.useImperativeHandle(ref, function() {
|
|
39529
39554
|
return animation.current || {};
|
|
39530
39555
|
});
|
|
39531
|
-
var
|
|
39556
|
+
var pixelRatio = React.useRef(getWindowInfo().pixelRatio);
|
|
39532
39557
|
Taro.useReady(function() {
|
|
39533
39558
|
Taro.createSelectorQuery().select("#".concat(id)).fields({
|
|
39534
39559
|
node: true,
|
|
@@ -39538,9 +39563,10 @@
|
|
|
39538
39563
|
var canvas = res.node;
|
|
39539
39564
|
var context2 = canvas.getContext("2d");
|
|
39540
39565
|
if (style && style.width !== void 0 && style.height !== void 0) {
|
|
39541
|
-
|
|
39542
|
-
canvas.
|
|
39543
|
-
|
|
39566
|
+
var finalDpr = dpr ? pixelRatio.current : 1;
|
|
39567
|
+
canvas.width = parseFloat(style.width.toString()) * finalDpr;
|
|
39568
|
+
canvas.height = parseFloat(style.height.toString()) * finalDpr;
|
|
39569
|
+
context2.scale(finalDpr, finalDpr);
|
|
39544
39570
|
}
|
|
39545
39571
|
lottie.setup(canvas);
|
|
39546
39572
|
animation.current = lottie.loadAnimation({
|