@nutui/nutui-react-taro 1.3.0 → 1.3.1-beta.2
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/dist/esm/Address.js +4 -4
- package/dist/esm/Audio/style/index.js +4 -0
- package/dist/esm/Audio.js +18 -0
- package/dist/esm/AvatarGroup.js +4 -4
- package/dist/esm/Calendar/style/index.js +1 -2
- package/dist/esm/Calendar.js +6 -5
- package/dist/esm/CalendarItem.js +5 -5
- package/dist/esm/Cascader/style/index.js +2 -0
- package/dist/esm/Cascader.js +14 -0
- package/dist/esm/ConfigProvider.js +3 -3
- package/dist/esm/CountDown.js +4 -4
- package/dist/esm/DatePicker.js +4 -4
- package/dist/esm/Dialog.js +4 -4
- package/dist/esm/Empty.js +4 -4
- package/dist/esm/FixedNav.js +4 -4
- package/dist/esm/Grid/style/index.js +2 -0
- package/dist/esm/Grid.js +7 -0
- package/dist/esm/GridItem/style/index.js +2 -0
- package/dist/esm/GridItem.js +8 -0
- package/dist/esm/ImagePreview/style/index.js +2 -0
- package/dist/esm/ImagePreview.js +15 -0
- package/dist/esm/Infiniteloading.js +4 -4
- package/dist/esm/Input.js +4 -4
- package/dist/esm/Menu/style/index.js +3 -0
- package/dist/esm/Menu.js +7 -0
- package/dist/esm/MenuItem/style/index.js +3 -0
- package/dist/esm/MenuItem.js +11 -0
- package/dist/esm/NoticeBar.js +3 -2
- package/dist/esm/{Notification-dccc7625.js → Notification-422905bd.js} +2 -1
- package/dist/esm/Notify.js +3 -2
- package/dist/esm/NumberKeyboard.js +4 -4
- package/dist/esm/Pagination.js +4 -4
- package/dist/esm/Picker.js +4 -4
- package/dist/esm/Popover.js +3 -2
- package/dist/esm/Range.js +7 -5
- package/dist/esm/SearchBar.js +4 -4
- package/dist/esm/ShortPassword.js +4 -4
- package/dist/esm/SideNavBar.js +4 -4
- package/dist/esm/Signature.js +4 -4
- package/dist/esm/Swipe/style/index.js +2 -0
- package/dist/esm/Swipe.js +7 -0
- package/dist/esm/Swiper.js +3 -2
- package/dist/esm/Table.js +4 -4
- package/dist/esm/TextArea.js +4 -4
- package/dist/esm/TimeDetail.js +4 -4
- package/dist/esm/TimePannel.js +4 -4
- package/dist/esm/TimeSelect.js +4 -4
- package/dist/esm/Toast.js +4 -3
- package/dist/esm/Uploader.js +4 -4
- package/dist/esm/VirtualList.js +4 -4
- package/dist/esm/{address.taro-a1092e30.js → address.taro-4765a826.js} +17 -6
- package/dist/esm/audio.taro-cd6cc93b.js +292 -0
- package/dist/esm/{avatargroup-65173caa.js → avatargroup-1ca79066.js} +1 -1
- package/dist/esm/calendar.taro-1abb1925.js +89 -0
- package/dist/esm/{calendaritem.taro-fe84d94b.js → calendaritem.taro-3c06a809.js} +130 -5
- package/dist/esm/cascader.taro-31dbc60e.js +786 -0
- package/dist/esm/{configprovider-18657611.js → configprovider-9c393a29.js} +1 -1
- package/dist/esm/{configprovider.taro-98343012.js → configprovider.taro-1ff7f150.js} +2 -2
- package/dist/esm/{countdown.taro-cd6a1bd4.js → countdown.taro-b00d0d46.js} +1 -1
- package/dist/esm/{datepicker.taro-c1249537.js → datepicker.taro-e385849d.js} +1 -1
- package/dist/esm/{dialog.taro-5b850861.js → dialog.taro-c80b7b5f.js} +12 -18
- package/dist/esm/{empty.taro-6f86eda5.js → empty.taro-20b8adac.js} +1 -1
- package/dist/esm/{fixednav.taro-ca94fd6a.js → fixednav.taro-75e35339.js} +1 -1
- package/dist/esm/grid.taro-7fb43d02.js +90 -0
- package/dist/esm/griditem.taro-8020b409.js +98 -0
- package/dist/esm/imagepreview.taro-a0ddd8a2.js +813 -0
- package/dist/esm/{infiniteloading.taro-d2c0ca14.js → infiniteloading.taro-0a86819e.js} +1 -1
- package/dist/esm/{input.taro-2e31ebbb.js → input.taro-1d23861d.js} +1 -1
- package/dist/esm/menu.taro-03e3b011.js +153 -0
- package/dist/esm/menuitem.taro-56bf3205.js +195 -0
- package/dist/esm/{noticebar.taro-ae593896.js → noticebar.taro-1890c693.js} +3 -2
- package/dist/esm/{notify.taro-95b5f97e.js → notify.taro-22b8f4cd.js} +2 -1
- package/dist/esm/{numberkeyboard.taro-71b2e0eb.js → numberkeyboard.taro-5d685c76.js} +1 -1
- package/dist/esm/nutui-react.es.js +45 -36
- package/dist/esm/{pagination.taro-abc4a71e.js → pagination.taro-10449c4a.js} +1 -1
- package/dist/esm/{picker.taro-0eb8bfa3.js → picker.taro-216cc3cb.js} +1 -1
- package/dist/esm/{popover.taro-4c102df6.js → popover.taro-9b3da0fa.js} +17 -71
- package/dist/esm/{range.taro-034fcf7a.js → range.taro-fe08c5f4.js} +118 -110
- package/dist/esm/render-4a3856cb.js +32 -0
- package/dist/esm/{searchbar.taro-4c6091cb.js → searchbar.taro-450d2f88.js} +1 -1
- package/dist/esm/{shortpassword.taro-ce46b9cd.js → shortpassword.taro-08a05360.js} +23 -18
- package/dist/esm/{sidenavbar.taro-36f1e118.js → sidenavbar.taro-dd471476.js} +1 -1
- package/dist/esm/{signature.taro-45aedfa9.js → signature.taro-7cb77bab.js} +1 -1
- package/dist/esm/swipe.taro-dfb9a049.js +264 -0
- package/dist/esm/{swiper.taro-59bf2777.js → swiper.taro-7a2ef124.js} +2 -1
- package/dist/esm/{table.taro-49009dfc.js → table.taro-305e0317.js} +1 -1
- package/dist/esm/{textarea.taro-0c40e966.js → textarea.taro-700b04c2.js} +1 -1
- package/dist/esm/{timedetail.taro-0e31b4a5.js → timedetail.taro-7cc00243.js} +1 -1
- package/dist/esm/{timepannel.taro-2d54b3db.js → timepannel.taro-e24537e4.js} +1 -1
- package/dist/esm/{timeselect.taro-c35d3490.js → timeselect.taro-210fd548.js} +1 -1
- package/dist/esm/{toast.taro-48539c09.js → toast.taro-bb181833.js} +1 -1
- package/dist/esm/{uploader.taro-ece83a00.js → uploader.taro-f7528535.js} +1 -1
- package/dist/esm/useClientRect-8b7cc406.js +74 -0
- package/dist/esm/{virtuallist.taro-2ff1a5ad.js → virtuallist.taro-ce9619f9.js} +1 -1
- package/dist/esm/{zh-CN-f5124686.js → zh-CN-91090ae2.js} +16 -0
- package/dist/locales/base.d.ts +16 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +17 -1
- package/dist/locales/id-ID.js +17 -1
- package/dist/locales/zh-CN.js +17 -1
- package/dist/locales/zh-TW.js +17 -1
- package/dist/nutui.react.es.js +5595 -4062
- package/dist/nutui.react.umd.js +20243 -30
- package/dist/packages/audio/audio.scss +80 -0
- package/dist/packages/calendar/calendar.scss +57 -36
- package/dist/packages/calendaritem/calendaritem.scss +0 -191
- package/dist/packages/cascader/cascader.scss +69 -0
- package/dist/packages/grid/grid.scss +10 -0
- package/dist/packages/griditem/griditem.scss +103 -0
- package/dist/packages/imagepreview/imagepreview.scss +51 -0
- package/dist/packages/menu/menu.scss +72 -0
- package/dist/packages/menuitem/menuitem.scss +90 -0
- package/dist/packages/popup/popup.scss +1 -1
- package/dist/packages/searchbar/searchbar.scss +1 -0
- package/dist/packages/shortpassword/shortpassword.scss +6 -1
- package/dist/packages/swipe/swipe.scss +33 -0
- package/dist/packages/textarea/textarea.scss +16 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/font/iconfont.js +20 -18
- package/dist/styles/themes/default.scss +8 -0
- package/dist/styles/variables.scss +59 -8
- package/dist/types/audio/audio.taro.d.ts +18 -0
- package/dist/types/audio/index.taro.d.ts +2 -0
- package/dist/types/cascader/cascader.taro.d.ts +25 -0
- package/dist/types/cascader/cascaderItem.taro.d.ts +25 -0
- package/dist/types/cascader/index.taro.d.ts +2 -0
- package/dist/types/checkbox/checkbox.taro.d.ts +2 -2
- package/dist/types/checkboxgroup/checkboxgroup.taro.d.ts +2 -2
- package/dist/types/dialog/dialog.taro.d.ts +2 -1
- package/dist/types/grid/grid.taro.d.ts +16 -0
- package/dist/types/grid/index.taro.d.ts +2 -0
- package/dist/types/griditem/griditem.taro.d.ts +20 -0
- package/dist/types/griditem/index.taro.d.ts +2 -0
- package/dist/types/icon/icon.taro.d.ts +1 -2
- package/dist/types/imagepreview/imagepreview.taro.d.ts +26 -0
- package/dist/types/imagepreview/index.taro.d.ts +2 -0
- package/dist/types/menu/index.taro.d.ts +2 -0
- package/dist/types/menu/menu.taro.d.ts +12 -0
- package/dist/types/menuitem/index.taro.d.ts +2 -0
- package/dist/types/menuitem/menuitem.taro.d.ts +23 -0
- package/dist/types/notify/notify.taro.d.ts +13 -0
- package/dist/types/nutui.react.d.ts +95 -1
- package/dist/types/picker/picker.taro.d.ts +2 -2
- package/dist/types/popup/popup.taro.d.ts +1 -1
- package/dist/types/shortpassword/shortpassword.taro.d.ts +3 -3
- package/dist/types/sidenavbar/sidenavbar.taro.d.ts +14 -2
- package/dist/types/sidenavbaritem/sidenavbaritem.taro.d.ts +10 -2
- package/dist/types/subsidenavbar/subsidenavbar.taro.d.ts +13 -3
- package/dist/types/swipe/index.taro.d.ts +2 -0
- package/dist/types/swipe/swipe.taro.d.ts +41 -0
- package/dist/types/table/table.taro.d.ts +2 -1
- package/dist/types/toast/toast.taro.d.ts +18 -0
- package/dist/types/virtuallist/virtuallist.taro.d.ts +2 -1
- package/package.json +4 -4
- package/dist/esm/calendar.taro-4b2103c1.js +0 -621
- package/dist/esm/raf-3fbb5f92.js +0 -126
package/dist/esm/Uploader.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { U as Uploader } from './uploader.taro-
|
|
2
|
-
export { U as default } from './uploader.taro-
|
|
1
|
+
import { U as Uploader } from './uploader.taro-f7528535.js';
|
|
2
|
+
export { U as default } from './uploader.taro-f7528535.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'classnames';
|
|
5
5
|
import './icon-8dc4de10.js';
|
|
6
6
|
import './bem-893ad28d.js';
|
|
7
7
|
import '@bem-react/classname';
|
|
8
|
-
import './configprovider-
|
|
9
|
-
import './zh-CN-
|
|
8
|
+
import './configprovider-9c393a29.js';
|
|
9
|
+
import './zh-CN-91090ae2.js';
|
package/dist/esm/VirtualList.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VirtualList } from './virtuallist.taro-
|
|
2
|
-
export { V as default } from './virtuallist.taro-
|
|
1
|
+
import { V as VirtualList } from './virtuallist.taro-ce9619f9.js';
|
|
2
|
+
export { V as default } from './virtuallist.taro-ce9619f9.js';
|
|
3
3
|
import 'react';
|
|
4
|
-
import './configprovider-
|
|
5
|
-
import './zh-CN-
|
|
4
|
+
import './configprovider-9c393a29.js';
|
|
5
|
+
import './zh-CN-91090ae2.js';
|
|
@@ -15,7 +15,7 @@ import React__default, { useEffect, createContext, useRef, useState } from 'reac
|
|
|
15
15
|
import { I as Icon } from './icon-8dc4de10.js';
|
|
16
16
|
import { P as Popup } from './popup-67173ec6.js';
|
|
17
17
|
import { c as cn } from './bem-893ad28d.js';
|
|
18
|
-
import { u as useConfig } from './configprovider-
|
|
18
|
+
import { u as useConfig } from './configprovider-9c393a29.js';
|
|
19
19
|
var defaultProps$3 = {
|
|
20
20
|
type: 'custom',
|
|
21
21
|
existAddress: [],
|
|
@@ -236,10 +236,12 @@ var Elevator = function Elevator(props) {
|
|
|
236
236
|
var touchMove = function touchMove(e) {
|
|
237
237
|
var firstTouch = e.touches[0];
|
|
238
238
|
touchState.current.y2 = firstTouch.pageY;
|
|
239
|
-
var delta = (touchState.current.y2 - touchState.current.y1) / spaceHeight || 0;
|
|
240
|
-
|
|
239
|
+
var delta = (touchState.current.y2 - touchState.current.y1) / spaceHeight || 0; // delta 是一个浮点数, 需要四舍五入一下, 否则页面会找不到最终计算后的index
|
|
240
|
+
|
|
241
|
+
var cacheIndex = state.current.anchorIndex + Math.ceil(delta);
|
|
241
242
|
setCodeIndex(cacheIndex);
|
|
242
243
|
scrollTo(cacheIndex);
|
|
244
|
+
e.preventDefault();
|
|
243
245
|
};
|
|
244
246
|
|
|
245
247
|
var touchEnd = function touchEnd() {
|
|
@@ -330,6 +332,17 @@ var Elevator = function Elevator(props) {
|
|
|
330
332
|
if (state.current.fixedTop === fixedTop) return;
|
|
331
333
|
state.current.fixedTop = fixedTop;
|
|
332
334
|
}, [state.current.diff, titleHeight]);
|
|
335
|
+
var refIndexBar = useRef(null); // 之前的代码, 手指在index条上下移动的时候, 下面的列表也会跟随滚动, 需要阻止默认事件
|
|
336
|
+
// 如果使用react的touchmove, 没有找到可以设置passive的选项, 无法阻止默认事件, 所以使用了原生的方法进行添加
|
|
337
|
+
|
|
338
|
+
useEffect(function () {
|
|
339
|
+
refIndexBar.current && refIndexBar.current.addEventListener('touchmove', touchMove, {
|
|
340
|
+
passive: false
|
|
341
|
+
});
|
|
342
|
+
return function () {
|
|
343
|
+
refIndexBar.current && refIndexBar.current.removeEventListener('touchmove', touchMove);
|
|
344
|
+
};
|
|
345
|
+
}, []);
|
|
333
346
|
return React__default.createElement("div", _objectSpread({
|
|
334
347
|
className: "".concat(b(), " ").concat(className)
|
|
335
348
|
}, rest), isSticky && scrollY > 0 ? React__default.createElement("div", {
|
|
@@ -368,12 +381,10 @@ var Elevator = function Elevator(props) {
|
|
|
368
381
|
current: true
|
|
369
382
|
})
|
|
370
383
|
}, indexList[codeIndex][acceptKey]) : null, React__default.createElement("div", {
|
|
384
|
+
ref: refIndexBar,
|
|
371
385
|
className: b('bars'),
|
|
372
386
|
onTouchStart: function onTouchStart(event) {
|
|
373
387
|
return touchStart(event);
|
|
374
|
-
},
|
|
375
|
-
onTouchMove: function onTouchMove(event) {
|
|
376
|
-
return touchMove(event);
|
|
377
388
|
}
|
|
378
389
|
}, React__default.createElement("div", {
|
|
379
390
|
className: b('bars__inner')
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["className", "url", "style", "muted", "autoplay", "loop", "preload", "type", "onFastBack", "onForward", "onPause", "onPlayEnd", "onMute", "onCanPlay", "children"];
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
|
|
10
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
11
|
+
import { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
12
|
+
import { R as Range } from './range.taro-fe08c5f4.js';
|
|
13
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
14
|
+
import { B as Button } from './button.taro-d5968f9d.js';
|
|
15
|
+
import { u as useConfig } from './configprovider.taro-1ff7f150.js';
|
|
16
|
+
var defaultProps = {
|
|
17
|
+
className: '',
|
|
18
|
+
url: '',
|
|
19
|
+
style: {},
|
|
20
|
+
muted: false,
|
|
21
|
+
autoplay: false,
|
|
22
|
+
loop: false,
|
|
23
|
+
preload: 'auto',
|
|
24
|
+
type: 'progress',
|
|
25
|
+
onFastBack: function onFastBack(e) {},
|
|
26
|
+
onForward: function onForward(e) {},
|
|
27
|
+
onPause: function onPause(e) {},
|
|
28
|
+
onPlayEnd: function onPlayEnd(e) {},
|
|
29
|
+
onMute: function onMute(e) {},
|
|
30
|
+
onCanPlay: function onCanPlay(e) {}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var Audio = function Audio(props) {
|
|
34
|
+
var _useConfig = useConfig(),
|
|
35
|
+
locale = _useConfig.locale;
|
|
36
|
+
|
|
37
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
38
|
+
className = _defaultProps$props.className,
|
|
39
|
+
url = _defaultProps$props.url,
|
|
40
|
+
style = _defaultProps$props.style,
|
|
41
|
+
muted = _defaultProps$props.muted,
|
|
42
|
+
autoplay = _defaultProps$props.autoplay,
|
|
43
|
+
loop = _defaultProps$props.loop,
|
|
44
|
+
preload = _defaultProps$props.preload,
|
|
45
|
+
type = _defaultProps$props.type,
|
|
46
|
+
onFastBack = _defaultProps$props.onFastBack,
|
|
47
|
+
onForward = _defaultProps$props.onForward,
|
|
48
|
+
onPause = _defaultProps$props.onPause,
|
|
49
|
+
onPlayEnd = _defaultProps$props.onPlayEnd,
|
|
50
|
+
onMute = _defaultProps$props.onMute,
|
|
51
|
+
onCanPlay = _defaultProps$props.onCanPlay,
|
|
52
|
+
children = _defaultProps$props.children,
|
|
53
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
54
|
+
|
|
55
|
+
var _useState = useState(false),
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
playing = _useState2[0],
|
|
58
|
+
setPlaying = _useState2[1];
|
|
59
|
+
|
|
60
|
+
var _useState3 = useState(0),
|
|
61
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
62
|
+
percent = _useState4[0],
|
|
63
|
+
setPercent = _useState4[1];
|
|
64
|
+
|
|
65
|
+
var _useState5 = useState(false),
|
|
66
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
67
|
+
isCanPlay = _useState6[0],
|
|
68
|
+
setIsCanPlay = _useState6[1];
|
|
69
|
+
|
|
70
|
+
var _useState7 = useState('00:00:00'),
|
|
71
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
72
|
+
currentDuration = _useState8[0],
|
|
73
|
+
setCurrentDuration = _useState8[1];
|
|
74
|
+
|
|
75
|
+
var AudioRef = useRef(null);
|
|
76
|
+
var statusRef = useRef({
|
|
77
|
+
currentTime: 0,
|
|
78
|
+
currentDuration: '00:00:00',
|
|
79
|
+
percent: 0,
|
|
80
|
+
duration: '00:00:00',
|
|
81
|
+
second: 0,
|
|
82
|
+
hanMuted: props.muted,
|
|
83
|
+
playing: props.autoplay,
|
|
84
|
+
handPlaying: false
|
|
85
|
+
});
|
|
86
|
+
var b = cn('audio');
|
|
87
|
+
var warn = console.warn;
|
|
88
|
+
|
|
89
|
+
var handleEnded = function handleEnded(e) {
|
|
90
|
+
if (props.loop) {
|
|
91
|
+
warn(locale.audio.tips || 'onPlayEnd事件在loop=false时才会触发');
|
|
92
|
+
} else {
|
|
93
|
+
props.onPlayEnd && props.onPlayEnd(e);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function watch() {
|
|
98
|
+
if (AudioRef && AudioRef.current) {
|
|
99
|
+
var current = AudioRef.current;
|
|
100
|
+
current.addEventListener('play', function () {
|
|
101
|
+
setPlaying(true);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
useEffect(function () {
|
|
107
|
+
watch();
|
|
108
|
+
}, []);
|
|
109
|
+
useEffect(function () {}, [currentDuration]);
|
|
110
|
+
|
|
111
|
+
var handleStatusChange = function handleStatusChange() {
|
|
112
|
+
setPlaying(!playing);
|
|
113
|
+
|
|
114
|
+
if (playing) {
|
|
115
|
+
AudioRef && AudioRef.current && AudioRef.current.pause();
|
|
116
|
+
} else {
|
|
117
|
+
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
var renderIcon = function renderIcon() {
|
|
122
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
123
|
+
className: b('icon')
|
|
124
|
+
}, React__default.createElement("div", {
|
|
125
|
+
className: "".concat(b('icon-box'), " ").concat(playing ? b('icon-play') : b('icon-stop')),
|
|
126
|
+
onClick: handleStatusChange
|
|
127
|
+
}, playing ? React__default.createElement(Icon, {
|
|
128
|
+
name: "service",
|
|
129
|
+
className: "nut-icon-loading"
|
|
130
|
+
}) : React__default.createElement(Icon, {
|
|
131
|
+
name: "service"
|
|
132
|
+
}))));
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
var handleBack = function handleBack() {
|
|
136
|
+
if (statusRef.current.currentTime > 0 && AudioRef.current) {
|
|
137
|
+
statusRef.current.currentTime--;
|
|
138
|
+
AudioRef.current.currentTime = statusRef.current.currentTime;
|
|
139
|
+
props.onFastBack && props.onFastBack(AudioRef.current);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var handleForward = function handleForward() {
|
|
144
|
+
if (AudioRef.current) {
|
|
145
|
+
statusRef.current.currentTime++;
|
|
146
|
+
AudioRef.current.currentTime = statusRef.current.currentTime;
|
|
147
|
+
props.onForward && props.onForward(AudioRef.current);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
var handleMute = function handleMute() {
|
|
152
|
+
if (AudioRef.current) {
|
|
153
|
+
AudioRef.current.muted = !AudioRef.current.muted;
|
|
154
|
+
props.onMute && props.onMute(AudioRef.current);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var handlePause = function handlePause(e) {
|
|
159
|
+
setPlaying(false);
|
|
160
|
+
props.onPause && props.onPause(e);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var formatSeconds = function formatSeconds(value) {
|
|
164
|
+
if (!value) {
|
|
165
|
+
return '00:00:00';
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var time = parseInt(value);
|
|
169
|
+
var hours = Math.floor(time / 3600);
|
|
170
|
+
var minutes = Math.floor((time - hours * 3600) / 60);
|
|
171
|
+
var seconds = time - hours * 3600 - minutes * 60;
|
|
172
|
+
var result = '';
|
|
173
|
+
result += "".concat("0".concat(hours.toString()).slice(-2), ":");
|
|
174
|
+
result += "".concat("0".concat(minutes.toString()).slice(-2), ":");
|
|
175
|
+
result += "0".concat(seconds.toString()).slice(-2);
|
|
176
|
+
return result;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
var renderProgerss = function renderProgerss() {
|
|
180
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
181
|
+
className: b('progress')
|
|
182
|
+
}, React__default.createElement("div", {
|
|
183
|
+
className: "time"
|
|
184
|
+
}, currentDuration), React__default.createElement("div", {
|
|
185
|
+
className: b('progress-bar-wrapper')
|
|
186
|
+
}, React__default.createElement(Range, {
|
|
187
|
+
modelValue: percent,
|
|
188
|
+
hiddenTag: true,
|
|
189
|
+
hiddenRange: true,
|
|
190
|
+
"inactive-color": "#cccccc",
|
|
191
|
+
"active-color": "#fa2c19"
|
|
192
|
+
})), React__default.createElement("div", {
|
|
193
|
+
className: "time"
|
|
194
|
+
}, AudioRef.current ? formatSeconds("".concat(statusRef.current.second)) : '00:00:00')), React__default.createElement("div", {
|
|
195
|
+
className: isCanPlay ? 'custom-button-group' : 'custom-button-group-disable'
|
|
196
|
+
}, React__default.createElement(Button, {
|
|
197
|
+
type: "primary",
|
|
198
|
+
size: "small",
|
|
199
|
+
className: "back",
|
|
200
|
+
onClick: handleBack
|
|
201
|
+
}, locale.audio.back || '快退'), React__default.createElement(Button, {
|
|
202
|
+
type: "primary",
|
|
203
|
+
size: "small",
|
|
204
|
+
className: "start",
|
|
205
|
+
onClick: handleStatusChange
|
|
206
|
+
}, playing ? "".concat(locale.audio.pause || '暂停') : "".concat(locale.audio.start || '开始')), React__default.createElement(Button, {
|
|
207
|
+
type: "primary",
|
|
208
|
+
size: "small",
|
|
209
|
+
onClick: handleForward
|
|
210
|
+
}, locale.audio.forward || '快进'), React__default.createElement(Button, {
|
|
211
|
+
type: AudioRef.current && AudioRef.current.muted ? 'default' : 'primary',
|
|
212
|
+
size: "small",
|
|
213
|
+
onClick: handleMute
|
|
214
|
+
}, locale.audio.mute || '静音')));
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
var renderNone = function renderNone() {
|
|
218
|
+
return React__default.createElement("div", {
|
|
219
|
+
className: b('none-container'),
|
|
220
|
+
onClick: handleStatusChange
|
|
221
|
+
}, children);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
var renderAudio = function renderAudio() {
|
|
225
|
+
switch (type) {
|
|
226
|
+
case 'icon':
|
|
227
|
+
return renderIcon();
|
|
228
|
+
|
|
229
|
+
case 'progress':
|
|
230
|
+
return renderProgerss();
|
|
231
|
+
|
|
232
|
+
case 'none':
|
|
233
|
+
return renderNone();
|
|
234
|
+
|
|
235
|
+
default:
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
var handleCanplay = function handleCanplay(e) {
|
|
241
|
+
setIsCanPlay(true);
|
|
242
|
+
|
|
243
|
+
if (props.autoplay && !playing) {
|
|
244
|
+
AudioRef && AudioRef.current && AudioRef.current.play();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (AudioRef.current) {
|
|
248
|
+
statusRef.current.second = AudioRef.current.duration || 0;
|
|
249
|
+
props.onCanPlay && props.onCanPlay(e);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
var onTimeupdate = function onTimeupdate(e) {
|
|
254
|
+
var time = parseInt(e.target.currentTime);
|
|
255
|
+
var formated = formatSeconds("".concat(time));
|
|
256
|
+
statusRef.current.currentDuration = formated;
|
|
257
|
+
setPercent(time / statusRef.current.second * 100);
|
|
258
|
+
setCurrentDuration(formated);
|
|
259
|
+
statusRef.current.currentTime = time;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
return React__default.createElement("div", _objectSpread({
|
|
263
|
+
className: "".concat(b(), " ").concat(className),
|
|
264
|
+
style: style
|
|
265
|
+
}, rest), renderAudio(), React__default.createElement("audio", {
|
|
266
|
+
className: "audioMain",
|
|
267
|
+
controls: type === 'controls',
|
|
268
|
+
ref: AudioRef,
|
|
269
|
+
src: url,
|
|
270
|
+
muted: muted,
|
|
271
|
+
preload: preload,
|
|
272
|
+
loop: loop,
|
|
273
|
+
onPause: function onPause(e) {
|
|
274
|
+
return handlePause(e);
|
|
275
|
+
},
|
|
276
|
+
onEnded: function onEnded(e) {
|
|
277
|
+
return handleEnded(e);
|
|
278
|
+
},
|
|
279
|
+
onCanPlay: function onCanPlay(e) {
|
|
280
|
+
return handleCanplay(e);
|
|
281
|
+
},
|
|
282
|
+
onTimeUpdate: function onTimeUpdate(e) {
|
|
283
|
+
return onTimeupdate(e);
|
|
284
|
+
}
|
|
285
|
+
}, React__default.createElement("track", {
|
|
286
|
+
kind: "captions"
|
|
287
|
+
})));
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
Audio.defaultProps = defaultProps;
|
|
291
|
+
Audio.displayName = 'NutAudio';
|
|
292
|
+
export { Audio as A };
|
|
@@ -8,7 +8,7 @@ import React__default, { useRef } from 'react';
|
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { A as AvatarContext } from './AvatarContext-7153ad2b.js';
|
|
10
10
|
import { c as cn } from './bem-893ad28d.js';
|
|
11
|
-
import { u as useConfig } from './configprovider-
|
|
11
|
+
import { u as useConfig } from './configprovider-9c393a29.js';
|
|
12
12
|
var defaultProps = {
|
|
13
13
|
maxContent: '',
|
|
14
14
|
maxCount: '',
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import { P as Popup } from './popup-67173ec6.js';
|
|
9
|
+
import { U as Utils, C as CalendarItem } from './calendaritem.taro-3c06a809.js';
|
|
10
|
+
import { u as useConfig } from './configprovider-9c393a29.js';
|
|
11
|
+
var defaultProps = {
|
|
12
|
+
type: 'one',
|
|
13
|
+
isAutoBackFill: false,
|
|
14
|
+
poppable: true,
|
|
15
|
+
visible: false,
|
|
16
|
+
title: '日历选择',
|
|
17
|
+
defaultValue: '',
|
|
18
|
+
startDate: Utils.getDay(0),
|
|
19
|
+
endDate: Utils.getDay(365),
|
|
20
|
+
onClose: function onClose() {},
|
|
21
|
+
onChoose: function onChoose(param) {}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var Calendar = function Calendar(props) {
|
|
25
|
+
var _useConfig = useConfig(),
|
|
26
|
+
locale = _useConfig.locale;
|
|
27
|
+
|
|
28
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
29
|
+
children = _defaultProps$props.children,
|
|
30
|
+
poppable = _defaultProps$props.poppable,
|
|
31
|
+
visible = _defaultProps$props.visible,
|
|
32
|
+
type = _defaultProps$props.type,
|
|
33
|
+
isAutoBackFill = _defaultProps$props.isAutoBackFill,
|
|
34
|
+
title = _defaultProps$props.title,
|
|
35
|
+
defaultValue = _defaultProps$props.defaultValue,
|
|
36
|
+
startDate = _defaultProps$props.startDate,
|
|
37
|
+
endDate = _defaultProps$props.endDate,
|
|
38
|
+
onClose = _defaultProps$props.onClose,
|
|
39
|
+
onChoose = _defaultProps$props.onChoose;
|
|
40
|
+
|
|
41
|
+
var close = function close() {
|
|
42
|
+
onClose && onClose();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var update = function update() {};
|
|
46
|
+
|
|
47
|
+
var choose = function choose(param) {
|
|
48
|
+
close();
|
|
49
|
+
onChoose && onChoose(param);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var closePopup = function closePopup() {
|
|
53
|
+
close();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return React__default.createElement(React__default.Fragment, null, poppable ? React__default.createElement(Popup, {
|
|
57
|
+
visible: visible,
|
|
58
|
+
position: "bottom",
|
|
59
|
+
round: true,
|
|
60
|
+
closeable: true,
|
|
61
|
+
onClickOverlay: closePopup,
|
|
62
|
+
onClickCloseIcon: closePopup
|
|
63
|
+
}, React__default.createElement(CalendarItem, {
|
|
64
|
+
type: type,
|
|
65
|
+
isAutoBackFill: isAutoBackFill,
|
|
66
|
+
poppable: poppable,
|
|
67
|
+
title: locale.calendaritem.title || title,
|
|
68
|
+
defaultValue: defaultValue,
|
|
69
|
+
startDate: startDate,
|
|
70
|
+
endDate: endDate,
|
|
71
|
+
onUpdate: update,
|
|
72
|
+
onClose: close,
|
|
73
|
+
onChoose: choose
|
|
74
|
+
})) : React__default.createElement(CalendarItem, {
|
|
75
|
+
type: type,
|
|
76
|
+
isAutoBackFill: isAutoBackFill,
|
|
77
|
+
poppable: poppable,
|
|
78
|
+
title: locale.calendaritem.title,
|
|
79
|
+
defaultValue: defaultValue,
|
|
80
|
+
startDate: startDate,
|
|
81
|
+
endDate: endDate,
|
|
82
|
+
onClose: close,
|
|
83
|
+
onChoose: choose
|
|
84
|
+
}));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
Calendar.defaultProps = defaultProps;
|
|
88
|
+
Calendar.displayName = 'NutCalendar';
|
|
89
|
+
export { Calendar as C };
|
|
@@ -11,8 +11,133 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
11
11
|
import React__default, { useState, useRef, useEffect } from 'react';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
13
|
import { c as cn } from './bem-893ad28d.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { u as useConfig } from './configprovider-9c393a29.js';
|
|
15
|
+
import { g as getRectByTaro } from './useClientRect-8b7cc406.js';
|
|
16
|
+
var Utils = {
|
|
17
|
+
/**
|
|
18
|
+
* 是否为闫年
|
|
19
|
+
* @return {Boolse} true|false
|
|
20
|
+
*/
|
|
21
|
+
isLeapYear: function isLeapYear(y) {
|
|
22
|
+
return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 返回星期数
|
|
27
|
+
* @return {String}
|
|
28
|
+
*/
|
|
29
|
+
getWhatDay: function getWhatDay(year, month, day) {
|
|
30
|
+
var date = new Date("".concat(year, "/").concat(month, "/").concat(day));
|
|
31
|
+
var index = date.getDay();
|
|
32
|
+
var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
|
|
33
|
+
return dayNames[index];
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 返回星期数
|
|
38
|
+
* @return {Number}
|
|
39
|
+
*/
|
|
40
|
+
getMonthPreDay: function getMonthPreDay(year, month) {
|
|
41
|
+
var date = new Date("".concat(year, "/").concat(month, "/01"));
|
|
42
|
+
var day = date.getDay();
|
|
43
|
+
|
|
44
|
+
if (day == 0) {
|
|
45
|
+
day = 7;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return day;
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 返回月份天数
|
|
53
|
+
* @return {Number}
|
|
54
|
+
*/
|
|
55
|
+
getMonthDays: function getMonthDays(year, month) {
|
|
56
|
+
if (/^0/.test(month)) {
|
|
57
|
+
month = month.split('')[1];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return [0, 31, this.isLeapYear(Number(year)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 补齐数字位数
|
|
65
|
+
* @return {string}
|
|
66
|
+
*/
|
|
67
|
+
getNumTwoBit: function getNumTwoBit(n) {
|
|
68
|
+
n = Number(n);
|
|
69
|
+
return (n > 9 ? '' : '0') + n;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 日期对象转成字符串
|
|
74
|
+
* @return {string}
|
|
75
|
+
*/
|
|
76
|
+
date2Str: function date2Str(date, split) {
|
|
77
|
+
split = split || '-';
|
|
78
|
+
var y = date.getFullYear();
|
|
79
|
+
var m = this.getNumTwoBit(date.getMonth() + 1);
|
|
80
|
+
var d = this.getNumTwoBit(date.getDate());
|
|
81
|
+
return [y, m, d].join(split);
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 返回日期格式字符串
|
|
86
|
+
* @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
|
|
87
|
+
* @return {string} '2014-12-31'
|
|
88
|
+
*/
|
|
89
|
+
getDay: function getDay(i) {
|
|
90
|
+
i = i || 0;
|
|
91
|
+
var date = new Date();
|
|
92
|
+
var diff = i * (1000 * 60 * 60 * 24);
|
|
93
|
+
date = new Date(date.getTime() + diff);
|
|
94
|
+
return this.date2Str(date);
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 时间比较
|
|
99
|
+
* @return {Boolean}
|
|
100
|
+
*/
|
|
101
|
+
compareDate: function compareDate(date1, date2) {
|
|
102
|
+
var startTime = new Date(date1.replace('-', '/').replace('-', '/'));
|
|
103
|
+
var endTime = new Date(date2.replace('-', '/').replace('-', '/'));
|
|
104
|
+
|
|
105
|
+
if (startTime >= endTime) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return true;
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 时间是否相等
|
|
114
|
+
* @return {Boolean}
|
|
115
|
+
*/
|
|
116
|
+
isEqual: function isEqual(date1, date2) {
|
|
117
|
+
var startTime = new Date(date1).getTime();
|
|
118
|
+
var endTime = new Date(date2).getTime();
|
|
119
|
+
|
|
120
|
+
if (startTime == endTime) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
function requestAniFrame() {
|
|
129
|
+
if (typeof window !== 'undefined') {
|
|
130
|
+
return window.requestAnimationFrame || function (callback) {
|
|
131
|
+
window.setTimeout(callback, 1000 / 60);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return function (callback) {
|
|
136
|
+
setTimeout(callback, 1000 / 60);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var requestAniFrame$1 = requestAniFrame();
|
|
16
141
|
var defaultProps = {
|
|
17
142
|
type: 'one',
|
|
18
143
|
isAutoBackFill: false,
|
|
@@ -278,7 +403,7 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
278
403
|
return false;
|
|
279
404
|
}
|
|
280
405
|
|
|
281
|
-
requestAniFrame( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
406
|
+
requestAniFrame$1( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
282
407
|
var weeksPanelRes, monthsDoms, i;
|
|
283
408
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
284
409
|
while (1) {
|
|
@@ -290,7 +415,7 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
290
415
|
}
|
|
291
416
|
|
|
292
417
|
_context.next = 3;
|
|
293
|
-
return weeksPanel === null || weeksPanel === void 0 ? void 0 : weeksPanel.current
|
|
418
|
+
return getRectByTaro(weeksPanel === null || weeksPanel === void 0 ? void 0 : weeksPanel.current);
|
|
294
419
|
|
|
295
420
|
case 3:
|
|
296
421
|
weeksPanelRes = _context.sent;
|
|
@@ -555,4 +680,4 @@ var CalendarItem = function CalendarItem(props) {
|
|
|
555
680
|
|
|
556
681
|
CalendarItem.defaultProps = defaultProps;
|
|
557
682
|
CalendarItem.displayName = 'NutCalendarItem';
|
|
558
|
-
export { CalendarItem as C };
|
|
683
|
+
export { CalendarItem as C, Utils as U };
|