@nutui/nutui-react 2.0.0-alpha.0 → 2.0.0-alpha.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 +137 -638
- package/dist/esm/Address.js +1 -1
- package/dist/esm/Animate.js +6 -7
- package/dist/esm/Audio.js +28 -27
- package/dist/esm/Avatar.js +30 -25
- package/dist/esm/AvatarGroup.js +10 -15
- package/dist/esm/Badge.js +4 -73
- package/dist/esm/CalendarItem.js +2 -12
- package/dist/esm/Cascader.js +67 -69
- package/dist/esm/Checkbox.js +1 -2
- package/dist/esm/CheckboxGroup.js +18 -20
- package/dist/esm/CircleProgress.js +20 -25
- package/dist/esm/Col.js +4 -3
- package/dist/esm/DatePicker.js +10 -10
- package/dist/esm/Dialog.js +162 -171
- package/dist/esm/Divider.js +4 -3
- package/dist/esm/Drag.js +7 -9
- package/dist/esm/Elevator.js +39 -41
- package/dist/esm/Ellipsis.js +13 -12
- package/dist/esm/Empty.js +18 -26
- package/dist/esm/Image.js +5 -10
- package/dist/esm/ImagePreview.js +67 -58
- package/dist/esm/Indicator.js +4 -4
- package/dist/esm/Input.js +87 -193
- package/dist/esm/Menu.js +75 -73
- package/dist/esm/MenuItem.js +29 -27
- package/dist/esm/NavBar.js +17 -48
- package/dist/esm/NoticeBar.js +50 -87
- package/dist/esm/Notify.js +35 -46
- package/dist/esm/NumberKeyboard.js +137 -195
- package/dist/esm/Picker.js +175 -160
- package/dist/esm/Popup.js +24 -33
- package/dist/esm/Price.js +22 -23
- package/dist/esm/Progress.js +74 -67
- package/dist/esm/PullToRefresh.js +8 -8
- package/dist/esm/Radio.js +2 -0
- package/dist/esm/RadioGroup.js +31 -51
- package/dist/esm/Range/style/index.js +1 -1
- package/dist/esm/Range.js +119 -174
- package/dist/esm/Row.js +6 -5
- package/dist/esm/SideNavBar.js +0 -2
- package/dist/esm/Skeleton.js +1 -1
- package/dist/esm/Step.js +23 -28
- package/dist/esm/Steps/style/index.js +1 -1
- package/dist/esm/Steps.js +10 -11
- package/dist/esm/Swipe.js +4 -10
- package/dist/esm/Swiper.js +86 -91
- package/dist/esm/SwiperItem.js +1 -1
- package/dist/esm/Switch.js +16 -30
- package/dist/esm/TabPane.js +39 -5
- package/dist/esm/Tabbar/style/index.js +1 -1
- package/dist/esm/Tabbar.js +29 -33
- package/dist/esm/TabbarItem.js +5 -75
- package/dist/esm/Table.js +20 -34
- package/dist/esm/Tabs.js +2 -2
- package/dist/esm/TextArea.js +53 -81
- package/dist/esm/Uploader.js +49 -52
- package/dist/esm/badge2.js +69 -0
- package/dist/esm/cellgroup2.js +5 -4
- package/dist/esm/checkbox2.js +34 -47
- package/dist/esm/nutui-react.es.js +170 -170
- package/dist/esm/overlay2.js +12 -14
- package/dist/esm/radio2.js +52 -54
- package/dist/esm/raf.js +16 -0
- package/dist/esm/tabbaritem2.js +61 -0
- package/dist/esm/tabs2.js +126 -95
- 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/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.mjs +23562 -24489
- package/dist/nutui.react.umd.js +23560 -24487
- package/dist/packages/audio/audio.scss +2 -15
- package/dist/packages/badge/badge.scss +8 -18
- package/dist/packages/calendar/calendar.scss +0 -30
- package/dist/packages/cascader/cascader.scss +0 -26
- package/dist/packages/cellgroup/cellgroup.scss +20 -16
- package/dist/packages/checkbox/checkbox.scss +8 -11
- package/dist/packages/circleprogress/circleprogress.scss +0 -9
- package/dist/packages/dialog/dialog.scss +36 -65
- package/dist/packages/elevator/elevator.scss +2 -28
- package/dist/packages/empty/empty.scss +0 -9
- package/dist/packages/imagepreview/imagepreview.scss +52 -16
- package/dist/packages/input/input.scss +13 -180
- package/dist/packages/menu/menu.scss +44 -55
- package/dist/packages/menuitem/menuitem.scss +16 -26
- package/dist/packages/navbar/navbar.scss +16 -115
- package/dist/packages/noticebar/noticebar.scss +18 -19
- package/dist/packages/notify/notify.scss +1 -1
- package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
- package/dist/packages/overlay/overlay.scss +11 -4
- package/dist/packages/picker/picker.scss +66 -137
- package/dist/packages/popup/popup.scss +0 -16
- package/dist/packages/price/price.scss +8 -0
- package/dist/packages/progress/progress.scss +19 -58
- package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -8
- package/dist/packages/radio/radio.scss +13 -32
- package/dist/packages/radiogroup/radiogroup.scss +17 -51
- package/dist/packages/range/range.scss +24 -49
- package/dist/packages/row/row.scss +13 -31
- package/dist/packages/sidenavbar/sidenavbar.scss +0 -19
- package/dist/packages/step/step.scss +9 -62
- package/dist/packages/steps/steps.scss +2 -0
- package/dist/packages/swiper/swiper.scss +3 -18
- package/dist/packages/switch/switch.scss +13 -31
- package/dist/packages/tabbar/tabbar.scss +16 -22
- package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
- package/dist/packages/table/table.scss +0 -56
- package/dist/packages/tabs/tabs.scss +196 -225
- package/dist/packages/textarea/textarea.scss +5 -12
- package/dist/packages/uploader/uploader.scss +2 -28
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +17 -18
- package/dist/styles/variables-jmapp.scss +120 -240
- package/dist/styles/variables.scss +139 -252
- package/dist/types/index.d.ts +565 -708
- package/package.json +2 -2
- package/dist/esm/Icon.js +0 -83
- package/dist/esm/tabpane2.js +0 -44
- package/dist/packages/icon/icon.scss +0 -0
- /package/dist/esm/{AvatarContext.js → context.js} +0 -0
- /package/dist/esm/{UserContext2.js → context2.js} +0 -0
- /package/dist/esm/{UserContext3.js → context3.js} +0 -0
package/dist/esm/Address.js
CHANGED
|
@@ -348,7 +348,7 @@ var CustomRender = function CustomRender2(props) {
|
|
|
348
348
|
className: b("elevator-group")
|
|
349
349
|
}, React__default.createElement(Elevator, {
|
|
350
350
|
height,
|
|
351
|
-
|
|
351
|
+
list: regionList[tabName[tabIndex]],
|
|
352
352
|
onClickItem: handleElevatorItem
|
|
353
353
|
})));
|
|
354
354
|
};
|
package/dist/esm/Animate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["className", "type", "action", "loop", "onClick", "children"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
@@ -25,23 +25,22 @@ function _objectSpread(target) {
|
|
|
25
25
|
}
|
|
26
26
|
import React__default, { useState } from "react";
|
|
27
27
|
import classNames from "classnames";
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
var defaultProps = {
|
|
28
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
29
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
31
30
|
type: "shake",
|
|
32
31
|
action: "initial",
|
|
33
32
|
loop: false,
|
|
34
33
|
onClick: function onClick(event) {
|
|
35
34
|
}
|
|
36
|
-
};
|
|
35
|
+
});
|
|
36
|
+
var classPrefix = "nut-animate";
|
|
37
37
|
var Animate = function Animate2(props) {
|
|
38
38
|
var _classNames;
|
|
39
39
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, type = _defaultProps$props.type, action = _defaultProps$props.action, loop = _defaultProps$props.loop, onClick2 = _defaultProps$props.onClick, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
40
40
|
var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), clicked = _useState2[0], setClicked = _useState2[1];
|
|
41
|
-
var b = cn("animate");
|
|
42
41
|
var classes = classNames((_classNames = {
|
|
43
42
|
"nut-ani-container": true
|
|
44
|
-
}, _defineProperty(_classNames, "".concat(
|
|
43
|
+
}, _defineProperty(_classNames, "".concat(classPrefix, "-").concat(type), action === "initial" || clicked ? type : false), _defineProperty(_classNames, "loop", loop), _classNames));
|
|
45
44
|
var cls = classNames(classes, className);
|
|
46
45
|
var handleClick = function handleClick2(event) {
|
|
47
46
|
setClicked(true);
|
package/dist/esm/Audio.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["className", "
|
|
4
|
+
var _excluded = ["className", "src", "style", "muted", "autoPlay", "loop", "preload", "type", "onBack", "onForward", "onPause", "onEnd", "onMute", "onCanPlay", "children"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -25,28 +25,25 @@ function _objectSpread(target) {
|
|
|
25
25
|
}
|
|
26
26
|
import React__default, { useState, useRef, useEffect } from "react";
|
|
27
27
|
import { Service } from "@nutui/icons-react";
|
|
28
|
+
import classNames from "classnames";
|
|
28
29
|
import Range from "./Range.js";
|
|
29
|
-
import { c as cn } from "./bem.js";
|
|
30
30
|
import Button from "./Button.js";
|
|
31
31
|
import { useConfig } from "./ConfigProvider.js";
|
|
32
32
|
import { C as ComponentDefaults } from "./typings.js";
|
|
33
|
-
import "@bem-react/classname";
|
|
34
33
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
35
|
-
|
|
36
|
-
url: "",
|
|
37
|
-
style: {},
|
|
34
|
+
src: "",
|
|
38
35
|
muted: false,
|
|
39
|
-
|
|
36
|
+
autoPlay: false,
|
|
40
37
|
loop: false,
|
|
41
38
|
preload: "auto",
|
|
42
39
|
type: "progress",
|
|
43
|
-
|
|
40
|
+
onBack: function onBack(e) {
|
|
44
41
|
},
|
|
45
42
|
onForward: function onForward(e) {
|
|
46
43
|
},
|
|
47
44
|
onPause: function onPause(e) {
|
|
48
45
|
},
|
|
49
|
-
|
|
46
|
+
onEnd: function onEnd(e) {
|
|
50
47
|
},
|
|
51
48
|
onMute: function onMute(e) {
|
|
52
49
|
},
|
|
@@ -55,7 +52,7 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
55
52
|
});
|
|
56
53
|
var Audio = function Audio2(props) {
|
|
57
54
|
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
58
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className,
|
|
55
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, src = _defaultProps$props.src, style = _defaultProps$props.style, muted = _defaultProps$props.muted, autoPlay = _defaultProps$props.autoPlay, loop = _defaultProps$props.loop, preload = _defaultProps$props.preload, type = _defaultProps$props.type, onBack2 = _defaultProps$props.onBack, onForward2 = _defaultProps$props.onForward, onPause2 = _defaultProps$props.onPause, onEnd2 = _defaultProps$props.onEnd, onMute2 = _defaultProps$props.onMute, onCanPlay2 = _defaultProps$props.onCanPlay, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
59
56
|
var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), playing = _useState2[0], setPlaying = _useState2[1];
|
|
60
57
|
var _useState3 = useState(0), _useState4 = _slicedToArray(_useState3, 2), percent = _useState4[0], setPercent = _useState4[1];
|
|
61
58
|
var _useState5 = useState(false), _useState6 = _slicedToArray(_useState5, 2), isCanPlay = _useState6[0], setIsCanPlay = _useState6[1];
|
|
@@ -68,16 +65,16 @@ var Audio = function Audio2(props) {
|
|
|
68
65
|
duration: "00:00:00",
|
|
69
66
|
second: 0,
|
|
70
67
|
hanMuted: props.muted,
|
|
71
|
-
playing: props.
|
|
68
|
+
playing: props.autoPlay,
|
|
72
69
|
handPlaying: false
|
|
73
70
|
});
|
|
74
|
-
var
|
|
71
|
+
var classPrefix = "nut-audio";
|
|
75
72
|
var warn = console.warn;
|
|
76
73
|
var handleEnded = function handleEnded2(e) {
|
|
77
74
|
if (props.loop) {
|
|
78
75
|
warn(locale.audio.tips || "onPlayEnd事件在loop=false时才会触发");
|
|
79
76
|
} else {
|
|
80
|
-
props.
|
|
77
|
+
props.onEnd && props.onEnd(e);
|
|
81
78
|
}
|
|
82
79
|
};
|
|
83
80
|
function watch() {
|
|
@@ -102,20 +99,20 @@ var Audio = function Audio2(props) {
|
|
|
102
99
|
}
|
|
103
100
|
};
|
|
104
101
|
var renderIcon = function renderIcon2() {
|
|
105
|
-
return React__default.createElement(
|
|
106
|
-
className:
|
|
102
|
+
return React__default.createElement("div", {
|
|
103
|
+
className: "".concat(classPrefix, "__icon")
|
|
107
104
|
}, React__default.createElement("div", {
|
|
108
|
-
className: "".concat(
|
|
105
|
+
className: classNames("".concat(classPrefix, "__icon-box"), playing ? "".concat(classPrefix, "__icon-play") : "".concat(classPrefix, "__icon-stop")),
|
|
109
106
|
onClick: handleStatusChange
|
|
110
107
|
}, React__default.createElement(Service, {
|
|
111
108
|
className: playing ? "nut-icon-loading" : ""
|
|
112
|
-
})))
|
|
109
|
+
})));
|
|
113
110
|
};
|
|
114
111
|
var handleBack = function handleBack2() {
|
|
115
112
|
if (statusRef.current.currentTime > 0 && AudioRef.current) {
|
|
116
113
|
statusRef.current.currentTime--;
|
|
117
114
|
AudioRef.current.currentTime = statusRef.current.currentTime;
|
|
118
|
-
props.
|
|
115
|
+
props.onBack && props.onBack(AudioRef.current);
|
|
119
116
|
}
|
|
120
117
|
};
|
|
121
118
|
var handleForward = function handleForward2() {
|
|
@@ -151,15 +148,19 @@ var Audio = function Audio2(props) {
|
|
|
151
148
|
};
|
|
152
149
|
var renderProgerss = function renderProgerss2() {
|
|
153
150
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
154
|
-
className:
|
|
151
|
+
className: "".concat(classPrefix, "__progress")
|
|
155
152
|
}, React__default.createElement("div", {
|
|
156
153
|
className: "time"
|
|
157
154
|
}, currentDuration), React__default.createElement("div", {
|
|
158
|
-
className:
|
|
155
|
+
className: "".concat(classPrefix, "__progress-bar-wrapper")
|
|
159
156
|
}, React__default.createElement(Range, {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
157
|
+
value: percent,
|
|
158
|
+
onChange: function onChange(val) {
|
|
159
|
+
return setPercent(val);
|
|
160
|
+
},
|
|
161
|
+
currentDescription: null,
|
|
162
|
+
maxDescription: null,
|
|
163
|
+
minDescription: null,
|
|
163
164
|
"inactive-color": "#cccccc",
|
|
164
165
|
"active-color": "#fa2c19"
|
|
165
166
|
})), React__default.createElement("div", {
|
|
@@ -188,7 +189,7 @@ var Audio = function Audio2(props) {
|
|
|
188
189
|
};
|
|
189
190
|
var renderNone = function renderNone2() {
|
|
190
191
|
return React__default.createElement("div", {
|
|
191
|
-
className:
|
|
192
|
+
className: "".concat(classPrefix, "__none-container"),
|
|
192
193
|
onClick: handleStatusChange
|
|
193
194
|
}, children);
|
|
194
195
|
};
|
|
@@ -206,7 +207,7 @@ var Audio = function Audio2(props) {
|
|
|
206
207
|
};
|
|
207
208
|
var handleCanplay = function handleCanplay2(e) {
|
|
208
209
|
setIsCanPlay(true);
|
|
209
|
-
if (props.
|
|
210
|
+
if (props.autoPlay && !playing) {
|
|
210
211
|
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
211
212
|
}
|
|
212
213
|
if (AudioRef.current) {
|
|
@@ -223,13 +224,13 @@ var Audio = function Audio2(props) {
|
|
|
223
224
|
statusRef.current.currentTime = time;
|
|
224
225
|
};
|
|
225
226
|
return React__default.createElement("div", _objectSpread({
|
|
226
|
-
className:
|
|
227
|
+
className: classNames(classPrefix, className),
|
|
227
228
|
style
|
|
228
229
|
}, rest), renderAudio(), React__default.createElement("audio", {
|
|
229
230
|
className: "audioMain",
|
|
230
231
|
controls: type === "controls",
|
|
231
232
|
ref: AudioRef,
|
|
232
|
-
src
|
|
233
|
+
src,
|
|
233
234
|
muted,
|
|
234
235
|
preload,
|
|
235
236
|
loop,
|
package/dist/esm/Avatar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["children", "
|
|
4
|
+
var _excluded = ["children", "size", "shape", "background", "color", "src", "alt", "icon", "fit", "className", "style", "onClick", "onError"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -25,41 +25,42 @@ function _objectSpread(target) {
|
|
|
25
25
|
}
|
|
26
26
|
import React__default, { useState, useRef, useContext, useEffect } from "react";
|
|
27
27
|
import classNames from "classnames";
|
|
28
|
-
import { A as AvatarContext } from "./
|
|
29
|
-
import {
|
|
28
|
+
import { A as AvatarContext } from "./context.js";
|
|
29
|
+
import { My } from "@nutui/icons-react";
|
|
30
|
+
import Image from "./Image.js";
|
|
30
31
|
import { C as ComponentDefaults } from "./typings.js";
|
|
31
|
-
import "@bem-react/classname";
|
|
32
32
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
33
33
|
size: "",
|
|
34
|
+
shape: "round",
|
|
34
35
|
icon: "",
|
|
35
|
-
|
|
36
|
+
background: "#eee",
|
|
36
37
|
color: "#666",
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
fit: "cover",
|
|
39
|
+
src: "",
|
|
39
40
|
alt: ""
|
|
40
41
|
});
|
|
42
|
+
var classPrefix = "nut-avatar";
|
|
41
43
|
var Avatar = function Avatar2(props) {
|
|
42
44
|
var _parent$propAvatarGro, _parent$propAvatarGro2, _classNames, _parent$propAvatarGro3, _parent$propAvatarGro4, _parent$propAvatarGro5, _parent$propAvatarGro6, _parent$propAvatarGro7, _parent$propAvatarGro9, _parent$propAvatarGro10, _parent$propAvatarGro11, _parent$propAvatarGro12, _parent$propAvatarGro13, _parent$propAvatarGro14, _parent$propAvatarGro15;
|
|
43
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children,
|
|
45
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, size = _defaultProps$props.size, shape = _defaultProps$props.shape, background = _defaultProps$props.background, color = _defaultProps$props.color, src = _defaultProps$props.src, alt = _defaultProps$props.alt, icon = _defaultProps$props.icon, fit = _defaultProps$props.fit, className = _defaultProps$props.className, style = _defaultProps$props.style, onClick = _defaultProps$props.onClick, onError = _defaultProps$props.onError, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
44
46
|
var _useState = useState(0), _useState2 = _slicedToArray(_useState, 2), maxSum = _useState2[0], setMaxSum = _useState2[1];
|
|
45
47
|
var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), showMax = _useState4[0], setShowMax = _useState4[1];
|
|
46
48
|
var _useState5 = useState(1), _useState6 = _slicedToArray(_useState5, 2), avatarIndex = _useState6[0], setAvatarIndex = _useState6[1];
|
|
47
49
|
var avatarRef = useRef(null);
|
|
48
50
|
var parent = useContext(AvatarContext);
|
|
49
|
-
var b = cn("avatar");
|
|
50
|
-
var classes = classNames((_classNames = {}, _defineProperty(_classNames, "nut-avatar-".concat(size || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro = parent.propAvatarGroup) === null || _parent$propAvatarGro === void 0 ? void 0 : _parent$propAvatarGro.size) || "normal"), true), _defineProperty(_classNames, "nut-avatar-".concat(shape || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro2 = parent.propAvatarGroup) === null || _parent$propAvatarGro2 === void 0 ? void 0 : _parent$propAvatarGro2.shape) || "round"), true), _classNames));
|
|
51
|
-
var cls = classNames(b(""), classes, className);
|
|
52
51
|
var sizeValue = ["large", "normal", "small"];
|
|
52
|
+
var classes = classNames((_classNames = {}, _defineProperty(_classNames, "nut-avatar-".concat((parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro = parent.propAvatarGroup) === null || _parent$propAvatarGro === void 0 ? void 0 : _parent$propAvatarGro.size) || size || "normal"), true), _defineProperty(_classNames, "nut-avatar-".concat((parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro2 = parent.propAvatarGroup) === null || _parent$propAvatarGro2 === void 0 ? void 0 : _parent$propAvatarGro2.shape) || shape), true), _classNames));
|
|
53
|
+
var cls = classNames(classPrefix, classes, className);
|
|
53
54
|
var styles = _objectSpread({
|
|
54
55
|
width: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
|
|
55
56
|
height: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
|
|
56
|
-
backgroundColor: "".concat(
|
|
57
|
+
backgroundColor: "".concat(background),
|
|
57
58
|
color: "".concat(color),
|
|
58
|
-
marginLeft: avatarIndex !== 1 && parent !== null && parent !== void 0 && (_parent$propAvatarGro3 = parent.propAvatarGroup) !== null && _parent$propAvatarGro3 !== void 0 && _parent$propAvatarGro3.
|
|
59
|
-
zIndex: (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro5 = parent.propAvatarGroup) === null || _parent$propAvatarGro5 === void 0 ? void 0 : _parent$propAvatarGro5.
|
|
59
|
+
marginLeft: avatarIndex !== 1 && parent !== null && parent !== void 0 && (_parent$propAvatarGro3 = parent.propAvatarGroup) !== null && _parent$propAvatarGro3 !== void 0 && _parent$propAvatarGro3.gap ? "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro4 = parent.propAvatarGroup) === null || _parent$propAvatarGro4 === void 0 ? void 0 : _parent$propAvatarGro4.gap, "px") : "",
|
|
60
|
+
zIndex: (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro5 = parent.propAvatarGroup) === null || _parent$propAvatarGro5 === void 0 ? void 0 : _parent$propAvatarGro5.level) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
|
|
60
61
|
}, style);
|
|
61
62
|
var maxStyles = {
|
|
62
|
-
backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.
|
|
63
|
+
backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBackground),
|
|
63
64
|
color: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro7 = parent.propAvatarGroup) === null || _parent$propAvatarGro7 === void 0 ? void 0 : _parent$propAvatarGro7.maxColor)
|
|
64
65
|
};
|
|
65
66
|
useEffect(function() {
|
|
@@ -77,40 +78,44 @@ var Avatar = function Avatar2(props) {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
var index = Number(avatarRef === null || avatarRef === void 0 ? void 0 : (_avatarRef$current = avatarRef.current) === null || _avatarRef$current === void 0 ? void 0 : (_avatarRef$current$da = _avatarRef$current.dataset) === null || _avatarRef$current$da === void 0 ? void 0 : _avatarRef$current$da.index);
|
|
80
|
-
var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.
|
|
81
|
+
var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.max;
|
|
81
82
|
setMaxSum(children2.length);
|
|
82
83
|
setAvatarIndex(index);
|
|
83
84
|
if (index === children2.length && index !== maxCount && children2.length > maxCount) {
|
|
84
85
|
setShowMax(true);
|
|
85
86
|
}
|
|
86
87
|
};
|
|
87
|
-
var errorEvent = function errorEvent2(
|
|
88
|
+
var errorEvent = function errorEvent2() {
|
|
88
89
|
if (props.onError) {
|
|
89
|
-
props.onError(
|
|
90
|
+
props.onError();
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
var clickAvatar = function clickAvatar2(e) {
|
|
93
|
-
|
|
94
|
-
onActiveAvatar && onActiveAvatar(e);
|
|
94
|
+
onClick && onClick(e);
|
|
95
95
|
};
|
|
96
|
-
return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.
|
|
96
|
+
return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.max) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro10 = parent.propAvatarGroup) === null || _parent$propAvatarGro10 === void 0 ? void 0 : _parent$propAvatarGro10.max)) && React__default.createElement("div", _objectSpread(_objectSpread({
|
|
97
97
|
className: cls
|
|
98
98
|
}, rest), {}, {
|
|
99
99
|
style: !showMax ? styles : maxStyles,
|
|
100
100
|
onClick: clickAvatar,
|
|
101
101
|
ref: avatarRef
|
|
102
|
-
}), (!(parent !== null && parent !== void 0 && (_parent$propAvatarGro11 = parent.propAvatarGroup) !== null && _parent$propAvatarGro11 !== void 0 && _parent$propAvatarGro11.
|
|
102
|
+
}), (!(parent !== null && parent !== void 0 && (_parent$propAvatarGro11 = parent.propAvatarGroup) !== null && _parent$propAvatarGro11 !== void 0 && _parent$propAvatarGro11.max) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro12 = parent.propAvatarGroup) === null || _parent$propAvatarGro12 === void 0 ? void 0 : _parent$propAvatarGro12.max)) && React__default.createElement(React__default.Fragment, null, src && React__default.createElement(Image, {
|
|
103
103
|
className: "avatar-img",
|
|
104
|
-
src
|
|
104
|
+
src,
|
|
105
105
|
alt,
|
|
106
|
+
style: {
|
|
107
|
+
objectFit: fit
|
|
108
|
+
},
|
|
106
109
|
onError: errorEvent
|
|
107
110
|
}), React__default.isValidElement(icon) ? React__default.cloneElement(icon, _objectSpread(_objectSpread({}, icon.props), {}, {
|
|
108
111
|
className: "".concat(icon.props.className || "", " icon")
|
|
109
112
|
})) : null, children && React__default.createElement("span", {
|
|
110
113
|
className: "text"
|
|
111
|
-
}, children)
|
|
114
|
+
}, children), !src && !icon && !children && React__default.createElement(My, {
|
|
115
|
+
className: "icon"
|
|
116
|
+
})), showMax && React__default.createElement("div", {
|
|
112
117
|
className: "text"
|
|
113
|
-
}, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.
|
|
118
|
+
}, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.max)))));
|
|
114
119
|
};
|
|
115
120
|
Avatar.defaultProps = defaultProps;
|
|
116
121
|
Avatar.displayName = "NutAvatar";
|
package/dist/esm/AvatarGroup.js
CHANGED
|
@@ -22,27 +22,22 @@ function _objectSpread(target) {
|
|
|
22
22
|
}
|
|
23
23
|
import React__default, { useRef } from "react";
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import { A as AvatarContext } from "./
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
import "@bem-react/classname";
|
|
29
|
-
var defaultProps = {
|
|
25
|
+
import { A as AvatarContext } from "./context.js";
|
|
26
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
30
28
|
maxContent: "",
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
max: "",
|
|
30
|
+
maxBackground: "#eee",
|
|
33
31
|
maxColor: "#666",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
32
|
+
gap: "-8",
|
|
33
|
+
level: "left"
|
|
34
|
+
});
|
|
35
|
+
var classPrefix = "nut-avatar-group";
|
|
39
36
|
var AvatarGroup = function AvatarGroup2(props) {
|
|
40
|
-
useConfig();
|
|
41
37
|
var propAvatarGroup = _objectSpread(_objectSpread({}, defaultProps), props);
|
|
42
38
|
var className = propAvatarGroup.className, style = propAvatarGroup.style, children = propAvatarGroup.children;
|
|
43
39
|
var avatarGroupRef = useRef(null);
|
|
44
|
-
var
|
|
45
|
-
var cls = classNames(b(""), className);
|
|
40
|
+
var cls = classNames(classPrefix, className);
|
|
46
41
|
var parentAvatar = {
|
|
47
42
|
propAvatarGroup,
|
|
48
43
|
avatarGroupRef
|
package/dist/esm/Badge.js
CHANGED
|
@@ -1,76 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
7
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
8
|
-
})), keys.push.apply(keys, symbols);
|
|
9
|
-
}
|
|
10
|
-
return keys;
|
|
11
|
-
}
|
|
12
|
-
function _objectSpread(target) {
|
|
13
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
15
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
16
|
-
_defineProperty(target, key, source[key]);
|
|
17
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
18
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
}
|
|
23
|
-
import React__default from "react";
|
|
24
|
-
import classNames from "classnames";
|
|
25
|
-
import { c as cn } from "./bem.js";
|
|
26
|
-
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
-
import "@bem-react/classname";
|
|
28
|
-
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
29
|
-
className: "",
|
|
30
|
-
value: "",
|
|
31
|
-
dot: false,
|
|
32
|
-
max: 1e4,
|
|
33
|
-
top: "0",
|
|
34
|
-
right: "0",
|
|
35
|
-
zIndex: "0",
|
|
36
|
-
color: "",
|
|
37
|
-
icon: null
|
|
38
|
-
});
|
|
39
|
-
var b = cn("badge");
|
|
40
|
-
var Badge = function Badge2(props) {
|
|
41
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, children = _defaultProps$props.children, dot = _defaultProps$props.dot, top = _defaultProps$props.top, right = _defaultProps$props.right, zIndex = _defaultProps$props.zIndex, color = _defaultProps$props.color, icon = _defaultProps$props.icon;
|
|
42
|
-
function content() {
|
|
43
|
-
if (dot)
|
|
44
|
-
return void 0;
|
|
45
|
-
var value = props.value;
|
|
46
|
-
var max = props.max;
|
|
47
|
-
if (typeof value === "number" && typeof max === "number") {
|
|
48
|
-
return max < value ? "".concat(max, "+") : value;
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
var getStyle = function getStyle2() {
|
|
53
|
-
var style2 = {};
|
|
54
|
-
style2.top = "".concat(Number(top) || parseFloat(top) || 0, "px");
|
|
55
|
-
style2.right = "".concat(Number(right) || parseFloat(right) || 0, "px");
|
|
56
|
-
style2.zIndex = zIndex;
|
|
57
|
-
style2.background = color;
|
|
58
|
-
return style2;
|
|
59
|
-
};
|
|
60
|
-
return React__default.createElement("div", {
|
|
61
|
-
className: classNames(b(), className),
|
|
62
|
-
style
|
|
63
|
-
}, icon && React__default.createElement("div", {
|
|
64
|
-
className: "slot-icon"
|
|
65
|
-
}, icon), React__default.createElement("div", null, children), React__default.createElement("div", {
|
|
66
|
-
className: classNames({
|
|
67
|
-
"is-dot": dot
|
|
68
|
-
}, b("content"), "sup"),
|
|
69
|
-
style: getStyle()
|
|
70
|
-
}, content()));
|
|
71
|
-
};
|
|
72
|
-
Badge.defaultProps = defaultProps;
|
|
73
|
-
Badge.displayName = "NutBadge";
|
|
1
|
+
import { B as Badge } from "./badge2.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "classnames";
|
|
4
|
+
import "./typings.js";
|
|
74
5
|
export {
|
|
75
6
|
Badge as default
|
|
76
7
|
};
|
package/dist/esm/CalendarItem.js
CHANGED
|
@@ -26,19 +26,9 @@ import React__default, { useState, useRef, useEffect } from "react";
|
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import { c as cn } from "./bem.js";
|
|
28
28
|
import { U as Utils } from "./date.js";
|
|
29
|
+
import { r as requestAniFrame } from "./raf.js";
|
|
29
30
|
import { useConfig } from "./ConfigProvider.js";
|
|
30
31
|
import "@bem-react/classname";
|
|
31
|
-
function requestAniFrame() {
|
|
32
|
-
if (typeof window !== "undefined") {
|
|
33
|
-
return window.requestAnimationFrame || function(callback) {
|
|
34
|
-
window.setTimeout(callback, 1e3 / 60);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
return function(callback) {
|
|
38
|
-
setTimeout(callback, 1e3 / 60);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var requestAniFrame$1 = requestAniFrame();
|
|
42
32
|
var defaultProps = {
|
|
43
33
|
type: "one",
|
|
44
34
|
isAutoBackFill: false,
|
|
@@ -510,7 +500,7 @@ var CalendarItem = React__default.forwardRef(function(props, ref) {
|
|
|
510
500
|
}
|
|
511
501
|
var lastItem = state.monthsData[state.monthsData.length - 1];
|
|
512
502
|
var containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
|
|
513
|
-
requestAniFrame
|
|
503
|
+
requestAniFrame(function() {
|
|
514
504
|
if (months && monthsPanel && viewArea) {
|
|
515
505
|
viewHeight = months.current.clientHeight;
|
|
516
506
|
monthsPanel.current.style.height = "".concat(containerHeight, "px");
|