@nutui/nutui-react 2.0.0-alpha.7 → 2.0.0-alpha.9
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 +26 -0
- package/dist/esm/Audio.js +12 -8
- package/dist/esm/Cascader.js +20 -12
- package/dist/esm/Elevator.js +6 -5
- package/dist/esm/Image.js +2 -5
- package/dist/esm/ImagePreview.js +9 -9
- package/dist/esm/Indicator.js +4 -4
- package/dist/esm/Notify.js +35 -46
- package/dist/esm/NumberKeyboard.js +137 -195
- package/dist/esm/Price.js +22 -23
- 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/Swiper.js +100 -111
- package/dist/esm/SwiperItem.js +1 -1
- package/dist/esm/radio2.js +52 -54
- package/dist/esm/tabs2.js +19 -8
- 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 +1306 -1386
- package/dist/nutui.react.umd.js +1305 -1385
- package/dist/packages/imagepreview/imagepreview.scss +5 -0
- package/dist/packages/notify/notify.scss +1 -1
- package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
- package/dist/packages/price/price.scss +8 -0
- 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/swiper/swiper.scss +0 -15
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +61 -61
- package/dist/styles/variables.scss +61 -60
- package/dist/types/index.d.ts +84 -106
- package/package.json +1 -1
- /package/dist/esm/{UserContext3.js → context2.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# v2.0.0-alpha.9
|
|
2
|
+
`2023-05-17`
|
|
3
|
+
|
|
4
|
+
* :sparkles: feat: add createProperties.js (#1001) @Eiinu
|
|
5
|
+
* :sparkles: feat: cascader支持受控 (#1000) @xiaoyatong
|
|
6
|
+
* :sparkles: feat: elevator 支持右侧索引是否展示 (#1006) @拧巴的猫
|
|
7
|
+
* :bug: fix(image): lazy 优化观察对象数量 (#1015) @Eiinu
|
|
8
|
+
* :bug: fix: tabs children 变更后需要展示新的 title (#999) @oasis-cloud
|
|
9
|
+
* :bug: fix: 格式化,删掉某些无用代码 (#1014) @xiaoyatong
|
|
10
|
+
* 🛠 refactor: notify (#983) @拧巴的猫
|
|
11
|
+
* 🛠 refactor: NumberKeyboard (#1012) @Eiinu
|
|
12
|
+
* 🛠 refactor: price (#989) @拧巴的猫
|
|
13
|
+
* 🛠 refactor: pulltorefresh (#1011) @oasis-cloud
|
|
14
|
+
* 🛠 refactor: radio (#1009) @oasis-cloud
|
|
15
|
+
* 🛠 refactor: Range (#991) @Eiinu
|
|
16
|
+
* 🛠 refactor: swiper 重构;indcator 的索引计算改为从 0 开始 (#1008) @oasis-cloud
|
|
17
|
+
* 🔨 chore: autoplay -> autoPlay (#1007) @Eiinu
|
|
18
|
+
* 📖 docs(tabbar): update description (#1004) @Eiinu
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# v2.0.0-alpha.8
|
|
22
|
+
`2023-05-12`
|
|
23
|
+
* :sparkles:feat: cascader支持受控 (#1000) @xiaoyatong
|
|
24
|
+
* :bug: fix: tabs children 变更后需要展示新的 title (#999) @oasis-cloud
|
|
25
|
+
* 🛠 refactor: Range (#991) @Eiinu
|
|
26
|
+
|
|
1
27
|
# v2.0.0-alpha.7
|
|
2
28
|
`2023-05-12`
|
|
3
29
|
* :bug: fix: tabs children 变化需要更新选中状态 @oasis-cloud
|
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/Cascader.js
CHANGED
|
@@ -49,9 +49,9 @@ import Popup from "./Popup.js";
|
|
|
49
49
|
import { T as Tabs } from "./tabs2.js";
|
|
50
50
|
import { Loading, Checklist } from "@nutui/icons-react";
|
|
51
51
|
import { C as ComponentDefaults } from "./typings.js";
|
|
52
|
+
import { u as usePropsValue } from "./use-props-value.js";
|
|
52
53
|
import "./TabPane.js";
|
|
53
54
|
import "./raf.js";
|
|
54
|
-
import "./use-props-value.js";
|
|
55
55
|
var defaultProps$1 = {
|
|
56
56
|
data: {
|
|
57
57
|
text: "",
|
|
@@ -247,7 +247,6 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
247
247
|
popup: true,
|
|
248
248
|
visible: false,
|
|
249
249
|
options: [],
|
|
250
|
-
value: [],
|
|
251
250
|
title: "",
|
|
252
251
|
optionKey: {
|
|
253
252
|
textKey: "text",
|
|
@@ -267,14 +266,23 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
267
266
|
},
|
|
268
267
|
onPathChange: function onPathChange() {
|
|
269
268
|
}
|
|
270
|
-
}
|
|
269
|
+
});
|
|
271
270
|
var InternalCascader = function InternalCascader2(props, ref) {
|
|
272
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, popup = _defaultProps$props.popup, visible = _defaultProps$props.visible, options = _defaultProps$props.options, value = _defaultProps$props.value, title = _defaultProps$props.title, optionKey = _defaultProps$props.optionKey, format = _defaultProps$props.format, closeable = _defaultProps$props.closeable, closeIconPosition = _defaultProps$props.closeIconPosition, closeIcon = _defaultProps$props.closeIcon, lazy = _defaultProps$props.lazy, onLoad2 = _defaultProps$props.onLoad, onClose2 = _defaultProps$props.onClose, onChange2 = _defaultProps$props.onChange, onPathChange2 = _defaultProps$props.onPathChange;
|
|
271
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, popup = _defaultProps$props.popup, visible = _defaultProps$props.visible, options = _defaultProps$props.options, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, title = _defaultProps$props.title, optionKey = _defaultProps$props.optionKey, format = _defaultProps$props.format, closeable = _defaultProps$props.closeable, closeIconPosition = _defaultProps$props.closeIconPosition, closeIcon = _defaultProps$props.closeIcon, lazy = _defaultProps$props.lazy, onLoad2 = _defaultProps$props.onLoad, onClose2 = _defaultProps$props.onClose, onChange2 = _defaultProps$props.onChange, onPathChange2 = _defaultProps$props.onPathChange;
|
|
273
272
|
var _useState = useState("c1"), _useState2 = _slicedToArray(_useState, 2), tabvalue = _useState2[0], setTabvalue = _useState2[1];
|
|
274
273
|
var _useState3 = useState([]), _useState4 = _slicedToArray(_useState3, 2), optionsData = _useState4[0], setOptionsData = _useState4[1];
|
|
275
274
|
var isLazy = function isLazy2() {
|
|
276
275
|
return state.configs.lazy && Boolean(state.configs.onLoad);
|
|
277
276
|
};
|
|
277
|
+
var _usePropsValue = usePropsValue({
|
|
278
|
+
value,
|
|
279
|
+
defaultValue,
|
|
280
|
+
finalValue: defaultValue,
|
|
281
|
+
onChange: function onChange3(val) {
|
|
282
|
+
var _props$onChange;
|
|
283
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, val);
|
|
284
|
+
}
|
|
285
|
+
}), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), innerValue = _usePropsValue2[0], setInnerValue = _usePropsValue2[1];
|
|
278
286
|
var _useState5 = useState({
|
|
279
287
|
optionsData: [],
|
|
280
288
|
panes: [{
|
|
@@ -282,7 +290,6 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
282
290
|
selectedNode: [],
|
|
283
291
|
paneKey: ""
|
|
284
292
|
}],
|
|
285
|
-
innerValue: value,
|
|
286
293
|
tree: new Tree$1([], {}),
|
|
287
294
|
tabsCursor: 0,
|
|
288
295
|
initLoading: false,
|
|
@@ -299,12 +306,12 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
299
306
|
var classesPane = classNames(_defineProperty({}, "".concat(classPrefix, "-pane"), true));
|
|
300
307
|
useEffect(function() {
|
|
301
308
|
initData();
|
|
302
|
-
}, [options]);
|
|
309
|
+
}, [options, format]);
|
|
303
310
|
useEffect(function() {
|
|
304
|
-
if (
|
|
305
|
-
|
|
311
|
+
if (defaultValue && defaultValue !== innerValue) {
|
|
312
|
+
setInnerValue(defaultValue);
|
|
306
313
|
}
|
|
307
|
-
}, [
|
|
314
|
+
}, [defaultValue]);
|
|
308
315
|
var initData = /* @__PURE__ */ function() {
|
|
309
316
|
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee() {
|
|
310
317
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -358,8 +365,8 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
358
365
|
while (1)
|
|
359
366
|
switch (_context3.prev = _context3.next) {
|
|
360
367
|
case 0:
|
|
361
|
-
currentValue =
|
|
362
|
-
if (!(currentValue === void 0 || !state.tree.nodes.length)) {
|
|
368
|
+
currentValue = innerValue;
|
|
369
|
+
if (!(currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length)) {
|
|
363
370
|
_context3.next = 3;
|
|
364
371
|
break;
|
|
365
372
|
}
|
|
@@ -427,7 +434,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
427
434
|
case 18:
|
|
428
435
|
state.initLoading = false;
|
|
429
436
|
case 19:
|
|
430
|
-
if (needToSync.length && currentValue ===
|
|
437
|
+
if (needToSync.length && currentValue === defaultValue) {
|
|
431
438
|
pathNodes = state.tree.getPathNodesByValue(needToSync);
|
|
432
439
|
pathNodes.forEach(function(node, index) {
|
|
433
440
|
state.tabsCursor = index;
|
|
@@ -536,6 +543,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
536
543
|
});
|
|
537
544
|
onChange2(optionParams, pathNodes);
|
|
538
545
|
onPathChange2(optionParams, pathNodes);
|
|
546
|
+
setInnerValue(optionParams);
|
|
539
547
|
}
|
|
540
548
|
setOptionsData(state.panes);
|
|
541
549
|
close();
|
package/dist/esm/Elevator.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 = ["height", "floorKey", "list", "sticky", "spaceHeight", "titleHeight", "className", "style", "onClickItem", "onClickIndex", "children"];
|
|
4
|
+
var _excluded = ["height", "floorKey", "list", "sticky", "spaceHeight", "titleHeight", "showKeys", "className", "style", "onClickItem", "onClickIndex", "children"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -35,11 +35,12 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
35
35
|
list: [],
|
|
36
36
|
sticky: false,
|
|
37
37
|
spaceHeight: 23,
|
|
38
|
-
titleHeight: 35
|
|
38
|
+
titleHeight: 35,
|
|
39
|
+
showKeys: true
|
|
39
40
|
});
|
|
40
41
|
var Elevator = function Elevator2(props) {
|
|
41
42
|
var _classNames2;
|
|
42
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), height = _defaultProps$props.height, floorKey = _defaultProps$props.floorKey, list = _defaultProps$props.list, sticky = _defaultProps$props.sticky, spaceHeight = _defaultProps$props.spaceHeight, titleHeight = _defaultProps$props.titleHeight, className = _defaultProps$props.className, style = _defaultProps$props.style, onClickItem = _defaultProps$props.onClickItem, onClickIndex = _defaultProps$props.onClickIndex, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
43
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), height = _defaultProps$props.height, floorKey = _defaultProps$props.floorKey, list = _defaultProps$props.list, sticky = _defaultProps$props.sticky, spaceHeight = _defaultProps$props.spaceHeight, titleHeight = _defaultProps$props.titleHeight, showKeys = _defaultProps$props.showKeys, className = _defaultProps$props.className, style = _defaultProps$props.style, onClickItem = _defaultProps$props.onClickItem, onClickIndex = _defaultProps$props.onClickIndex, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
43
44
|
var classPrefix = "nut-elevator";
|
|
44
45
|
var listview = useRef(null);
|
|
45
46
|
var initData = {
|
|
@@ -192,7 +193,7 @@ var Elevator = function Elevator2(props) {
|
|
|
192
193
|
value: subitem
|
|
193
194
|
}, children)) : subitem.name);
|
|
194
195
|
})));
|
|
195
|
-
}))), list.length && scrollStart ? React__default.createElement("div", {
|
|
196
|
+
}))), showKeys ? React__default.createElement(React__default.Fragment, null, list.length && scrollStart ? React__default.createElement("div", {
|
|
196
197
|
className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(classPrefix, "__code--current"), true), _defineProperty(_classNames2, "".concat(classPrefix, "__code--current--current"), true), _classNames2))
|
|
197
198
|
}, list[codeIndex][floorKey]) : null, React__default.createElement("div", {
|
|
198
199
|
className: "".concat(classPrefix, "__bars")
|
|
@@ -212,7 +213,7 @@ var Elevator = function Elevator2(props) {
|
|
|
212
213
|
return handleClickIndex(item[floorKey]);
|
|
213
214
|
}
|
|
214
215
|
}, item[floorKey]);
|
|
215
|
-
}))));
|
|
216
|
+
})))) : null);
|
|
216
217
|
};
|
|
217
218
|
Elevator.defaultProps = defaultProps;
|
|
218
219
|
Elevator.displayName = "NutElevator";
|
package/dist/esm/Image.js
CHANGED
|
@@ -71,7 +71,6 @@ var Image = function Image2(props) {
|
|
|
71
71
|
}, style);
|
|
72
72
|
var observer = useRef(null);
|
|
73
73
|
var initObserver = function initObserver2() {
|
|
74
|
-
var images = document.querySelectorAll(".nut-img.lazyload");
|
|
75
74
|
var options = {
|
|
76
75
|
threshold: [0],
|
|
77
76
|
rootMargin: "0px"
|
|
@@ -86,14 +85,12 @@ var Image = function Image2(props) {
|
|
|
86
85
|
img.src = img.dataset.src;
|
|
87
86
|
img.removeAttribute("data-src");
|
|
88
87
|
}
|
|
89
|
-
|
|
88
|
+
resetObserver();
|
|
90
89
|
}, 300);
|
|
91
90
|
}
|
|
92
91
|
});
|
|
93
92
|
}, options);
|
|
94
|
-
|
|
95
|
-
observer.current.observe(item);
|
|
96
|
-
});
|
|
93
|
+
observer.current.observe(imgRef.current);
|
|
97
94
|
};
|
|
98
95
|
var resetObserver = function resetObserver2() {
|
|
99
96
|
observer.current.disconnect && observer.current.disconnect();
|
package/dist/esm/ImagePreview.js
CHANGED
|
@@ -30,16 +30,16 @@ var defaultProps = {
|
|
|
30
30
|
images: [],
|
|
31
31
|
videos: [],
|
|
32
32
|
show: false,
|
|
33
|
-
|
|
33
|
+
autoPlay: 3e3,
|
|
34
34
|
initNo: 1,
|
|
35
35
|
contentClose: false,
|
|
36
|
-
|
|
36
|
+
indicator: false,
|
|
37
37
|
paginationColor: "#fff",
|
|
38
38
|
onClose: function onClose() {
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
var ImagePreview = function ImagePreview2(props) {
|
|
42
|
-
var images = props.images, videos = props.videos, show = props.show, initNo = props.initNo, paginationColor = props.paginationColor,
|
|
42
|
+
var images = props.images, videos = props.videos, show = props.show, initNo = props.initNo, paginationColor = props.paginationColor, indicator = props.indicator, autoPlay = props.autoPlay, contentClose = props.contentClose, onClose2 = props.onClose;
|
|
43
43
|
var nutImagePreview = useRef(null);
|
|
44
44
|
var _useState = useState(initNo), _useState2 = _slicedToArray(_useState, 2), innerNo = _useState2[0], setInnerNo = _useState2[1];
|
|
45
45
|
var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), showPop = _useState4[0], setShowPop = _useState4[1];
|
|
@@ -170,18 +170,18 @@ var ImagePreview = function ImagePreview2(props) {
|
|
|
170
170
|
onClick: closeOnImg,
|
|
171
171
|
onTouchStart
|
|
172
172
|
}, React__default.createElement(Swiper, {
|
|
173
|
-
autoPlay
|
|
173
|
+
autoPlay,
|
|
174
174
|
className: "nut-imagepreview-swiper",
|
|
175
175
|
loop: true,
|
|
176
|
-
|
|
176
|
+
preventDefault: false,
|
|
177
177
|
style: {
|
|
178
|
-
display: showPop ? "block" : "none"
|
|
178
|
+
display: showPop ? "block" : "none",
|
|
179
|
+
"--nutui-indicator-color": paginationColor
|
|
179
180
|
},
|
|
180
181
|
direction: "horizontal",
|
|
181
182
|
onChange: slideChangeEnd,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
paginationVisible
|
|
183
|
+
defaultValue: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
|
|
184
|
+
indicator
|
|
185
185
|
}, (videos && videos.length > 0 ? videos.map(function(item, index) {
|
|
186
186
|
return React__default.createElement(SwiperItem, {
|
|
187
187
|
key: index
|
package/dist/esm/Indicator.js
CHANGED
|
@@ -26,7 +26,7 @@ import React__default from "react";
|
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
var defaultProps = {
|
|
28
28
|
total: 3,
|
|
29
|
-
current:
|
|
29
|
+
current: 0,
|
|
30
30
|
direction: "horizontal"
|
|
31
31
|
};
|
|
32
32
|
var classPrefix = "nut-indicator";
|
|
@@ -35,11 +35,11 @@ var Indicator = function Indicator2(props) {
|
|
|
35
35
|
var classes = classNames(_defineProperty({}, "".concat(classPrefix, "__vertical"), direction === "vertical"));
|
|
36
36
|
var renderElement = function renderElement2() {
|
|
37
37
|
var childs = [];
|
|
38
|
-
for (var item =
|
|
39
|
-
childs.push(item === current ?
|
|
38
|
+
for (var item = 0; item < total; item++) {
|
|
39
|
+
childs.push(item === current ? children || React__default.createElement("div", {
|
|
40
40
|
key: item,
|
|
41
41
|
className: "".concat(classPrefix, "__dot ").concat(classPrefix, "__active")
|
|
42
|
-
})
|
|
42
|
+
}) : React__default.createElement("div", {
|
|
43
43
|
key: item,
|
|
44
44
|
className: "".concat(classPrefix, "__dot")
|
|
45
45
|
}));
|
package/dist/esm/Notify.js
CHANGED
|
@@ -55,12 +55,12 @@ function _isNativeReflectConstruct() {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
import * as React from "react";
|
|
58
|
-
import * as ReactDOM from "react-dom";
|
|
59
58
|
import classNames from "classnames";
|
|
60
59
|
import { CSSTransition } from "react-transition-group";
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import "
|
|
60
|
+
import { r as render, u as unmount } from "./render.js";
|
|
61
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
62
|
+
import "react-dom";
|
|
63
|
+
var classPrefix = "nut-notify";
|
|
64
64
|
var Notification = /* @__PURE__ */ function(_React$PureComponent) {
|
|
65
65
|
_inherits(Notification2, _React$PureComponent);
|
|
66
66
|
var _super = _createSuper(Notification2);
|
|
@@ -89,7 +89,7 @@ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
|
|
|
89
89
|
var element = document.getElementById(this.props.id);
|
|
90
90
|
element && element.parentNode && element.parentNode.removeChild(element);
|
|
91
91
|
}
|
|
92
|
-
this.props.
|
|
92
|
+
this.props.onClose();
|
|
93
93
|
}
|
|
94
94
|
}, {
|
|
95
95
|
key: "startCloseTimer",
|
|
@@ -128,30 +128,22 @@ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
|
|
|
128
128
|
}, {
|
|
129
129
|
key: "render",
|
|
130
130
|
value: function render2() {
|
|
131
|
-
var
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
var classes = classNames(_defineProperty(
|
|
135
|
-
"nut-notify--popup-top": position === "top",
|
|
136
|
-
"nut-notify--popup-bottom": position === "bottom",
|
|
137
|
-
"nut-notify": true
|
|
138
|
-
}, "nut-notify--".concat(type), true));
|
|
131
|
+
var _classNames;
|
|
132
|
+
var _this$props = this.props, style = _this$props.style, message = _this$props.message, type = _this$props.type, className = _this$props.className, position = _this$props.position;
|
|
133
|
+
var show = this.state.show;
|
|
134
|
+
var classes = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(classPrefix, "--popup-top"), position === "top"), _defineProperty(_classNames, "".concat(classPrefix, "--popup-bottom"), position === "bottom"), _defineProperty(_classNames, "".concat(classPrefix), true), _defineProperty(_classNames, "".concat(classPrefix, "--").concat(type), true), _classNames));
|
|
139
135
|
return React.createElement(React.Fragment, null, React.createElement(CSSTransition, {
|
|
140
|
-
"in":
|
|
136
|
+
"in": show,
|
|
141
137
|
timeout: 300,
|
|
142
138
|
classNames: "fade",
|
|
143
139
|
unmountOnExit: true,
|
|
144
140
|
appear: true,
|
|
145
|
-
position
|
|
146
|
-
isWrapTeleport
|
|
141
|
+
position
|
|
147
142
|
}, React.createElement("div", {
|
|
148
143
|
className: "".concat(classes, " ").concat(className),
|
|
149
|
-
style
|
|
150
|
-
color: "".concat(color || ""),
|
|
151
|
-
background: "".concat(background || "")
|
|
152
|
-
},
|
|
144
|
+
style,
|
|
153
145
|
onClick: this.clickCover
|
|
154
|
-
},
|
|
146
|
+
}, message)));
|
|
155
147
|
}
|
|
156
148
|
}]);
|
|
157
149
|
return Notification2;
|
|
@@ -173,7 +165,7 @@ Notification.newInstance = function(properties, callback) {
|
|
|
173
165
|
component: instance,
|
|
174
166
|
destroy: function destroy() {
|
|
175
167
|
setTimeout(function() {
|
|
176
|
-
|
|
168
|
+
unmount(element);
|
|
177
169
|
element && element.parentNode && element.parentNode.removeChild(element);
|
|
178
170
|
}, 300);
|
|
179
171
|
}
|
|
@@ -184,19 +176,16 @@ Notification.newInstance = function(properties, callback) {
|
|
|
184
176
|
})), element);
|
|
185
177
|
};
|
|
186
178
|
var messageInstance = null;
|
|
187
|
-
var options = {
|
|
188
|
-
msg: "",
|
|
179
|
+
var options = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
189
180
|
id: "",
|
|
190
181
|
duration: 3e3,
|
|
191
|
-
color: "",
|
|
192
182
|
type: "danger",
|
|
193
|
-
className: "",
|
|
194
183
|
position: "top",
|
|
195
|
-
|
|
184
|
+
onClose: function onClose() {
|
|
196
185
|
},
|
|
197
186
|
onClick: function onClick() {
|
|
198
187
|
}
|
|
199
|
-
};
|
|
188
|
+
});
|
|
200
189
|
function getInstance(props, callback) {
|
|
201
190
|
if (messageInstance) {
|
|
202
191
|
messageInstance.destroy();
|
|
@@ -212,49 +201,49 @@ function notice(opts) {
|
|
|
212
201
|
messageInstance = notification;
|
|
213
202
|
});
|
|
214
203
|
}
|
|
215
|
-
var errorMsg = function errorMsg2(
|
|
216
|
-
if (!
|
|
217
|
-
console.warn("[NutUI Notify]:
|
|
204
|
+
var errorMsg = function errorMsg2(message) {
|
|
205
|
+
if (!message) {
|
|
206
|
+
console.warn("[NutUI Notify]: message不能为空");
|
|
218
207
|
}
|
|
219
208
|
};
|
|
220
209
|
var Notify = {
|
|
221
|
-
text: function text(
|
|
210
|
+
text: function text(message) {
|
|
222
211
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
223
|
-
errorMsg(
|
|
212
|
+
errorMsg(message);
|
|
224
213
|
return notice(_objectSpread({
|
|
225
|
-
|
|
214
|
+
message,
|
|
226
215
|
type: "base"
|
|
227
216
|
}, option));
|
|
228
217
|
},
|
|
229
|
-
success: function success(
|
|
218
|
+
success: function success(message) {
|
|
230
219
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
231
|
-
errorMsg(
|
|
220
|
+
errorMsg(message);
|
|
232
221
|
return notice(_objectSpread({
|
|
233
|
-
|
|
222
|
+
message,
|
|
234
223
|
type: "success"
|
|
235
224
|
}, option));
|
|
236
225
|
},
|
|
237
|
-
primary: function primary(
|
|
226
|
+
primary: function primary(message) {
|
|
238
227
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
239
|
-
errorMsg(
|
|
228
|
+
errorMsg(message);
|
|
240
229
|
return notice(_objectSpread({
|
|
241
|
-
|
|
230
|
+
message,
|
|
242
231
|
type: "primary"
|
|
243
232
|
}, option));
|
|
244
233
|
},
|
|
245
|
-
danger: function danger(
|
|
234
|
+
danger: function danger(message) {
|
|
246
235
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
247
|
-
errorMsg(
|
|
236
|
+
errorMsg(message);
|
|
248
237
|
return notice(_objectSpread({
|
|
249
|
-
|
|
238
|
+
message,
|
|
250
239
|
type: "danger"
|
|
251
240
|
}, option));
|
|
252
241
|
},
|
|
253
|
-
warn: function warn(
|
|
242
|
+
warn: function warn(message) {
|
|
254
243
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
255
|
-
errorMsg(
|
|
244
|
+
errorMsg(message);
|
|
256
245
|
return notice(_objectSpread({
|
|
257
|
-
|
|
246
|
+
message,
|
|
258
247
|
type: "warning"
|
|
259
248
|
}, option));
|
|
260
249
|
},
|