@nutui/nutui-react-taro 2.6.20 → 2.6.22
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 +30 -5
- package/dist/esm/Address.js +1 -1
- package/dist/esm/AnimatingNumbers.js +7 -7
- package/dist/esm/Audio/style/style.css +1 -1
- package/dist/esm/Audio.js +1 -1
- package/dist/esm/Avatar.js +1 -1
- package/dist/esm/AvatarCropper.js +1 -1
- package/dist/esm/BackTop.js +1 -1
- package/dist/esm/Barrage.js +1 -1
- package/dist/esm/Button.js +1 -1
- package/dist/esm/Calendar.js +1 -1
- package/dist/esm/CalendarItem.js +1 -1
- package/dist/esm/Cascader.js +1 -1
- package/dist/esm/Dialog.js +1 -1
- package/dist/esm/Empty.js +1 -1
- package/dist/esm/Menu.js +1 -1
- package/dist/esm/MenuItem.js +1 -1
- package/dist/esm/NavBar/style/style.css +1 -1
- package/dist/esm/NavBar.js +1 -1
- package/dist/esm/Radio.js +1 -1
- package/dist/esm/RadioGroup.js +1 -1
- package/dist/esm/Range/style/style.css +1 -1
- package/dist/esm/Range.js +1 -1
- package/dist/esm/Skeleton.js +1 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/{address.taro-CWr6jIYg.js → address.taro-Ai6DQF3D.js} +1 -1
- package/dist/esm/{audio.taro--yoX2oyx.js → audio.taro-qK1wq4IH.js} +4 -5
- package/dist/esm/avatar.taro-9dU2KeWv.js +82 -0
- package/dist/esm/{avatarcropper.taro-B0I9uLNp.js → avatarcropper.taro-meD2sizv.js} +1 -1
- package/dist/esm/{backtop.taro-CpzSXDW3.js → backtop.taro-D3Lo3jFO.js} +8 -10
- package/dist/esm/{barrage.taro-CA-9uADD.js → barrage.taro-D2lmvcB-.js} +40 -26
- package/dist/esm/{button.taro-1kEru6r9.js → button.taro-CixO32Hw.js} +2 -2
- package/dist/esm/{calendar.taro-Csq-7imv.js → calendar.taro-C52T1TFf.js} +1 -1
- package/dist/esm/{calendaritem.taro-BOMJjsx9.js → calendaritem.taro-CHdJXKkc.js} +1 -1
- package/dist/esm/{cascader.taro-DZ_oBTm0.js → cascader.taro-CMOCzo0m.js} +1 -1
- package/dist/esm/{dialog.taro-Bg730q8d.js → dialog.taro-yjDaaRHA.js} +1 -1
- package/dist/esm/{empty.taro-Dr4eSaDg.js → empty.taro-Dt07kty5.js} +1 -1
- package/dist/esm/{menu.taro-BFc4uUxG.js → menu.taro-BmjnA_YM.js} +13 -13
- package/dist/esm/{menuitem.taro-D6KQvdRw.js → menuitem.taro-DCqPC4Nu.js} +13 -13
- package/dist/esm/{navbar.taro-Dea0-s9Q.js → navbar.taro-HRFRDGii.js} +7 -2
- package/dist/esm/nutui-react.es.js +20 -20
- package/dist/esm/{radio.taro-CzOHqD3O.js → radio.taro-M2in687s.js} +24 -20
- package/dist/esm/{raf-zwv-SBjP.js → raf-Di10dXPS.js} +2 -1
- package/dist/esm/{range.taro-BilM3sMH.js → range.taro-D4U2Q7Wx.js} +49 -44
- package/dist/esm/{skeleton.taro-bD6fHZop.js → skeleton.taro-D9Vkgsyx.js} +1 -1
- package/dist/esm/{tabs.taro-CJiI4q_-.js → tabs.taro-D8bDfm4x.js} +1 -1
- package/dist/esm/{uploader.taro-C-8Jf7un.js → uploader.taro-CceZ5Y4t.js} +8 -7
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +262 -284
- package/dist/nutui.react.umd.js +262 -284
- package/dist/packages/navbar/navbar.scss +0 -5
- package/dist/packages/range/range.scss +2 -0
- package/dist/style.css +1 -1
- package/dist/types/packages/avatar/avatar.d.ts +1 -1
- package/dist/types/packages/overlay/overlay.d.ts +1 -1
- package/dist/types/packages/uploader/uploader.d.ts +1 -0
- package/dist/types/packages/uploader/uploader.taro.d.ts +5 -0
- package/package.json +1 -1
- package/dist/esm/avatar.taro-DSL3ErmC.js +0 -85
|
@@ -4,10 +4,10 @@ import { default as AvatarGroup } from '../avatargroup';
|
|
|
4
4
|
export interface AvatarProps extends BasicComponent {
|
|
5
5
|
size: string;
|
|
6
6
|
icon: React.ReactNode;
|
|
7
|
-
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
8
7
|
shape: AvatarShape;
|
|
9
8
|
background: string;
|
|
10
9
|
color: string;
|
|
10
|
+
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
11
11
|
src: string;
|
|
12
12
|
alt: string;
|
|
13
13
|
onClick: (e: MouseEvent<HTMLDivElement>) => void;
|
|
@@ -5,7 +5,7 @@ export interface OverlayProps extends BasicComponent {
|
|
|
5
5
|
duration: number;
|
|
6
6
|
closeOnOverlayClick: boolean;
|
|
7
7
|
visible: boolean;
|
|
8
|
-
lockScroll: boolean;
|
|
8
|
+
lockScroll: boolean | 'strict';
|
|
9
9
|
onClick: (event: MouseEvent) => void;
|
|
10
10
|
afterShow: () => void;
|
|
11
11
|
afterClose: () => void;
|
|
@@ -11,6 +11,7 @@ export interface UploaderProps extends BasicComponent {
|
|
|
11
11
|
previewType: 'picture' | 'list';
|
|
12
12
|
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
13
13
|
uploadIcon?: React.ReactNode;
|
|
14
|
+
deleteIcon?: React.ReactNode;
|
|
14
15
|
uploadLabel?: React.ReactNode;
|
|
15
16
|
name: string;
|
|
16
17
|
accept: string;
|
package/package.json
CHANGED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { _ as __rest } from "./tslib.es6-iWu3F_1J.js";
|
|
2
|
-
import React__default, { useState, useRef, useContext, useEffect } from "react";
|
|
3
|
-
import Taro, { getEnv } from "@tarojs/taro";
|
|
4
|
-
import classNames from "classnames";
|
|
5
|
-
import { User } from "@nutui/icons-react-taro";
|
|
6
|
-
import { I as Image } from "./image.taro-CyF6ujA7.js";
|
|
7
|
-
import { a as AvatarContext, A as AvatarGroup } from "./avatargroup.taro-ScakjsY1.js";
|
|
8
|
-
import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
|
|
9
|
-
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { size: "", shape: "round", icon: "", fit: "cover", background: "#eee", color: "#666", src: "", alt: "" });
|
|
10
|
-
const classPrefix = `nut-avatar`;
|
|
11
|
-
const Avatar = (props) => {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
13
|
-
const _q = Object.assign(Object.assign({}, defaultProps), props), { children, size, shape, background, color, src, icon, fit, alt, className, style, onClick, onError } = _q, rest = __rest(_q, ["children", "size", "shape", "background", "color", "src", "icon", "fit", "alt", "className", "style", "onClick", "onError"]);
|
|
14
|
-
const [maxSum, setMaxSum] = useState(0);
|
|
15
|
-
const [showMax, setShowMax] = useState(false);
|
|
16
|
-
const [avatarIndex, setAvatarIndex] = useState(1);
|
|
17
|
-
const avatarRef = useRef(null);
|
|
18
|
-
const parent = useContext(AvatarContext);
|
|
19
|
-
const sizeValue = ["large", "normal", "small"];
|
|
20
|
-
const classes = classNames({
|
|
21
|
-
[`nut-avatar-${((_a = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _a === void 0 ? void 0 : _a.size) || size || "normal"}`]: true,
|
|
22
|
-
[`nut-avatar-${((_b = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _b === void 0 ? void 0 : _b.shape) || shape}`]: true
|
|
23
|
-
});
|
|
24
|
-
const cls = classNames(classPrefix, classes, className);
|
|
25
|
-
const styles = Object.assign({ width: sizeValue.indexOf(size) > -1 ? "" : `${size}px`, height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`, backgroundColor: `${background}`, color, marginLeft: avatarIndex !== 1 && ((_c = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _c === void 0 ? void 0 : _c.gap) ? `${(_d = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _d === void 0 ? void 0 : _d.gap}px` : "", zIndex: ((_e = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _e === void 0 ? void 0 : _e.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "" }, style);
|
|
26
|
-
const maxStyles = {
|
|
27
|
-
backgroundColor: `${(_f = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _f === void 0 ? void 0 : _f.maxBackground}`,
|
|
28
|
-
color: `${(_g = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _g === void 0 ? void 0 : _g.maxColor}`
|
|
29
|
-
};
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
var _a2;
|
|
32
|
-
const avatarChildren = (_a2 = parent === null || parent === void 0 ? void 0 : parent.avatarGroupRef) === null || _a2 === void 0 ? void 0 : _a2.current.children;
|
|
33
|
-
if (avatarChildren) {
|
|
34
|
-
avatarLength(avatarChildren);
|
|
35
|
-
}
|
|
36
|
-
}, []);
|
|
37
|
-
const isAvatarInClassList = (element) => {
|
|
38
|
-
var _a2, _b2;
|
|
39
|
-
if (getEnv() === Taro.ENV_TYPE.WEB) {
|
|
40
|
-
return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
|
|
41
|
-
}
|
|
42
|
-
return ((_a2 = element.classList) === null || _a2 === void 0 ? void 0 : _a2.tokenList[0]) === "nut-avatar" || ((_b2 = element.classList) === null || _b2 === void 0 ? void 0 : _b2.tokenList.values().next().value) === "nut-avatar";
|
|
43
|
-
};
|
|
44
|
-
const avatarLength = (children2) => {
|
|
45
|
-
var _a2, _b2, _c2;
|
|
46
|
-
for (let i = 0; i < children2.length; i++) {
|
|
47
|
-
if (children2[i] && children2[i].classList && isAvatarInClassList(children2[i])) {
|
|
48
|
-
children2[i].setAttribute("data-index", i + 1);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const index = (_b2 = (_a2 = avatarRef === null || avatarRef === void 0 ? void 0 : avatarRef.current) === null || _a2 === void 0 ? void 0 : _a2.dataset) === null || _b2 === void 0 ? void 0 : _b2.index;
|
|
52
|
-
const maxCount = (_c2 = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _c2 === void 0 ? void 0 : _c2.max;
|
|
53
|
-
setMaxSum(children2.length);
|
|
54
|
-
setAvatarIndex(index);
|
|
55
|
-
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
56
|
-
setShowMax(true);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const errorEvent = () => {
|
|
60
|
-
if (onError) {
|
|
61
|
-
onError();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const clickAvatar = (e) => {
|
|
65
|
-
onClick && onClick(e);
|
|
66
|
-
};
|
|
67
|
-
return React__default.createElement(React__default.Fragment, null, (showMax || !((_h = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _h === void 0 ? void 0 : _h.max) || avatarIndex <= ((_j = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _j === void 0 ? void 0 : _j.max)) && React__default.createElement(
|
|
68
|
-
"div",
|
|
69
|
-
Object.assign({ className: cls }, rest, { style: !showMax ? styles : maxStyles, onClick: clickAvatar, ref: avatarRef }),
|
|
70
|
-
(!((_k = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _k === void 0 ? void 0 : _k.max) || avatarIndex <= ((_l = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _l === void 0 ? void 0 : _l.max)) && React__default.createElement(
|
|
71
|
-
React__default.Fragment,
|
|
72
|
-
null,
|
|
73
|
-
src && React__default.createElement(Image, { className: "avatar-img", src, style: { objectFit: fit }, onError: errorEvent }),
|
|
74
|
-
React__default.isValidElement(icon) ? React__default.cloneElement(icon, Object.assign(Object.assign({}, icon.props), { className: `${icon.props.className || ""} icon` })) : null,
|
|
75
|
-
children && React__default.createElement("span", { className: "text" }, children),
|
|
76
|
-
!src && !icon && !children && React__default.createElement(User, { className: "icon" })
|
|
77
|
-
),
|
|
78
|
-
showMax && React__default.createElement("div", { className: "text" }, ((_m = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _m === void 0 ? void 0 : _m.maxContent) ? (_o = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _o === void 0 ? void 0 : _o.maxContent : `+ ${avatarIndex - Number(((_p = parent === null || parent === void 0 ? void 0 : parent.propAvatarGroup) === null || _p === void 0 ? void 0 : _p.max) || 0)}`)
|
|
79
|
-
));
|
|
80
|
-
};
|
|
81
|
-
Avatar.displayName = "NutAvatar";
|
|
82
|
-
Avatar.Group = AvatarGroup;
|
|
83
|
-
export {
|
|
84
|
-
Avatar as A
|
|
85
|
-
};
|