@nutui/nutui-react-taro 3.0.9 → 3.0.10
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 +27 -11
- package/dist/cjs/packages/pickerview/pickerroller.js +4 -3
- package/dist/cjs/packages/pickerview/pickerview.js +2 -1
- package/dist/cjs/packages/radio/radio.js +2 -2
- package/dist/cjs/packages/switch/switch.js +22 -9
- package/dist/cjs/packages/tabs/tabs.js +9 -3
- package/dist/cjs/packages/uploader/uploader.js +5 -3
- package/dist/cjs/packages/video/video.d.ts +2 -1
- package/dist/cjs/packages/video/video.js +17 -8
- package/dist/cjs/types/spec/switch/base.d.ts +2 -0
- package/dist/cjs/types/spec/uploader/base.d.ts +1 -0
- package/dist/cjs/utils/get-rect.js +1 -1
- package/dist/cjs/utils/supports-passive.js +1 -1
- package/dist/es/packages/pickerview/pickerroller.js +4 -3
- package/dist/es/packages/pickerview/pickerview.js +2 -1
- package/dist/es/packages/radio/radio.js +2 -2
- package/dist/es/packages/switch/switch.js +22 -9
- package/dist/es/packages/tabs/tabs.js +9 -3
- package/dist/es/packages/uploader/uploader.js +5 -3
- package/dist/es/packages/video/video.d.ts +2 -1
- package/dist/es/packages/video/video.js +17 -8
- package/dist/es/types/spec/switch/base.d.ts +9 -1
- package/dist/es/types/spec/uploader/base.d.ts +4 -0
- package/dist/es/utils/get-rect.js +1 -1
- package/dist/es/utils/supports-passive.js +1 -1
- package/dist/nutui.react.umd.js +61 -30
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +33 -33
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +39 -39
- package/dist/style.css +1 -1
- package/dist/style.scss +45 -45
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ export function isWindow(val) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
if (element && element.getBoundingClientRect) {
|
|
28
|
-
console.log(element, element.getBoundingClientRect())
|
|
28
|
+
// console.log(element, element.getBoundingClientRect())
|
|
29
29
|
return element.getBoundingClientRect();
|
|
30
30
|
}
|
|
31
31
|
return {
|
package/dist/nutui.react.umd.js
CHANGED
|
@@ -3223,7 +3223,7 @@
|
|
|
3223
3223
|
});
|
|
3224
3224
|
window.addEventListener("test-passive-supported", null, opts);
|
|
3225
3225
|
} catch (e) {
|
|
3226
|
-
console.log(e);
|
|
3226
|
+
console.log("supported passive error", e);
|
|
3227
3227
|
}
|
|
3228
3228
|
}
|
|
3229
3229
|
var totalLockCount = 0;
|
|
@@ -3885,7 +3885,6 @@
|
|
|
3885
3885
|
};
|
|
3886
3886
|
}
|
|
3887
3887
|
if (element && element.getBoundingClientRect) {
|
|
3888
|
-
console.log(element, element.getBoundingClientRect());
|
|
3889
3888
|
return element.getBoundingClientRect();
|
|
3890
3889
|
}
|
|
3891
3890
|
return {
|
|
@@ -5265,7 +5264,7 @@
|
|
|
5265
5264
|
var scrollIntoView = function(index2) {
|
|
5266
5265
|
requestAniFrame$1(function() {
|
|
5267
5266
|
Promise.all([
|
|
5268
|
-
getRect2("#nut-tabs-titles-".concat(name2 || uuid
|
|
5267
|
+
getRect2("#nut-tabs-titles-".concat(name2 || uuid)),
|
|
5269
5268
|
getAllRect("#nut-tabs-titles-".concat(name2 || uuid, " .nut-tabs-titles-item"))
|
|
5270
5269
|
]).then(function(param) {
|
|
5271
5270
|
var _param = _sliced_to_array(param, 2), navRect = _param[0], titleRects = _param[1];
|
|
@@ -5273,15 +5272,21 @@
|
|
|
5273
5272
|
if (!titleRect) return;
|
|
5274
5273
|
var to = 0;
|
|
5275
5274
|
if (direction === "vertical") {
|
|
5275
|
+
var totalHeight = titleRects.reduce(function(sum2, curr) {
|
|
5276
|
+
return sum2 + curr.height;
|
|
5277
|
+
}, 0);
|
|
5276
5278
|
var top = titleRects.slice(0, index2).reduce(function(prev, curr) {
|
|
5277
5279
|
return prev + curr.height;
|
|
5278
5280
|
}, 0);
|
|
5279
|
-
to = top - (navRect.height - titleRect.height) / 2;
|
|
5281
|
+
to = Math.min(Math.max(0, top - (navRect.height - titleRect.height) / 2), totalHeight - navRect.height);
|
|
5280
5282
|
} else {
|
|
5283
|
+
var totalWidth = titleRects.reduce(function(sum2, curr) {
|
|
5284
|
+
return sum2 + curr.width;
|
|
5285
|
+
}, 0);
|
|
5281
5286
|
var left2 = titleRects.slice(0, index2).reduce(function(prev, curr) {
|
|
5282
5287
|
return prev + curr.width;
|
|
5283
5288
|
}, 0);
|
|
5284
|
-
to = left2 - (navRect.width - titleRect.width) / 2;
|
|
5289
|
+
to = Math.min(Math.max(0, left2 - (navRect.width - titleRect.width) / 2), totalWidth - navRect.width);
|
|
5285
5290
|
}
|
|
5286
5291
|
scrollDirection(to, direction);
|
|
5287
5292
|
Taro.nextTick(function() {
|
|
@@ -8549,10 +8554,11 @@
|
|
|
8549
8554
|
}, threeDimensional && options.map(function(item, index2) {
|
|
8550
8555
|
var _item_value;
|
|
8551
8556
|
var _obj;
|
|
8552
|
-
return /* @__PURE__ */ React.createElement(React.Fragment,
|
|
8553
|
-
className: classNames("".concat(classPrefix2, "-item"), (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-item-hidden"), isItemHidden(index2 + 1)), _define_property(_obj, "".concat(classPrefix2, "-item-active"), index2 + 1 === currentIndex), _obj)),
|
|
8554
|
-
style: rollerStyle(index2),
|
|
8557
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
8555
8558
|
key: (_item_value = item.value) !== null && _item_value !== void 0 ? _item_value : index2
|
|
8559
|
+
}, isGetLineSpacing ? /* @__PURE__ */ React.createElement(components.View, {
|
|
8560
|
+
className: classNames("".concat(classPrefix2, "-item"), (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-item-hidden"), isItemHidden(index2 + 1)), _define_property(_obj, "".concat(classPrefix2, "-item-active"), index2 + 1 === currentIndex), _obj)),
|
|
8561
|
+
style: rollerStyle(index2)
|
|
8556
8562
|
}, renderLabel(item)) : null);
|
|
8557
8563
|
}), !threeDimensional && options.map(function(item, index2) {
|
|
8558
8564
|
var _item_value;
|
|
@@ -8652,7 +8658,7 @@
|
|
|
8652
8658
|
]);
|
|
8653
8659
|
var handleSelect = React.useCallback(function(option, index2) {
|
|
8654
8660
|
var newValue = option === null || option === void 0 ? void 0 : option.value;
|
|
8655
|
-
if (
|
|
8661
|
+
if (isEmpty(newValue) || innerValue[index2] === newValue) return;
|
|
8656
8662
|
changeIndex.current = index2;
|
|
8657
8663
|
if (columnsType === "multiple") {
|
|
8658
8664
|
setInnerValue(function(prev) {
|
|
@@ -12165,13 +12171,13 @@
|
|
|
12165
12171
|
}
|
|
12166
12172
|
if (checkedStatement) {
|
|
12167
12173
|
return /* @__PURE__ */ React.isValidElement(activeIcon) ? /* @__PURE__ */ React.cloneElement(activeIcon, _object_spread_props(_object_spread({}, activeIcon.props), {
|
|
12168
|
-
className: classNames(color())
|
|
12174
|
+
className: classNames(activeIcon.props.className, color())
|
|
12169
12175
|
})) : /* @__PURE__ */ React.createElement(IconSVG$u, {
|
|
12170
12176
|
className: classNames(color())
|
|
12171
12177
|
});
|
|
12172
12178
|
}
|
|
12173
12179
|
return /* @__PURE__ */ React.isValidElement(icon) ? /* @__PURE__ */ React.cloneElement(icon, _object_spread_props(_object_spread({}, icon.props), {
|
|
12174
|
-
className: classNames(color())
|
|
12180
|
+
className: classNames(icon.props.className, color())
|
|
12175
12181
|
})) : /* @__PURE__ */ React.createElement(IconSVG$s, {
|
|
12176
12182
|
className: classNames(color())
|
|
12177
12183
|
});
|
|
@@ -13437,10 +13443,13 @@
|
|
|
13437
13443
|
disabled: false,
|
|
13438
13444
|
activeText: "",
|
|
13439
13445
|
inactiveText: "",
|
|
13440
|
-
loadingIcon: /* @__PURE__ */ React.createElement(IconSVG$h, null)
|
|
13446
|
+
loadingIcon: /* @__PURE__ */ React.createElement(IconSVG$h, null),
|
|
13447
|
+
loading: void 0,
|
|
13448
|
+
onLoadingChange: function(loading) {
|
|
13449
|
+
}
|
|
13441
13450
|
});
|
|
13442
13451
|
var Switch = function(props) {
|
|
13443
|
-
var _ref = _object_spread({}, defaultProps$M, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, loadingIcon = _ref.loadingIcon, className = _ref.className, style = _ref.style, onChange = _ref.onChange, rest = _object_without_properties(_ref, [
|
|
13452
|
+
var _ref = _object_spread({}, defaultProps$M, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, loadingIcon = _ref.loadingIcon, className = _ref.className, style = _ref.style, onChange = _ref.onChange, propLoading = _ref.loading, onLoadingChange = _ref.onLoadingChange, rest = _object_without_properties(_ref, [
|
|
13444
13453
|
"checked",
|
|
13445
13454
|
"defaultChecked",
|
|
13446
13455
|
"disabled",
|
|
@@ -13449,7 +13458,9 @@
|
|
|
13449
13458
|
"loadingIcon",
|
|
13450
13459
|
"className",
|
|
13451
13460
|
"style",
|
|
13452
|
-
"onChange"
|
|
13461
|
+
"onChange",
|
|
13462
|
+
"loading",
|
|
13463
|
+
"onLoadingChange"
|
|
13453
13464
|
]);
|
|
13454
13465
|
var classPrefix2 = "nut-switch";
|
|
13455
13466
|
var rtl = useRtl();
|
|
@@ -13457,12 +13468,20 @@
|
|
|
13457
13468
|
value: checked,
|
|
13458
13469
|
defaultValue: defaultChecked
|
|
13459
13470
|
}), 2), value2 = _usePropsValue[0], setValue = _usePropsValue[1];
|
|
13471
|
+
var _useState = _sliced_to_array(React.useState(false), 2), internalLoading = _useState[0], setInternalLoading = _useState[1];
|
|
13472
|
+
var loading = propLoading !== void 0 ? propLoading : internalLoading;
|
|
13473
|
+
var setLoading = function(val2) {
|
|
13474
|
+
if (propLoading !== void 0) {
|
|
13475
|
+
onLoadingChange(val2);
|
|
13476
|
+
} else {
|
|
13477
|
+
setInternalLoading(val2);
|
|
13478
|
+
}
|
|
13479
|
+
};
|
|
13460
13480
|
React.useEffect(function() {
|
|
13461
|
-
|
|
13481
|
+
loading && setLoading(false);
|
|
13462
13482
|
}, [
|
|
13463
13483
|
value2
|
|
13464
13484
|
]);
|
|
13465
|
-
var _useState = _sliced_to_array(React.useState(false), 2), changing = _useState[0], setChanging = _useState[1];
|
|
13466
13485
|
var classes = function() {
|
|
13467
13486
|
var _obj2;
|
|
13468
13487
|
return classNames([
|
|
@@ -13476,14 +13495,15 @@
|
|
|
13476
13495
|
return __generator(this, function(_state) {
|
|
13477
13496
|
switch (_state.label) {
|
|
13478
13497
|
case 0:
|
|
13479
|
-
if (disabled ||
|
|
13498
|
+
if (disabled || loading) return [
|
|
13480
13499
|
2
|
|
13481
13500
|
];
|
|
13482
13501
|
if (!onChange) return [
|
|
13483
13502
|
3,
|
|
13484
13503
|
4
|
|
13485
13504
|
];
|
|
13486
|
-
|
|
13505
|
+
loadingIcon && setLoading(true);
|
|
13506
|
+
onChange(!value2);
|
|
13487
13507
|
_state.label = 1;
|
|
13488
13508
|
case 1:
|
|
13489
13509
|
_state.trys.push([
|
|
@@ -13504,7 +13524,7 @@
|
|
|
13504
13524
|
];
|
|
13505
13525
|
case 3:
|
|
13506
13526
|
_state.sent();
|
|
13507
|
-
|
|
13527
|
+
setLoading(false);
|
|
13508
13528
|
return [
|
|
13509
13529
|
3,
|
|
13510
13530
|
4
|
|
@@ -13536,7 +13556,7 @@
|
|
|
13536
13556
|
],
|
|
13537
13557
|
(_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-button-open-rtl"), rtl && value2), _define_property(_obj, "".concat(classPrefix2, "-button-close-rtl"), rtl && !value2), _obj)
|
|
13538
13558
|
])
|
|
13539
|
-
},
|
|
13559
|
+
}, loading && loadingIcon ? /* @__PURE__ */ React.createElement(React.Fragment, null, loadingIcon) : /* @__PURE__ */ React.createElement(React.Fragment, null, !value2 && !activeText && /* @__PURE__ */ React.createElement(components.View, {
|
|
13540
13560
|
className: "".concat(classPrefix2, "-close-line")
|
|
13541
13561
|
}))), activeText && /* @__PURE__ */ React.createElement(components.View, {
|
|
13542
13562
|
className: classNames("".concat(classPrefix2, "-label"), (_obj1 = {}, _define_property(_obj1, "".concat(classPrefix2, "-label-open"), value2), _define_property(_obj1, "".concat(classPrefix2, "-label-close"), !value2), _define_property(_obj1, "".concat(classPrefix2, "-label-open-rtl"), rtl && value2), _define_property(_obj1, "".concat(classPrefix2, "-label-close-rtl"), rtl && !value2), _define_property(_obj1, "".concat(classPrefix2, "-label-close-disabled"), disabled && !value2), _obj1))
|
|
@@ -13944,7 +13964,7 @@
|
|
|
13944
13964
|
});
|
|
13945
13965
|
var InternalUploader = function(props, ref) {
|
|
13946
13966
|
var locale = useConfig().locale;
|
|
13947
|
-
var _ref = _object_spread({}, defaultProps$J, props), children = _ref.children, uploadIcon = _ref.uploadIcon, deleteIcon = _ref.deleteIcon, uploadLabel = _ref.uploadLabel, accept = _ref.accept;
|
|
13967
|
+
var _ref = _object_spread({}, defaultProps$J, props), children = _ref.children, uploadIcon = _ref.uploadIcon, deleteIcon = _ref.deleteIcon, uploadLabel = _ref.uploadLabel, listUploadRender = _ref.listUploadRender, accept = _ref.accept;
|
|
13948
13968
|
_ref.name;
|
|
13949
13969
|
var camera = _ref.camera, defaultValue = _ref.defaultValue, value2 = _ref.value, previewType = _ref.previewType;
|
|
13950
13970
|
_ref.fit;
|
|
@@ -13953,6 +13973,7 @@
|
|
|
13953
13973
|
"uploadIcon",
|
|
13954
13974
|
"deleteIcon",
|
|
13955
13975
|
"uploadLabel",
|
|
13976
|
+
"listUploadRender",
|
|
13956
13977
|
"accept",
|
|
13957
13978
|
"name",
|
|
13958
13979
|
"camera",
|
|
@@ -14333,9 +14354,10 @@
|
|
|
14333
14354
|
onFileItemClick === null || onFileItemClick === void 0 ? void 0 : onFileItemClick(file, index2);
|
|
14334
14355
|
};
|
|
14335
14356
|
var renderListUploader = function() {
|
|
14336
|
-
|
|
14357
|
+
if (previewType !== "list") return null;
|
|
14358
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
14337
14359
|
className: "nut-uploader-slot"
|
|
14338
|
-
}, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
|
|
14360
|
+
}, listUploadRender || /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
|
|
14339
14361
|
size: "small",
|
|
14340
14362
|
type: "primary"
|
|
14341
14363
|
}, locale.uploader.list), Number(maxCount) > fileList.length && /* @__PURE__ */ React.createElement(Button, {
|
|
@@ -40018,27 +40040,36 @@
|
|
|
40018
40040
|
};
|
|
40019
40041
|
var classPrefix$2 = "nut-video";
|
|
40020
40042
|
var Video = function(props) {
|
|
40021
|
-
var
|
|
40043
|
+
var _props_options;
|
|
40044
|
+
var _mergeProps = mergeProps(defaultProps$8, props), source = _mergeProps.source, options = _mergeProps.options, className = _mergeProps.className, style = _mergeProps.style, src = _mergeProps.src, muted = _mergeProps.muted, loop = _mergeProps.loop, poster = _mergeProps.poster, controls = _mergeProps.controls, autoplay = _mergeProps.autoplay, onPlay = _mergeProps.onPlay, onPause = _mergeProps.onPause, onPlayEnd = _mergeProps.onPlayEnd, restProps = _object_without_properties(_mergeProps, [
|
|
40022
40045
|
"source",
|
|
40023
40046
|
"options",
|
|
40024
40047
|
"className",
|
|
40025
40048
|
"style",
|
|
40049
|
+
"src",
|
|
40050
|
+
"muted",
|
|
40051
|
+
"loop",
|
|
40052
|
+
"poster",
|
|
40053
|
+
"controls",
|
|
40054
|
+
"autoplay",
|
|
40026
40055
|
"onPlay",
|
|
40027
40056
|
"onPause",
|
|
40028
40057
|
"onPlayEnd"
|
|
40029
40058
|
]);
|
|
40030
40059
|
var classes = classNames(classPrefix$2, className);
|
|
40060
|
+
var _props_options_controls, _ref;
|
|
40061
|
+
var effectiveControls = (_ref = (_props_options_controls = (_props_options = props.options) === null || _props_options === void 0 ? void 0 : _props_options.controls) !== null && _props_options_controls !== void 0 ? _props_options_controls : controls) !== null && _ref !== void 0 ? _ref : options.controls;
|
|
40031
40062
|
return /* @__PURE__ */ React.createElement(components.View, {
|
|
40032
40063
|
className: classes,
|
|
40033
40064
|
style
|
|
40034
40065
|
}, /* @__PURE__ */ React.createElement(components.Video, _object_spread({
|
|
40035
40066
|
className: "".concat(classPrefix$2, "-player"),
|
|
40036
|
-
muted: options.muted,
|
|
40037
|
-
autoplay: options.autoplay,
|
|
40038
|
-
loop: options.loop,
|
|
40039
|
-
poster: options.poster,
|
|
40040
|
-
controls:
|
|
40041
|
-
src: source.src,
|
|
40067
|
+
muted: options.muted || muted,
|
|
40068
|
+
autoplay: options.autoplay || autoplay,
|
|
40069
|
+
loop: options.loop || loop,
|
|
40070
|
+
poster: options.poster || poster,
|
|
40071
|
+
controls: effectiveControls,
|
|
40072
|
+
src: source.src || src,
|
|
40042
40073
|
onPlay,
|
|
40043
40074
|
onPause,
|
|
40044
40075
|
onEnded: onPlayEnd
|