@nutui/nutui-react 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/swiper/swiper.js +52 -43
- package/dist/cjs/packages/textarea/textarea.d.ts +2 -2
- package/dist/cjs/packages/textarea/textarea.js +25 -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/swiper/swiper.js +53 -44
- package/dist/es/packages/textarea/textarea.d.ts +2 -2
- package/dist/es/packages/textarea/textarea.js +26 -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 +82 -56
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +43 -43
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +40 -40
- package/dist/style.css +1 -1
- package/dist/style.scss +36 -36
- package/package.json +1 -1
|
@@ -27,10 +27,14 @@ export interface BaseSwiper extends BaseProps {
|
|
|
27
27
|
* 动画时长(单位是ms)
|
|
28
28
|
*/
|
|
29
29
|
duration: SimpleValue
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Please use `autoplay` prop instead.
|
|
32
|
+
*/
|
|
33
|
+
autoPlay: boolean | number;
|
|
30
34
|
/**
|
|
31
35
|
* 自动轮播时长,0表示不会自动轮播
|
|
32
36
|
*/
|
|
33
|
-
|
|
37
|
+
autoplay: boolean | number
|
|
34
38
|
/**
|
|
35
39
|
* 初始化索引值
|
|
36
40
|
*/
|
|
@@ -9,7 +9,11 @@ export type TaroSwiperProps = Omit<BaseSwiper, OmittedKeys> & OmittedSwiperProps
|
|
|
9
9
|
height?: SimpleValue;
|
|
10
10
|
direction: Direction;
|
|
11
11
|
indicator: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Please use `autoplay` prop instead.
|
|
14
|
+
*/
|
|
12
15
|
autoPlay: boolean;
|
|
16
|
+
autoplay: boolean;
|
|
13
17
|
loop: boolean;
|
|
14
18
|
defaultValue: number;
|
|
15
19
|
};
|
package/dist/nutui.react.umd.js
CHANGED
|
@@ -16899,6 +16899,9 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16899
16899
|
var _inputRef_current;
|
|
16900
16900
|
return (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur();
|
|
16901
16901
|
},
|
|
16902
|
+
get: function() {
|
|
16903
|
+
return inputRef.current;
|
|
16904
|
+
},
|
|
16902
16905
|
get nativeElement() {
|
|
16903
16906
|
return inputRef.current;
|
|
16904
16907
|
}
|
|
@@ -19271,14 +19274,13 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
19271
19274
|
showCount: false,
|
|
19272
19275
|
rows: 2,
|
|
19273
19276
|
maxLength: 140,
|
|
19274
|
-
placeholder: "",
|
|
19275
19277
|
readOnly: false,
|
|
19276
19278
|
disabled: false,
|
|
19277
19279
|
autoSize: false,
|
|
19278
19280
|
plain: false,
|
|
19279
19281
|
status: "default"
|
|
19280
19282
|
});
|
|
19281
|
-
var TextArea = function(props) {
|
|
19283
|
+
var TextArea = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
19282
19284
|
var locale = useConfig().locale;
|
|
19283
19285
|
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, [
|
|
19284
19286
|
"className",
|
|
@@ -19313,13 +19315,13 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
19313
19315
|
defaultValue,
|
|
19314
19316
|
finalValue: format2(defaultValue),
|
|
19315
19317
|
onChange
|
|
19316
|
-
}), 2),
|
|
19318
|
+
}), 2), innerValue = _usePropsValue[0], setInnerValue = _usePropsValue[1];
|
|
19317
19319
|
React.useEffect(function() {
|
|
19318
19320
|
if (autoSize) setContentHeight();
|
|
19319
19321
|
}, [
|
|
19320
19322
|
autoSize,
|
|
19321
19323
|
defaultValue,
|
|
19322
|
-
|
|
19324
|
+
innerValue
|
|
19323
19325
|
]);
|
|
19324
19326
|
var setContentHeight = function() {
|
|
19325
19327
|
var textarea = textareaRef.current;
|
|
@@ -19334,7 +19336,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
19334
19336
|
var handleChange = function(event) {
|
|
19335
19337
|
var text2 = event.target;
|
|
19336
19338
|
var value3 = compositionRef.current ? text2.value : format2(text2.value);
|
|
19337
|
-
|
|
19339
|
+
setInnerValue(value3);
|
|
19338
19340
|
};
|
|
19339
19341
|
var isDisabled = function() {
|
|
19340
19342
|
return disabled || readOnly;
|
|
@@ -19347,6 +19349,24 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
19347
19349
|
if (isDisabled()) return;
|
|
19348
19350
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
19349
19351
|
};
|
|
19352
|
+
React.useImperativeHandle(ref, function() {
|
|
19353
|
+
return {
|
|
19354
|
+
clear: function() {
|
|
19355
|
+
return setInnerValue("");
|
|
19356
|
+
},
|
|
19357
|
+
focus: function() {
|
|
19358
|
+
var _textareaRef_current;
|
|
19359
|
+
return (_textareaRef_current = textareaRef.current) === null || _textareaRef_current === void 0 ? void 0 : _textareaRef_current.focus();
|
|
19360
|
+
},
|
|
19361
|
+
blur: function() {
|
|
19362
|
+
var _textareaRef_current;
|
|
19363
|
+
return (_textareaRef_current = textareaRef.current) === null || _textareaRef_current === void 0 ? void 0 : _textareaRef_current.blur();
|
|
19364
|
+
},
|
|
19365
|
+
get nativeElement() {
|
|
19366
|
+
return textareaRef.current;
|
|
19367
|
+
}
|
|
19368
|
+
};
|
|
19369
|
+
});
|
|
19350
19370
|
var _obj;
|
|
19351
19371
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
19352
19372
|
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)
|
|
@@ -19356,7 +19376,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
19356
19376
|
style,
|
|
19357
19377
|
disabled,
|
|
19358
19378
|
readOnly,
|
|
19359
|
-
value:
|
|
19379
|
+
value: innerValue,
|
|
19360
19380
|
onChange: handleChange,
|
|
19361
19381
|
onBlur: handleBlur,
|
|
19362
19382
|
onFocus: handleFocus,
|
|
@@ -19371,8 +19391,8 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
19371
19391
|
placeholder: placeholder !== void 0 ? placeholder : locale.placeholder
|
|
19372
19392
|
})), showCount && /* @__PURE__ */ React.createElement("div", {
|
|
19373
19393
|
className: classNames("".concat(classPrefix2, "-limit"), _define_property({}, "".concat(classPrefix2, "-limit-disabled"), disabled))
|
|
19374
|
-
},
|
|
19375
|
-
};
|
|
19394
|
+
}, innerValue.length, "/", maxLength < 0 ? 0 : maxLength)));
|
|
19395
|
+
});
|
|
19376
19396
|
TextArea.displayName = "NutTextArea";
|
|
19377
19397
|
var defaultProps$K = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
19378
19398
|
percent: 0,
|
|
@@ -24016,47 +24036,63 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24016
24036
|
indicator: false,
|
|
24017
24037
|
loop: false,
|
|
24018
24038
|
duration: 3e3,
|
|
24019
|
-
|
|
24039
|
+
autoplay: false,
|
|
24020
24040
|
defaultValue: 0,
|
|
24021
24041
|
touchable: true,
|
|
24022
24042
|
effect: void 0
|
|
24023
24043
|
};
|
|
24024
24044
|
var Swiper = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
24025
|
-
var boundIndex = function boundIndex2(
|
|
24045
|
+
var boundIndex = function boundIndex2(current) {
|
|
24026
24046
|
var min = 0;
|
|
24027
24047
|
var max = count - 1;
|
|
24028
|
-
if (
|
|
24048
|
+
if (current === max && !loop2 && props.slideSize) {
|
|
24029
24049
|
var slideSize = props.slideSize;
|
|
24030
24050
|
var swiperSize = getSwiperSize();
|
|
24031
24051
|
var ratio = (swiperSize - slideSize) / slideSize;
|
|
24032
|
-
return bound2(
|
|
24052
|
+
return bound2(current, min, max - ratio);
|
|
24033
24053
|
}
|
|
24034
|
-
return
|
|
24054
|
+
return current;
|
|
24035
24055
|
};
|
|
24036
24056
|
var classPrefix2 = "nut-swiper";
|
|
24037
|
-
var _$_object_spread = _object_spread({}, defaultProps$i, props), children = _$_object_spread.children, direction = _$_object_spread.direction, indicator = _$_object_spread.indicator, loop2 = _$_object_spread.loop, effect2 = _$_object_spread.effect,
|
|
24057
|
+
var _$_object_spread = _object_spread({}, defaultProps$i, props), children = _$_object_spread.children, direction = _$_object_spread.direction, indicator = _$_object_spread.indicator, loop2 = _$_object_spread.loop, effect2 = _$_object_spread.effect, autoplay = _$_object_spread.autoplay, touchable = _$_object_spread.touchable, defaultValue = _$_object_spread.defaultValue, duration = _$_object_spread.duration, style = _$_object_spread.style, className = _$_object_spread.className;
|
|
24038
24058
|
var isVertical = direction === "vertical";
|
|
24039
24059
|
var count = React.useMemo(function() {
|
|
24040
24060
|
var c6 = 0;
|
|
24041
|
-
React.Children.map(children, function(
|
|
24061
|
+
React.Children.map(children, function() {
|
|
24042
24062
|
c6 += 1;
|
|
24043
24063
|
});
|
|
24044
24064
|
return c6;
|
|
24045
24065
|
}, [
|
|
24046
24066
|
children
|
|
24047
24067
|
]);
|
|
24068
|
+
var timeoutRef = React.useRef(null);
|
|
24069
|
+
var _useState = _sliced_to_array(React.useState(false), 2), dragging = _useState[0], setDragging = _useState[1];
|
|
24070
|
+
var _useRefState = _sliced_to_array(useRefState(defaultValue), 2), innerValue = _useRefState[0], setInnerValue = _useRefState[1];
|
|
24071
|
+
var stageRef = React.useRef(null);
|
|
24072
|
+
var swiperRef = React.useRef(null);
|
|
24073
|
+
var _useSpring = _sliced_to_array(useSpring(function() {
|
|
24074
|
+
return {
|
|
24075
|
+
x: !isVertical ? innerValue.current * 100 * -1 : 0,
|
|
24076
|
+
y: isVertical ? innerValue.current * 100 * -1 : 0,
|
|
24077
|
+
s: 0,
|
|
24078
|
+
reset: function() {
|
|
24079
|
+
},
|
|
24080
|
+
config: {
|
|
24081
|
+
tension: 200,
|
|
24082
|
+
friction: 30
|
|
24083
|
+
}
|
|
24084
|
+
};
|
|
24085
|
+
}), 2), springs = _useSpring[0], api = _useSpring[1];
|
|
24048
24086
|
var getSlideSize = function() {
|
|
24049
24087
|
if (props.slideSize) return props.slideSize;
|
|
24050
24088
|
if (stageRef.current) {
|
|
24051
|
-
|
|
24052
|
-
return stageRef.current.offsetWidth;
|
|
24089
|
+
return isVertical ? stageRef.current.offsetHeight : stageRef.current.offsetWidth;
|
|
24053
24090
|
}
|
|
24054
24091
|
return 0;
|
|
24055
24092
|
};
|
|
24056
24093
|
var getSwiperSize = function() {
|
|
24057
24094
|
if (swiperRef.current) {
|
|
24058
|
-
|
|
24059
|
-
return swiperRef.current.offsetWidth;
|
|
24095
|
+
return isVertical ? swiperRef.current.offsetHeight : swiperRef.current.offsetWidth;
|
|
24060
24096
|
}
|
|
24061
24097
|
return 0;
|
|
24062
24098
|
};
|
|
@@ -24069,51 +24105,44 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24069
24105
|
}
|
|
24070
24106
|
return v;
|
|
24071
24107
|
};
|
|
24072
|
-
var timeoutRef = React.useRef(null);
|
|
24073
|
-
var _useState = _sliced_to_array(React.useState(false), 2), dragging = _useState[0], setDragging = _useState[1];
|
|
24074
|
-
var _useRefState = _sliced_to_array(useRefState(defaultValue), 2), current = _useRefState[0], setCurrent = _useRefState[1];
|
|
24075
|
-
var stageRef = React.useRef(null);
|
|
24076
|
-
var swiperRef = React.useRef(null);
|
|
24077
|
-
var _useSpring = _sliced_to_array(useSpring(function() {
|
|
24078
|
-
return {
|
|
24079
|
-
x: !isVertical ? current.current * 100 * -1 : 0,
|
|
24080
|
-
y: isVertical ? current.current * 100 * -1 : 0,
|
|
24081
|
-
s: 0,
|
|
24082
|
-
reset: function() {
|
|
24083
|
-
},
|
|
24084
|
-
config: {
|
|
24085
|
-
tension: 200,
|
|
24086
|
-
friction: 30
|
|
24087
|
-
}
|
|
24088
|
-
};
|
|
24089
|
-
}), 2), springs = _useSpring[0], api = _useSpring[1];
|
|
24090
24108
|
React.useEffect(function() {
|
|
24091
24109
|
var _obj;
|
|
24092
|
-
api.start((_obj = {}, _define_property(_obj, isVertical ? "y" : "x", boundIndex(
|
|
24110
|
+
api.start((_obj = {}, _define_property(_obj, isVertical ? "y" : "x", boundIndex(innerValue.current) * -1 * 100), _define_property(_obj, "immediate", true), _obj));
|
|
24093
24111
|
}, [
|
|
24094
24112
|
swiperRef.current
|
|
24095
24113
|
]);
|
|
24096
24114
|
var swiperDirection = React.useRef(1);
|
|
24097
|
-
var _useList = _sliced_to_array(useList(effect2, count,
|
|
24098
|
-
var runTimeSwiper = function() {
|
|
24115
|
+
var _useList = _sliced_to_array(useList(effect2, count, innerValue), 2), transforms = _useList[0], setTransforms = _useList[1];
|
|
24116
|
+
var runTimeSwiper = React.useCallback(function() {
|
|
24099
24117
|
var durationNumber = typeof duration === "string" ? parseInt(duration) : duration;
|
|
24100
|
-
var d2 =
|
|
24118
|
+
var d2 = durationNumber;
|
|
24119
|
+
if (typeof props.autoPlay === "number") {
|
|
24120
|
+
d2 = props.autoPlay;
|
|
24121
|
+
} else if (typeof autoplay === "number") {
|
|
24122
|
+
d2 = autoplay;
|
|
24123
|
+
}
|
|
24101
24124
|
timeoutRef.current = window.setTimeout(function() {
|
|
24102
24125
|
next();
|
|
24103
24126
|
runTimeSwiper();
|
|
24104
24127
|
}, d2);
|
|
24105
|
-
}
|
|
24128
|
+
}, [
|
|
24129
|
+
props.autoPlay,
|
|
24130
|
+
autoplay,
|
|
24131
|
+
duration
|
|
24132
|
+
]);
|
|
24106
24133
|
React.useEffect(function() {
|
|
24107
|
-
|
|
24134
|
+
var shouldAutoplay = props.autoPlay || autoplay;
|
|
24135
|
+
if (!shouldAutoplay || dragging) return;
|
|
24108
24136
|
runTimeSwiper();
|
|
24109
24137
|
return function() {
|
|
24110
24138
|
if (timeoutRef.current) window.clearTimeout(timeoutRef.current);
|
|
24111
24139
|
};
|
|
24112
24140
|
}, [
|
|
24113
|
-
|
|
24141
|
+
autoplay,
|
|
24114
24142
|
duration,
|
|
24115
24143
|
dragging,
|
|
24116
|
-
count
|
|
24144
|
+
count,
|
|
24145
|
+
runTimeSwiper
|
|
24117
24146
|
]);
|
|
24118
24147
|
var to2 = function(index2) {
|
|
24119
24148
|
var immediate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
@@ -24123,7 +24152,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24123
24152
|
var cycleIndex = index2 % count;
|
|
24124
24153
|
targetIndex = cycleIndex < 0 ? cycleIndex + count : cycleIndex;
|
|
24125
24154
|
}
|
|
24126
|
-
|
|
24155
|
+
setInnerValue(targetIndex);
|
|
24127
24156
|
(_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, targetIndex);
|
|
24128
24157
|
if (effect2) {
|
|
24129
24158
|
updateTransform(transforms, setTransforms, effect2, targetIndex);
|
|
@@ -24187,13 +24216,10 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24187
24216
|
bounds: function() {
|
|
24188
24217
|
if (loop2) return {};
|
|
24189
24218
|
var slideSize = getSlideSize();
|
|
24190
|
-
|
|
24191
|
-
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
};
|
|
24195
|
-
}
|
|
24196
|
-
return {
|
|
24219
|
+
return isVertical ? {
|
|
24220
|
+
top: 0,
|
|
24221
|
+
bottom: (count - 1) * slideSize
|
|
24222
|
+
} : {
|
|
24197
24223
|
left: 0,
|
|
24198
24224
|
right: (count - 1) * slideSize
|
|
24199
24225
|
};
|
|
@@ -24207,13 +24233,13 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24207
24233
|
}
|
|
24208
24234
|
});
|
|
24209
24235
|
var renderIndicator = function() {
|
|
24210
|
-
if (/* @__PURE__ */ React.isValidElement(indicator)) return indicator;
|
|
24211
24236
|
if (!indicator) return null;
|
|
24237
|
+
if (/* @__PURE__ */ React.isValidElement(indicator)) return indicator;
|
|
24212
24238
|
var _obj;
|
|
24213
24239
|
return /* @__PURE__ */ React.createElement("div", {
|
|
24214
24240
|
className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-indicator"), true), _define_property(_obj, "".concat(classPrefix2, "-indicator-vertical"), isVertical), _define_property(_obj, "".concat(classPrefix2, "-indicator-horizontal"), !isVertical), _obj))
|
|
24215
24241
|
}, /* @__PURE__ */ React.createElement(Indicator, {
|
|
24216
|
-
current: getRefValue(
|
|
24242
|
+
current: getRefValue(innerValue),
|
|
24217
24243
|
total: count,
|
|
24218
24244
|
direction
|
|
24219
24245
|
}));
|
|
@@ -24234,7 +24260,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24234
24260
|
count,
|
|
24235
24261
|
isVertical,
|
|
24236
24262
|
effect: effect2,
|
|
24237
|
-
current,
|
|
24263
|
+
current: innerValue,
|
|
24238
24264
|
swiperDirection,
|
|
24239
24265
|
dragging,
|
|
24240
24266
|
transforms
|