@nutui/nutui-react 2.0.0-alpha.1 → 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 +105 -0
- package/dist/esm/Address.js +1 -1
- package/dist/esm/Animate.js +6 -7
- package/dist/esm/Audio.js +12 -8
- 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/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 +2 -4
- 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/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 +2 -3
- 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 +21778 -22695
- package/dist/nutui.react.umd.js +21776 -22693
- package/dist/packages/badge/badge.scss +8 -18
- 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/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/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/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 +541 -680
- 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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,108 @@
|
|
|
1
|
+
# v2.0.0-alpha.10
|
|
2
|
+
`2023-05-19`
|
|
3
|
+
|
|
4
|
+
* :sparkles: feat(progress): 添加 lazy、delay 属性 (#1023) @Eiinu
|
|
5
|
+
* :bug: fix: swiper loop 模式位置计算错误 (#1018) @oasis-cloud
|
|
6
|
+
* 🛠 refactor: imagepreview (#1019) @xiaoyatong
|
|
7
|
+
* 🛠 refactor: noticebar (#1024) @xiaoyatong
|
|
8
|
+
* 🛠 refactor: steps (#1021) @oasis-cloud
|
|
9
|
+
* 📖 docs: icon 文档修订 (#1022) @oasis-cloud
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# v2.0.0-alpha.9
|
|
13
|
+
`2023-05-17`
|
|
14
|
+
|
|
15
|
+
* :sparkles: feat: add createProperties.js (#1001) @Eiinu
|
|
16
|
+
* :sparkles: feat: cascader支持受控 (#1000) @xiaoyatong
|
|
17
|
+
* :sparkles: feat: elevator 支持右侧索引是否展示 (#1006) @拧巴的猫
|
|
18
|
+
* :bug: fix(image): lazy 优化观察对象数量 (#1015) @Eiinu
|
|
19
|
+
* :bug: fix: tabs children 变更后需要展示新的 title (#999) @oasis-cloud
|
|
20
|
+
* :bug: fix: 格式化,删掉某些无用代码 (#1014) @xiaoyatong
|
|
21
|
+
* 🛠 refactor: notify (#983) @拧巴的猫
|
|
22
|
+
* 🛠 refactor: NumberKeyboard (#1012) @Eiinu
|
|
23
|
+
* 🛠 refactor: price (#989) @拧巴的猫
|
|
24
|
+
* 🛠 refactor: pulltorefresh (#1011) @oasis-cloud
|
|
25
|
+
* 🛠 refactor: radio (#1009) @oasis-cloud
|
|
26
|
+
* 🛠 refactor: Range (#991) @Eiinu
|
|
27
|
+
* 🛠 refactor: swiper 重构;indcator 的索引计算改为从 0 开始 (#1008) @oasis-cloud
|
|
28
|
+
* 🔨 chore: autoplay -> autoPlay (#1007) @Eiinu
|
|
29
|
+
* 📖 docs(tabbar): update description (#1004) @Eiinu
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# v2.0.0-alpha.8
|
|
33
|
+
`2023-05-12`
|
|
34
|
+
* :sparkles:feat: cascader支持受控 (#1000) @xiaoyatong
|
|
35
|
+
* :bug: fix: tabs children 变更后需要展示新的 title (#999) @oasis-cloud
|
|
36
|
+
* 🛠 refactor: Range (#991) @Eiinu
|
|
37
|
+
|
|
38
|
+
# v2.0.0-alpha.7
|
|
39
|
+
`2023-05-12`
|
|
40
|
+
* :bug: fix: tabs children 变化需要更新选中状态 @oasis-cloud
|
|
41
|
+
|
|
42
|
+
# v2.0.0-alpha.6
|
|
43
|
+
`2023-05-12`
|
|
44
|
+
|
|
45
|
+
* 🛠 refactor: cascader (#993) @xiaoyatong
|
|
46
|
+
* 🛠 refactor: picker (#975) @xiaoyatong
|
|
47
|
+
* 🛠 refactor: table (#982) @xiaoyatong
|
|
48
|
+
* 🛠 refactor: TextArea (#979) @Eiinu
|
|
49
|
+
* :bug: fix: image src 初始状态未空,导致出发加载失败事件 (#988) @oasis-cloud
|
|
50
|
+
* 📖 docs(progress): demo 代码更新 (#986) @Eiinu
|
|
51
|
+
* 📖 docs(progress): update demo (#987) @Eiinu
|
|
52
|
+
* 📖 docs: tabs 文档中的 titleNode 修改为 title (#995) @oasis-cloud
|
|
53
|
+
* 🔨 chore: taro es 构建移入 vite 配置文件 (#990) @oasis-cloud
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# v2.0.0-alpha.5
|
|
57
|
+
`2023-05-10`
|
|
58
|
+
|
|
59
|
+
* 🛠 refactor: checkbox (#974) @oasis-cloud
|
|
60
|
+
* 🛠 refactor: circleprogress-v2.0 (#949) @junjun666
|
|
61
|
+
* 🛠 refactor: ellipsis-v2.0 (#963) @junjun666
|
|
62
|
+
* 🛠 refactor: empty-v2.0 (#977) @junjun666
|
|
63
|
+
* 🛠 refactor: swipe (#958) @justExplore
|
|
64
|
+
* 🛠 refactor:avatar-v2.0 (#970) @junjun666
|
|
65
|
+
* 📖 docs: 增加 icon 的复制功能 (#973) @oasis-cloud
|
|
66
|
+
* :sparkles: feat: cellgroup组件增加单元格之间是否展示分割线props (#961) @拧巴的猫
|
|
67
|
+
* :bug: fix: tabbar 通过 Tabbar.Item 方式使用未加载 item 的样式 (#972) @oasis-cloud
|
|
68
|
+
* :bug: fix: 修复elevator小程序快速滑动后闪动问题 (#984) @拧巴的猫
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# v2.0.0-alpha.4
|
|
72
|
+
`2023-05-05`
|
|
73
|
+
|
|
74
|
+
* 🛠 refactor: circleprogress-v2.0 (#949) @junjun666
|
|
75
|
+
* 🛠 refactor: input (#962) @oasis-cloud
|
|
76
|
+
* 🛠 refactor: Tabbar (#935) @Eiinu
|
|
77
|
+
* :bug: fix: badge 组件的默认样式中,去掉 margin-right (#967) @xiaoyatong
|
|
78
|
+
* 🎨 style: fix endLine display error (#964) @HaiTao
|
|
79
|
+
|
|
80
|
+
# v2.0.0-alpha.3
|
|
81
|
+
`2023-04-28`
|
|
82
|
+
|
|
83
|
+
* :bug: fix: overlay 属性 onClick 暴露、lockscroll 相关demo 修订 (#959) @xiaoyatong
|
|
84
|
+
* :bug: fix: 修改taro增加主题编译 (#950) @junjun666
|
|
85
|
+
* 🛠 refactor: dialog (#945) @xiaoyatong
|
|
86
|
+
* 🛠 refactor: switch (#941) @拧巴的猫
|
|
87
|
+
* 🛠 refactor: tabs (#939) @oasis-cloud
|
|
88
|
+
* 🔨 chore: website 2.0 (#955) @oasis-cloud
|
|
89
|
+
* 📖 docs: button 文档表格优化 (#956) @oasis-cloud
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# v2.0.0-alpha.2
|
|
93
|
+
`2023-04-26`
|
|
94
|
+
|
|
95
|
+
* 🛠 refactor: navbar (#890) @拧巴的猫
|
|
96
|
+
* 🛠 refactor: animate (#940) @junjun666
|
|
97
|
+
* 🛠 refactor: badge (#936) @xiaoyatong
|
|
98
|
+
* 🛠 refactor: drag (#937) @拧巴的猫
|
|
99
|
+
* 🛠 refactor: elevator (#927) @拧巴的猫
|
|
100
|
+
* 🛠 refactor: menu (#923) @oasis-cloud
|
|
101
|
+
* 🛠 refactor: progress (#943) @Eiinu
|
|
102
|
+
* 🔨 chore: sync pnpm-lock @oasis-cloud
|
|
103
|
+
* :bug: fix: 修改taro增加主题编译 (#950) @junjun666
|
|
104
|
+
|
|
105
|
+
|
|
1
106
|
# v2.0.0-alpha.1
|
|
2
107
|
`2023-04-21`
|
|
3
108
|
|
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", "src", "style", "muted", "
|
|
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) {
|
|
@@ -33,7 +33,7 @@ import { C as ComponentDefaults } from "./typings.js";
|
|
|
33
33
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
34
34
|
src: "",
|
|
35
35
|
muted: false,
|
|
36
|
-
|
|
36
|
+
autoPlay: false,
|
|
37
37
|
loop: false,
|
|
38
38
|
preload: "auto",
|
|
39
39
|
type: "progress",
|
|
@@ -52,7 +52,7 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
52
52
|
});
|
|
53
53
|
var Audio = function Audio2(props) {
|
|
54
54
|
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
55
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, src = _defaultProps$props.src, style = _defaultProps$props.style, muted = _defaultProps$props.muted,
|
|
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);
|
|
56
56
|
var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), playing = _useState2[0], setPlaying = _useState2[1];
|
|
57
57
|
var _useState3 = useState(0), _useState4 = _slicedToArray(_useState3, 2), percent = _useState4[0], setPercent = _useState4[1];
|
|
58
58
|
var _useState5 = useState(false), _useState6 = _slicedToArray(_useState5, 2), isCanPlay = _useState6[0], setIsCanPlay = _useState6[1];
|
|
@@ -65,7 +65,7 @@ var Audio = function Audio2(props) {
|
|
|
65
65
|
duration: "00:00:00",
|
|
66
66
|
second: 0,
|
|
67
67
|
hanMuted: props.muted,
|
|
68
|
-
playing: props.
|
|
68
|
+
playing: props.autoPlay,
|
|
69
69
|
handPlaying: false
|
|
70
70
|
});
|
|
71
71
|
var classPrefix = "nut-audio";
|
|
@@ -154,9 +154,13 @@ var Audio = function Audio2(props) {
|
|
|
154
154
|
}, currentDuration), React__default.createElement("div", {
|
|
155
155
|
className: "".concat(classPrefix, "__progress-bar-wrapper")
|
|
156
156
|
}, React__default.createElement(Range, {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
value: percent,
|
|
158
|
+
onChange: function onChange(val) {
|
|
159
|
+
return setPercent(val);
|
|
160
|
+
},
|
|
161
|
+
currentDescription: null,
|
|
162
|
+
maxDescription: null,
|
|
163
|
+
minDescription: null,
|
|
160
164
|
"inactive-color": "#cccccc",
|
|
161
165
|
"active-color": "#fa2c19"
|
|
162
166
|
})), React__default.createElement("div", {
|
|
@@ -203,7 +207,7 @@ var Audio = function Audio2(props) {
|
|
|
203
207
|
};
|
|
204
208
|
var handleCanplay = function handleCanplay2(e) {
|
|
205
209
|
setIsCanPlay(true);
|
|
206
|
-
if (props.
|
|
210
|
+
if (props.autoPlay && !playing) {
|
|
207
211
|
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
208
212
|
}
|
|
209
213
|
if (AudioRef.current) {
|
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");
|