@nutui/nutui-react 1.5.1 → 1.5.2-beta.0
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 +8 -0
- package/dist/nutui.react.mjs +27 -22
- package/dist/nutui.react.umd.js +27 -22
- package/package.json +1 -1
- package/dist/esm/ActionSheet/style/index.js +0 -2
- package/dist/esm/ActionSheet.js +0 -92
- package/dist/esm/Address/style/index.js +0 -4
- package/dist/esm/Address.js +0 -622
- package/dist/esm/Animate/style/index.js +0 -2
- package/dist/esm/Animate.js +0 -55
- package/dist/esm/AnimatingNumbers/style/index.js +0 -3
- package/dist/esm/AnimatingNumbers.js +0 -127
- package/dist/esm/Audio/style/index.js +0 -4
- package/dist/esm/Audio.js +0 -266
- package/dist/esm/Avatar/style/index.js +0 -2
- package/dist/esm/Avatar.js +0 -132
- package/dist/esm/AvatarContext-15733596.js +0 -3
- package/dist/esm/AvatarGroup/style/index.js +0 -2
- package/dist/esm/AvatarGroup.js +0 -43
- package/dist/esm/BackTop/style/index.js +0 -2
- package/dist/esm/BackTop.js +0 -139
- package/dist/esm/Badge/style/index.js +0 -2
- package/dist/esm/Badge.js +0 -73
- package/dist/esm/Barrage/style/index.js +0 -2
- package/dist/esm/Barrage.js +0 -99
- package/dist/esm/Button/style/index.js +0 -2
- package/dist/esm/Button.js +0 -109
- package/dist/esm/Calendar/style/index.js +0 -2
- package/dist/esm/Calendar.js +0 -129
- package/dist/esm/CalendarItem/style/index.js +0 -2
- package/dist/esm/CalendarItem.js +0 -676
- package/dist/esm/Card/style/index.js +0 -4
- package/dist/esm/Card.js +0 -63
- package/dist/esm/Cascader/style/index.js +0 -3
- package/dist/esm/Cascader.js +0 -673
- package/dist/esm/Cell/style/index.js +0 -2
- package/dist/esm/Cell.js +0 -103
- package/dist/esm/CellGroup/style/index.js +0 -2
- package/dist/esm/CellGroup.js +0 -5
- package/dist/esm/Checkbox/style/index.js +0 -3
- package/dist/esm/Checkbox.js +0 -8
- package/dist/esm/CheckboxGroup/style/index.js +0 -2
- package/dist/esm/CheckboxGroup.js +0 -113
- package/dist/esm/CircleProgress/style/index.js +0 -2
- package/dist/esm/CircleProgress.js +0 -116
- package/dist/esm/Col/style/index.js +0 -2
- package/dist/esm/Col.js +0 -58
- package/dist/esm/Collapse/style/index.js +0 -2
- package/dist/esm/Collapse.js +0 -99
- package/dist/esm/CollapseItem/style/index.js +0 -2
- package/dist/esm/CollapseItem.js +0 -148
- package/dist/esm/ConfigProvider/style/index.js +0 -2
- package/dist/esm/ConfigProvider.js +0 -187
- package/dist/esm/CountDown/style/index.js +0 -2
- package/dist/esm/CountDown.js +0 -247
- package/dist/esm/DatePicker/style/index.js +0 -2
- package/dist/esm/DatePicker.js +0 -310
- package/dist/esm/Dialog/style/index.js +0 -3
- package/dist/esm/Dialog.js +0 -296
- package/dist/esm/Divider/style/index.js +0 -2
- package/dist/esm/Divider.js +0 -36
- package/dist/esm/Drag/style/index.js +0 -2
- package/dist/esm/Drag.js +0 -120
- package/dist/esm/Elevator/style/index.js +0 -2
- package/dist/esm/Elevator.js +0 -236
- package/dist/esm/Ellipsis/style/index.js +0 -2
- package/dist/esm/Ellipsis.js +0 -177
- package/dist/esm/Empty/style/index.js +0 -2
- package/dist/esm/Empty.js +0 -82
- package/dist/esm/FixedNav/style/index.js +0 -3
- package/dist/esm/FixedNav.js +0 -105
- package/dist/esm/Form/style/index.js +0 -2
- package/dist/esm/Form.js +0 -221
- package/dist/esm/FormItem/style/index.js +0 -2
- package/dist/esm/FormItem.js +0 -5
- package/dist/esm/Grid/style/index.js +0 -2
- package/dist/esm/Grid.js +0 -83
- package/dist/esm/GridItem/style/index.js +0 -2
- package/dist/esm/GridItem.js +0 -125
- package/dist/esm/Icon/style/index.js +0 -4
- package/dist/esm/Icon.js +0 -5
- package/dist/esm/Image/style/index.js +0 -2
- package/dist/esm/Image.js +0 -170
- package/dist/esm/ImagePreview/style/index.js +0 -4
- package/dist/esm/ImagePreview.js +0 -226
- package/dist/esm/Indicator/style/index.js +0 -2
- package/dist/esm/Indicator.js +0 -52
- package/dist/esm/Infiniteloading/style/index.js +0 -2
- package/dist/esm/Infiniteloading.js +0 -217
- package/dist/esm/Input/style/index.js +0 -2
- package/dist/esm/Input.js +0 -363
- package/dist/esm/InputNumber/style/index.js +0 -2
- package/dist/esm/InputNumber.js +0 -277
- package/dist/esm/Layout/style/index.js +0 -2
- package/dist/esm/Layout.js +0 -14
- package/dist/esm/Menu/style/index.js +0 -3
- package/dist/esm/Menu.js +0 -154
- package/dist/esm/MenuItem/style/index.js +0 -3
- package/dist/esm/MenuItem.js +0 -177
- package/dist/esm/NavBar/style/index.js +0 -2
- package/dist/esm/NavBar.js +0 -116
- package/dist/esm/NoticeBar/style/index.js +0 -2
- package/dist/esm/NoticeBar.js +0 -570
- package/dist/esm/Notify/style/index.js +0 -2
- package/dist/esm/Notify.js +0 -236
- package/dist/esm/NumberKeyboard/style/index.js +0 -2
- package/dist/esm/NumberKeyboard.js +0 -249
- package/dist/esm/Overlay/style/index.js +0 -2
- package/dist/esm/Overlay.js +0 -6
- package/dist/esm/Pagination/style/index.js +0 -2
- package/dist/esm/Pagination.js +0 -170
- package/dist/esm/Picker/style/index.js +0 -2
- package/dist/esm/Picker.js +0 -496
- package/dist/esm/Popover/style/index.js +0 -3
- package/dist/esm/Popover.js +0 -225
- package/dist/esm/Popup/style/index.js +0 -3
- package/dist/esm/Popup.js +0 -195
- package/dist/esm/Price/style/index.js +0 -2
- package/dist/esm/Price.js +0 -86
- package/dist/esm/Progress/style/index.js +0 -2
- package/dist/esm/Progress.js +0 -124
- package/dist/esm/PullToRefresh/style/index.js +0 -2
- package/dist/esm/PullToRefresh.js +0 -277
- package/dist/esm/Radio/style/index.js +0 -3
- package/dist/esm/Radio.js +0 -6
- package/dist/esm/RadioGroup/style/index.js +0 -2
- package/dist/esm/RadioGroup.js +0 -123
- package/dist/esm/Range/style/index.js +0 -2
- package/dist/esm/Range.js +0 -407
- package/dist/esm/Rate/style/index.js +0 -2
- package/dist/esm/Rate.js +0 -123
- package/dist/esm/Row/style/index.js +0 -2
- package/dist/esm/Row.js +0 -50
- package/dist/esm/SearchBar/style/index.js +0 -2
- package/dist/esm/SearchBar.js +0 -237
- package/dist/esm/ShortPassword/style/index.js +0 -3
- package/dist/esm/ShortPassword.js +0 -193
- package/dist/esm/SideNavBar/style/index.js +0 -2
- package/dist/esm/SideNavBar.js +0 -58
- package/dist/esm/SideNavBarItem/style/index.js +0 -2
- package/dist/esm/SideNavBarItem.js +0 -25
- package/dist/esm/Signature/style/index.js +0 -2
- package/dist/esm/Signature.js +0 -155
- package/dist/esm/Skeleton/style/index.js +0 -2
- package/dist/esm/Skeleton.js +0 -100
- package/dist/esm/Step/style/index.js +0 -2
- package/dist/esm/Step.js +0 -89
- package/dist/esm/Steps/style/index.js +0 -2
- package/dist/esm/Steps.js +0 -40
- package/dist/esm/Sticky/style/index.js +0 -2
- package/dist/esm/Sticky.js +0 -192
- package/dist/esm/SubSideNavBar/style/index.js +0 -2
- package/dist/esm/SubSideNavBar.js +0 -79
- package/dist/esm/Swipe/style/index.js +0 -2
- package/dist/esm/Swipe.js +0 -232
- package/dist/esm/Swiper/style/index.js +0 -2
- package/dist/esm/Swiper.js +0 -492
- package/dist/esm/SwiperItem/style/index.js +0 -2
- package/dist/esm/SwiperItem.js +0 -38
- package/dist/esm/Switch/style/index.js +0 -2
- package/dist/esm/Switch.js +0 -73
- package/dist/esm/TabPane/style/index.js +0 -2
- package/dist/esm/TabPane.js +0 -6
- package/dist/esm/Tabbar/style/index.js +0 -2
- package/dist/esm/Tabbar.js +0 -70
- package/dist/esm/TabbarItem/style/index.js +0 -2
- package/dist/esm/TabbarItem.js +0 -80
- package/dist/esm/Table/style/index.js +0 -2
- package/dist/esm/Table.js +0 -142
- package/dist/esm/Tabs/style/index.js +0 -4
- package/dist/esm/Tabs.js +0 -9
- package/dist/esm/Tag/style/index.js +0 -2
- package/dist/esm/Tag.js +0 -111
- package/dist/esm/TextArea/style/index.js +0 -2
- package/dist/esm/TextArea.js +0 -150
- package/dist/esm/TimeDetail/style/index.js +0 -2
- package/dist/esm/TimeDetail.js +0 -69
- package/dist/esm/TimePannel/style/index.js +0 -2
- package/dist/esm/TimePannel.js +0 -31
- package/dist/esm/TimeSelect/style/index.js +0 -4
- package/dist/esm/TimeSelect.js +0 -173
- package/dist/esm/Toast/style/index.js +0 -2
- package/dist/esm/Toast.js +0 -271
- package/dist/esm/TrendArrow/style/index.js +0 -2
- package/dist/esm/TrendArrow.js +0 -101
- package/dist/esm/Uploader/style/index.js +0 -4
- package/dist/esm/Uploader.js +0 -566
- package/dist/esm/UserContext-101ad4a4.js +0 -3
- package/dist/esm/UserContext-2629d479.js +0 -3
- package/dist/esm/UserContext-b33bcf21.js +0 -3
- package/dist/esm/Video/style/index.js +0 -2
- package/dist/esm/Video.js +0 -92
- package/dist/esm/VirtualList/style/index.js +0 -2
- package/dist/esm/VirtualList.js +0 -315
- package/dist/esm/WaterMark/style/index.js +0 -2
- package/dist/esm/WaterMark.js +0 -113
- package/dist/esm/bem-3b438e61.js +0 -8
- package/dist/esm/cellgroup-fcc72767.js +0 -34
- package/dist/esm/checkbox-44e13cd0.js +0 -137
- package/dist/esm/date-c7aad4c0.js +0 -97
- package/dist/esm/formitem-8a73a5fb.js +0 -157
- package/dist/esm/get-scroll-parent-5f85dee8.js +0 -24
- package/dist/esm/grid.context-2ee27d95.js +0 -6
- package/dist/esm/icon-4ef1581c.js +0 -70
- package/dist/esm/index-030b7245.js +0 -11
- package/dist/esm/nutui-react.es.js +0 -94
- package/dist/esm/offsetContext-3ab00d40.js +0 -16
- package/dist/esm/overlay-de6c79d5.js +0 -83
- package/dist/esm/radio-9f141e6b.js +0 -118
- package/dist/esm/render-bbebb760.js +0 -79
- package/dist/esm/tabpane-01075e6c.js +0 -29
- package/dist/esm/tabs-e1b4e4b1.js +0 -181
- package/dist/esm/typings-f27b58f4.js +0 -8
- package/dist/esm/useClientRect-56bb675b.js +0 -39
- package/dist/esm/useTouch-cf73a407.js +0 -99
- package/dist/locales/base.d.ts +0 -129
- package/dist/locales/base.js +0 -5
- package/dist/locales/en-US.d.ts +0 -3
- package/dist/locales/en-US.js +0 -135
- package/dist/locales/id-ID.d.ts +0 -3
- package/dist/locales/id-ID.js +0 -135
- package/dist/locales/zh-CN.d.ts +0 -3
- package/dist/locales/zh-CN.js +0 -137
- package/dist/locales/zh-TW.d.ts +0 -3
- package/dist/locales/zh-TW.js +0 -135
- package/dist/locales/zh-UG.d.ts +0 -3
- package/dist/locales/zh-UG.js +0 -135
- package/dist/packages/actionsheet/actionsheet.scss +0 -103
- package/dist/packages/address/address.scss +0 -243
- package/dist/packages/animate/animate.scss +0 -284
- package/dist/packages/animatingnumbers/animatingnumbers.scss +0 -0
- package/dist/packages/animatingnumbers/countup.scss +0 -45
- package/dist/packages/audio/audio.scss +0 -93
- package/dist/packages/avatar/avatar.scss +0 -58
- package/dist/packages/avatargroup/avatargroup.scss +0 -14
- package/dist/packages/backtop/backtop.scss +0 -29
- package/dist/packages/badge/badge.scss +0 -53
- package/dist/packages/barrage/barrage.scss +0 -60
- package/dist/packages/button/button.scss +0 -245
- package/dist/packages/calendar/calendar.scss +0 -265
- package/dist/packages/calendaritem/calendaritem.scss +0 -0
- package/dist/packages/card/card.scss +0 -83
- package/dist/packages/cascader/cascader.scss +0 -108
- package/dist/packages/cell/cell.scss +0 -107
- package/dist/packages/cellgroup/cellgroup.scss +0 -46
- package/dist/packages/checkbox/checkbox.scss +0 -49
- package/dist/packages/checkboxgroup/checkboxgroup.scss +0 -33
- package/dist/packages/circleprogress/circleprogress.scss +0 -33
- package/dist/packages/col/col.scss +0 -24
- package/dist/packages/collapse/collapse.scss +0 -0
- package/dist/packages/collapseitem/collapseitem.scss +0 -161
- package/dist/packages/configprovider/configprovider.scss +0 -0
- package/dist/packages/countdown/countdown.scss +0 -3
- package/dist/packages/datepicker/datepicker.scss +0 -0
- package/dist/packages/dialog/dialog.scss +0 -135
- package/dist/packages/divider/divider.scss +0 -73
- package/dist/packages/drag/drag.scss +0 -10
- package/dist/packages/elevator/elevator.scss +0 -124
- package/dist/packages/ellipsis/ellipsis.scss +0 -17
- package/dist/packages/empty/empty.scss +0 -42
- package/dist/packages/fixednav/fixednav.scss +0 -141
- package/dist/packages/form/form.scss +0 -31
- package/dist/packages/formitem/formitem.scss +0 -100
- package/dist/packages/grid/grid.scss +0 -10
- package/dist/packages/griditem/griditem.scss +0 -108
- package/dist/packages/icon/icon.scss +0 -132
- package/dist/packages/image/image.scss +0 -53
- package/dist/packages/imagepreview/imagepreview.scss +0 -51
- package/dist/packages/indicator/indicator.scss +0 -70
- package/dist/packages/infiniteloading/infiniteloading.scss +0 -69
- package/dist/packages/input/input.scss +0 -203
- package/dist/packages/inputnumber/inputnumber.scss +0 -79
- package/dist/packages/layout/layout.scss +0 -2
- package/dist/packages/menu/menu.scss +0 -75
- package/dist/packages/menuitem/menuitem.scss +0 -120
- package/dist/packages/navbar/navbar.scss +0 -185
- package/dist/packages/noticebar/noticebar.scss +0 -156
- package/dist/packages/notify/notify.scss +0 -93
- package/dist/packages/numberkeyboard/numberkeyboard.scss +0 -147
- package/dist/packages/overlay/overlay.scss +0 -75
- package/dist/packages/pagination/pagination.scss +0 -81
- package/dist/packages/picker/picker.scss +0 -225
- package/dist/packages/popover/popover.scss +0 -288
- package/dist/packages/popup/popup.scss +0 -201
- package/dist/packages/price/price.scss +0 -37
- package/dist/packages/progress/progress.scss +0 -114
- package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -26
- package/dist/packages/radio/radio.scss +0 -84
- package/dist/packages/radiogroup/radiogroup.scss +0 -86
- package/dist/packages/range/range.scss +0 -224
- package/dist/packages/rate/rate.scss +0 -36
- package/dist/packages/row/row.scss +0 -83
- package/dist/packages/searchbar/searchbar.scss +0 -146
- package/dist/packages/shortpassword/shortpassword.scss +0 -203
- package/dist/packages/sidenavbar/sidenavbar.scss +0 -100
- package/dist/packages/sidenavbaritem/sidenavbaritem.scss +0 -25
- package/dist/packages/signature/signature.scss +0 -39
- package/dist/packages/skeleton/skeleton.scss +0 -70
- package/dist/packages/step/step.scss +0 -274
- package/dist/packages/steps/steps.scss +0 -7
- package/dist/packages/sticky/sticky.scss +0 -3
- package/dist/packages/subsidenavbar/subsidenavbar.scss +0 -35
- package/dist/packages/swipe/swipe.scss +0 -33
- package/dist/packages/swiper/swiper.scss +0 -45
- package/dist/packages/swiperitem/swiperitem.scss +0 -3
- package/dist/packages/switch/switch.scss +0 -87
- package/dist/packages/tabbar/tabbar.scss +0 -46
- package/dist/packages/tabbaritem/tabbaritem.scss +0 -97
- package/dist/packages/table/table.scss +0 -152
- package/dist/packages/tabpane/tabpane.scss +0 -23
- package/dist/packages/tabs/tabs.scss +0 -284
- package/dist/packages/tag/tag.scss +0 -67
- package/dist/packages/textarea/textarea.scss +0 -60
- package/dist/packages/timedetail/timedetail.scss +0 -45
- package/dist/packages/timepannel/timepannel.scss +0 -17
- package/dist/packages/timeselect/timeselect.scss +0 -73
- package/dist/packages/toast/toast.scss +0 -98
- package/dist/packages/trendarrow/trendarrow.scss +0 -17
- package/dist/packages/uploader/uploader.scss +0 -237
- package/dist/packages/video/video.scss +0 -18
- package/dist/packages/virtuallist/virtuallist.scss +0 -87
- package/dist/packages/watermark/watermark.scss +0 -13
- package/dist/style.css +0 -1
- package/dist/style.mjs +0 -9
- package/dist/styles/animation/drop.scss +0 -24
- package/dist/styles/animation/ease.scss +0 -23
- package/dist/styles/animation/fade.scss +0 -20
- package/dist/styles/animation/icon.scss +0 -245
- package/dist/styles/animation/index.scss +0 -7
- package/dist/styles/animation/rotate.scss +0 -10
- package/dist/styles/animation/zoom.scss +0 -26
- package/dist/styles/font/config.json +0 -175
- package/dist/styles/font/demo.css +0 -539
- package/dist/styles/font/demo_index.html +0 -3063
- package/dist/styles/font/iconfont.css +0 -515
- package/dist/styles/font/iconfont.eot +0 -0
- package/dist/styles/font/iconfont.js +0 -68
- package/dist/styles/font/iconfont.json +0 -884
- package/dist/styles/font/iconfont.svg +0 -356
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/mixins/index.scss +0 -2
- package/dist/styles/mixins/make-animation.scss +0 -24
- package/dist/styles/mixins/text-ellipsis.scss +0 -20
- package/dist/styles/theme-dark.scss +0 -26
- package/dist/styles/theme-default.scss +0 -40
- package/dist/styles/themes/default.scss +0 -97
- package/dist/styles/variables.scss +0 -2610
- package/dist/types/index.d.ts +0 -2198
package/dist/esm/Notify.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
10
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import * as ReactDOM from 'react-dom';
|
|
14
|
-
import classNames from 'classnames';
|
|
15
|
-
import { CSSTransition } from 'react-transition-group';
|
|
16
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
17
|
-
import { r as render } from './render-bbebb760.js';
|
|
18
|
-
import '@bem-react/classname';
|
|
19
|
-
var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
20
|
-
_inherits(Notification, _React$PureComponent);
|
|
21
|
-
var _super = _createSuper(Notification);
|
|
22
|
-
function Notification(props) {
|
|
23
|
-
var _this;
|
|
24
|
-
_classCallCheck(this, Notification);
|
|
25
|
-
_this = _super.call(this, props);
|
|
26
|
-
_defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
|
|
27
|
-
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
28
|
-
_this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
|
|
29
|
-
_this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
|
|
30
|
-
_this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
|
|
31
|
-
_this.state = {
|
|
32
|
-
show: true
|
|
33
|
-
};
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
_createClass(Notification, [{
|
|
37
|
-
key: "close",
|
|
38
|
-
value: function close() {
|
|
39
|
-
this.setState({
|
|
40
|
-
show: false
|
|
41
|
-
});
|
|
42
|
-
this.clearCloseTimer();
|
|
43
|
-
if (this.props.id) {
|
|
44
|
-
var element = document.getElementById(this.props.id);
|
|
45
|
-
element && element.parentNode && element.parentNode.removeChild(element);
|
|
46
|
-
}
|
|
47
|
-
this.props.onClosed();
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "startCloseTimer",
|
|
51
|
-
value: function startCloseTimer() {
|
|
52
|
-
var _this2 = this;
|
|
53
|
-
var duration = this.props.duration;
|
|
54
|
-
if (duration) {
|
|
55
|
-
this.closeTimer = window.setTimeout(function () {
|
|
56
|
-
_this2.close();
|
|
57
|
-
}, duration);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
key: "clearCloseTimer",
|
|
62
|
-
value: function clearCloseTimer() {
|
|
63
|
-
if (this.closeTimer) {
|
|
64
|
-
clearTimeout(this.closeTimer);
|
|
65
|
-
this.closeTimer = -1;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "clickCover",
|
|
70
|
-
value: function clickCover() {
|
|
71
|
-
this.props.onClick();
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "componentDidMount",
|
|
75
|
-
value: function componentDidMount() {
|
|
76
|
-
this.startCloseTimer();
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "componentWillUnmount",
|
|
80
|
-
value: function componentWillUnmount() {
|
|
81
|
-
this.clearCloseTimer();
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "render",
|
|
85
|
-
value: function render() {
|
|
86
|
-
var _this$props = this.props,
|
|
87
|
-
children = _this$props.children,
|
|
88
|
-
style = _this$props.style,
|
|
89
|
-
msg = _this$props.msg,
|
|
90
|
-
color = _this$props.color,
|
|
91
|
-
background = _this$props.background,
|
|
92
|
-
type = _this$props.type,
|
|
93
|
-
className = _this$props.className,
|
|
94
|
-
position = _this$props.position,
|
|
95
|
-
isWrapTeleport = _this$props.isWrapTeleport;
|
|
96
|
-
this.state;
|
|
97
|
-
cn('notify');
|
|
98
|
-
var classes = classNames(_defineProperty({
|
|
99
|
-
'nut-notify--popup-top': position === 'top',
|
|
100
|
-
'nut-notify--popup-bottom': position === 'bottom',
|
|
101
|
-
'nut-notify': true
|
|
102
|
-
}, "nut-notify--".concat(type), true));
|
|
103
|
-
return React.createElement(React.Fragment, null, React.createElement(CSSTransition, {
|
|
104
|
-
"in": this.state.show,
|
|
105
|
-
timeout: 300,
|
|
106
|
-
classNames: "fade",
|
|
107
|
-
unmountOnExit: true,
|
|
108
|
-
appear: true,
|
|
109
|
-
position: position,
|
|
110
|
-
isWrapTeleport: isWrapTeleport
|
|
111
|
-
}, React.createElement("div", {
|
|
112
|
-
className: "".concat(classes, " ").concat(className),
|
|
113
|
-
style: {
|
|
114
|
-
color: "".concat(color || ''),
|
|
115
|
-
background: "".concat(background || '')
|
|
116
|
-
},
|
|
117
|
-
onClick: this.clickCover
|
|
118
|
-
}, children || msg)));
|
|
119
|
-
}
|
|
120
|
-
}]);
|
|
121
|
-
return Notification;
|
|
122
|
-
}(React.PureComponent);
|
|
123
|
-
_defineProperty(Notification, "newInstance", void 0);
|
|
124
|
-
Notification.newInstance = function (properties, callback) {
|
|
125
|
-
var element = document.createElement('div');
|
|
126
|
-
var id = properties.id ? properties.id : "".concat(new Date().getTime());
|
|
127
|
-
element.id = id;
|
|
128
|
-
properties.id = id;
|
|
129
|
-
document.body.appendChild(element);
|
|
130
|
-
var called = false;
|
|
131
|
-
function ref(instance) {
|
|
132
|
-
if (called) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
called = true;
|
|
136
|
-
callback({
|
|
137
|
-
component: instance,
|
|
138
|
-
destroy: function destroy() {
|
|
139
|
-
setTimeout(function () {
|
|
140
|
-
ReactDOM.unmountComponentAtNode(element);
|
|
141
|
-
element && element.parentNode && element.parentNode.removeChild(element);
|
|
142
|
-
}, 300);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
|
|
147
|
-
ref: ref
|
|
148
|
-
})), element);
|
|
149
|
-
};
|
|
150
|
-
var messageInstance = null;
|
|
151
|
-
var options = {
|
|
152
|
-
msg: '',
|
|
153
|
-
id: '',
|
|
154
|
-
duration: 3000,
|
|
155
|
-
color: '',
|
|
156
|
-
type: 'danger',
|
|
157
|
-
className: '',
|
|
158
|
-
position: 'top',
|
|
159
|
-
onClosed: function onClosed() {},
|
|
160
|
-
onClick: function onClick() {}
|
|
161
|
-
};
|
|
162
|
-
function getInstance(props, callback) {
|
|
163
|
-
if (messageInstance) {
|
|
164
|
-
messageInstance.destroy();
|
|
165
|
-
messageInstance = null;
|
|
166
|
-
}
|
|
167
|
-
Notification.newInstance(props, function (notification) {
|
|
168
|
-
return callback && callback(notification);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
function notice(opts) {
|
|
172
|
-
// function close() {
|
|
173
|
-
// if (messageInstance) {
|
|
174
|
-
// messageInstance.destroy()
|
|
175
|
-
// messageInstance = null
|
|
176
|
-
// }
|
|
177
|
-
// }
|
|
178
|
-
opts = _objectSpread(_objectSpread({}, options), opts);
|
|
179
|
-
getInstance(opts, function (notification) {
|
|
180
|
-
messageInstance = notification;
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
var errorMsg = function errorMsg(msg) {
|
|
184
|
-
if (!msg) {
|
|
185
|
-
console.warn('[NutUI Notify]: msg不能为空');
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
var Notify = {
|
|
189
|
-
text: function text(msg) {
|
|
190
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
191
|
-
errorMsg(msg);
|
|
192
|
-
return notice(_objectSpread({
|
|
193
|
-
msg: msg,
|
|
194
|
-
type: 'base'
|
|
195
|
-
}, option));
|
|
196
|
-
},
|
|
197
|
-
success: function success(msg) {
|
|
198
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
199
|
-
errorMsg(msg);
|
|
200
|
-
return notice(_objectSpread({
|
|
201
|
-
msg: msg,
|
|
202
|
-
type: 'success'
|
|
203
|
-
}, option));
|
|
204
|
-
},
|
|
205
|
-
primary: function primary(msg) {
|
|
206
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
207
|
-
errorMsg(msg);
|
|
208
|
-
return notice(_objectSpread({
|
|
209
|
-
msg: msg,
|
|
210
|
-
type: 'primary'
|
|
211
|
-
}, option));
|
|
212
|
-
},
|
|
213
|
-
danger: function danger(msg) {
|
|
214
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
215
|
-
errorMsg(msg);
|
|
216
|
-
return notice(_objectSpread({
|
|
217
|
-
msg: msg,
|
|
218
|
-
type: 'danger'
|
|
219
|
-
}, option));
|
|
220
|
-
},
|
|
221
|
-
warn: function warn(msg) {
|
|
222
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
223
|
-
errorMsg(msg);
|
|
224
|
-
return notice(_objectSpread({
|
|
225
|
-
msg: msg,
|
|
226
|
-
type: 'warning'
|
|
227
|
-
}, option));
|
|
228
|
-
},
|
|
229
|
-
hide: function hide() {
|
|
230
|
-
if (messageInstance) {
|
|
231
|
-
messageInstance.destroy();
|
|
232
|
-
messageInstance = null;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
export { Notify as default };
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
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; }
|
|
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
|
-
import React__default, { useState, useEffect } from 'react';
|
|
7
|
-
import classNames from 'classnames';
|
|
8
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
9
|
-
import Popup from './Popup.js';
|
|
10
|
-
import { useConfig } from './ConfigProvider.js';
|
|
11
|
-
import '@bem-react/classname';
|
|
12
|
-
var defaultProps = {
|
|
13
|
-
confirmText: '',
|
|
14
|
-
title: '',
|
|
15
|
-
visible: false,
|
|
16
|
-
overlay: true,
|
|
17
|
-
type: 'default',
|
|
18
|
-
customKey: [],
|
|
19
|
-
className: '',
|
|
20
|
-
randomKeys: false,
|
|
21
|
-
popClass: '',
|
|
22
|
-
onClose: function onClose() {}
|
|
23
|
-
};
|
|
24
|
-
var NumberKeyboard = function NumberKeyboard(props) {
|
|
25
|
-
var _useConfig = useConfig(),
|
|
26
|
-
locale = _useConfig.locale;
|
|
27
|
-
var title = props.title,
|
|
28
|
-
confirmText = props.confirmText,
|
|
29
|
-
visible = props.visible,
|
|
30
|
-
overlay = props.overlay,
|
|
31
|
-
type = props.type,
|
|
32
|
-
customKey = props.customKey,
|
|
33
|
-
randomKeys = props.randomKeys,
|
|
34
|
-
popClass = props.popClass,
|
|
35
|
-
style = props.style,
|
|
36
|
-
className = props.className,
|
|
37
|
-
onChange = props.onChange,
|
|
38
|
-
onDelete = props.onDelete,
|
|
39
|
-
onClose = props.onClose;
|
|
40
|
-
var b = cn('numberkeyboard');
|
|
41
|
-
var _useState = useState(visible),
|
|
42
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
-
show = _useState2[0],
|
|
44
|
-
setShow = _useState2[1];
|
|
45
|
-
var _useState3 = useState(undefined),
|
|
46
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
-
clickKeyIndex = _useState4[0],
|
|
48
|
-
setClickKeyIndex = _useState4[1];
|
|
49
|
-
var _useState5 = useState([]),
|
|
50
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
|
-
keysList = _useState6[0],
|
|
52
|
-
setKeysList = _useState6[1];
|
|
53
|
-
useEffect(function () {
|
|
54
|
-
setShow(visible);
|
|
55
|
-
}, [visible]);
|
|
56
|
-
var defaultKey = function defaultKey() {
|
|
57
|
-
var leftBottomKey = {
|
|
58
|
-
id: 'lock',
|
|
59
|
-
type: 'lock'
|
|
60
|
-
};
|
|
61
|
-
if (customKey) {
|
|
62
|
-
var customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
63
|
-
if (customKeys.length > 0) {
|
|
64
|
-
var newCustomKey = customKeys[0];
|
|
65
|
-
leftBottomKey = {
|
|
66
|
-
id: newCustomKey,
|
|
67
|
-
type: 'custom'
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return [].concat(_toConsumableArray(getBasicKeys()), [leftBottomKey, {
|
|
72
|
-
id: 0,
|
|
73
|
-
type: 'number'
|
|
74
|
-
}, {
|
|
75
|
-
id: 'delete',
|
|
76
|
-
type: 'delete'
|
|
77
|
-
}]);
|
|
78
|
-
};
|
|
79
|
-
var getBasicKeys = function getBasicKeys() {
|
|
80
|
-
var keys = [];
|
|
81
|
-
for (var i = 1; i <= 9; i++) {
|
|
82
|
-
keys.push({
|
|
83
|
-
id: i,
|
|
84
|
-
type: 'number'
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
if (randomKeys) {
|
|
88
|
-
return keys.sort(function () {
|
|
89
|
-
return Math.random() > 0.5 ? 1 : -1;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return keys;
|
|
93
|
-
};
|
|
94
|
-
var genCustomKeys = function genCustomKeys() {
|
|
95
|
-
var keys = getBasicKeys();
|
|
96
|
-
if (!customKey) return [];
|
|
97
|
-
var customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
98
|
-
if (customKeys.length > 2) {
|
|
99
|
-
customKeys = [customKeys[0], customKeys[1]];
|
|
100
|
-
}
|
|
101
|
-
if (customKeys.length === 2 && props.title && props.type !== 'rightColumn') {
|
|
102
|
-
customKeys = [customKeys[0]];
|
|
103
|
-
}
|
|
104
|
-
if (customKeys.length === 1) {
|
|
105
|
-
if (props.title && props.type !== 'rightColumn') {
|
|
106
|
-
keys.push({
|
|
107
|
-
id: customKeys[0],
|
|
108
|
-
type: 'custom'
|
|
109
|
-
}, {
|
|
110
|
-
id: 0,
|
|
111
|
-
type: 'number'
|
|
112
|
-
}, {
|
|
113
|
-
id: 'delete',
|
|
114
|
-
type: 'delete'
|
|
115
|
-
});
|
|
116
|
-
} else {
|
|
117
|
-
keys.push({
|
|
118
|
-
id: 0,
|
|
119
|
-
type: 'number'
|
|
120
|
-
}, {
|
|
121
|
-
id: customKeys[0],
|
|
122
|
-
type: 'custom'
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
} else if (customKeys.length === 2) {
|
|
126
|
-
keys.push({
|
|
127
|
-
id: customKeys[0],
|
|
128
|
-
type: 'custom'
|
|
129
|
-
}, {
|
|
130
|
-
id: 0,
|
|
131
|
-
type: 'number'
|
|
132
|
-
}, {
|
|
133
|
-
id: customKeys[1],
|
|
134
|
-
type: 'custom'
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return keys;
|
|
138
|
-
};
|
|
139
|
-
useEffect(function () {
|
|
140
|
-
if (props.type === 'rightColumn' || props.title !== '') {
|
|
141
|
-
setKeysList(genCustomKeys());
|
|
142
|
-
} else {
|
|
143
|
-
setKeysList(defaultKey());
|
|
144
|
-
}
|
|
145
|
-
}, []);
|
|
146
|
-
var onTouchstart = function onTouchstart(item, event) {
|
|
147
|
-
event.stopPropagation();
|
|
148
|
-
setClickKeyIndex(item.id);
|
|
149
|
-
if (item.type === 'number' || item.type === 'custom') {
|
|
150
|
-
onChange && onChange(item.id);
|
|
151
|
-
}
|
|
152
|
-
if (item.type === 'lock') {
|
|
153
|
-
onClose && onClose();
|
|
154
|
-
}
|
|
155
|
-
if (item.type === 'delete') {
|
|
156
|
-
onDelete && onDelete();
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
var onTouchMove = function onTouchMove(event) {
|
|
160
|
-
event.stopPropagation();
|
|
161
|
-
};
|
|
162
|
-
var onTouchEnd = function onTouchEnd(event) {
|
|
163
|
-
event.preventDefault();
|
|
164
|
-
setClickKeyIndex(undefined);
|
|
165
|
-
};
|
|
166
|
-
return React__default.createElement("div", null, React__default.createElement(Popup, {
|
|
167
|
-
visible: show,
|
|
168
|
-
position: "bottom",
|
|
169
|
-
popClass: popClass,
|
|
170
|
-
onClickOverlay: onClose,
|
|
171
|
-
overlay: overlay,
|
|
172
|
-
onClickCloseIcon: onClose,
|
|
173
|
-
overlayStyle: {
|
|
174
|
-
backgroundColor: 'rgba(0, 0, 0, 0)'
|
|
175
|
-
}
|
|
176
|
-
}, React__default.createElement("div", {
|
|
177
|
-
className: "".concat(b(), " ").concat(className),
|
|
178
|
-
style: _objectSpread({}, style)
|
|
179
|
-
}, title ? React__default.createElement("div", {
|
|
180
|
-
className: b('header')
|
|
181
|
-
}, React__default.createElement("h3", {
|
|
182
|
-
className: b('header__tit')
|
|
183
|
-
}, title), type === 'default' ? React__default.createElement("span", {
|
|
184
|
-
className: b('header__close'),
|
|
185
|
-
onClick: onClose
|
|
186
|
-
}, locale.done) : null) : null, React__default.createElement("div", {
|
|
187
|
-
className: b('body')
|
|
188
|
-
}, React__default.createElement("div", {
|
|
189
|
-
className: b('body__keys')
|
|
190
|
-
}, keysList === null || keysList === void 0 ? void 0 : keysList.map(function (item, index) {
|
|
191
|
-
return React__default.createElement("div", {
|
|
192
|
-
key: index,
|
|
193
|
-
className: classNames({
|
|
194
|
-
'key-board-wrapper': true,
|
|
195
|
-
'key-board-wrapper-large': item.id === 0 && type === 'rightColumn' && Array.isArray(customKey) && customKey.length === 1
|
|
196
|
-
})
|
|
197
|
-
}, React__default.createElement("div", {
|
|
198
|
-
className: classNames({
|
|
199
|
-
key: true,
|
|
200
|
-
active: item.id === clickKeyIndex,
|
|
201
|
-
lock: item.type === 'lock',
|
|
202
|
-
"delete": item.type === 'delete'
|
|
203
|
-
}),
|
|
204
|
-
onTouchStart: function onTouchStart(event) {
|
|
205
|
-
return onTouchstart(item, event);
|
|
206
|
-
},
|
|
207
|
-
onTouchMove: onTouchMove,
|
|
208
|
-
onTouchEnd: onTouchEnd
|
|
209
|
-
}, item.type === 'number' || item.type === 'custom' ? React__default.createElement("div", null, item.id) : null, item.type === 'lock' ? React__default.createElement("img", {
|
|
210
|
-
src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png",
|
|
211
|
-
alt: ""
|
|
212
|
-
}) : null, item.type === 'delete' ? React__default.createElement("img", {
|
|
213
|
-
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
|
|
214
|
-
alt: ""
|
|
215
|
-
}) : null));
|
|
216
|
-
})), type === 'rightColumn' ? React__default.createElement("div", {
|
|
217
|
-
className: b('sidebar')
|
|
218
|
-
}, React__default.createElement("div", {
|
|
219
|
-
className: "key-board-wrapper"
|
|
220
|
-
}, React__default.createElement("div", {
|
|
221
|
-
className: classNames({
|
|
222
|
-
key: true,
|
|
223
|
-
active: clickKeyIndex === 'delete'
|
|
224
|
-
}),
|
|
225
|
-
onTouchStart: function onTouchStart(event) {
|
|
226
|
-
return onTouchstart({
|
|
227
|
-
id: 'delete',
|
|
228
|
-
type: 'delete'
|
|
229
|
-
}, event);
|
|
230
|
-
},
|
|
231
|
-
onTouchMove: onTouchMove,
|
|
232
|
-
onTouchEnd: onTouchEnd
|
|
233
|
-
}, React__default.createElement("img", {
|
|
234
|
-
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
|
|
235
|
-
alt: ""
|
|
236
|
-
}))), React__default.createElement("div", {
|
|
237
|
-
className: "key-board-wrapper key-board-finish",
|
|
238
|
-
onClick: onClose
|
|
239
|
-
}, React__default.createElement("div", {
|
|
240
|
-
className: classNames({
|
|
241
|
-
key: true,
|
|
242
|
-
finish: true,
|
|
243
|
-
activeFinsh: clickKeyIndex === 'finish'
|
|
244
|
-
})
|
|
245
|
-
}, confirmText || locale.done))) : null))));
|
|
246
|
-
};
|
|
247
|
-
NumberKeyboard.defaultProps = defaultProps;
|
|
248
|
-
NumberKeyboard.displayName = 'NutNumberKeyboard';
|
|
249
|
-
export { NumberKeyboard as default };
|
package/dist/esm/Overlay.js
DELETED
package/dist/esm/Pagination.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["modelValue", "mode", "prevText", "nextText", "pageCount", "totalItems", "itemsPerPage", "showPageSize", "onChange", "updatecurrent", "forceEllipses", "pageNodeRender", "defaultValue", "className"];
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
import React__default, { useState, useEffect } from 'react';
|
|
8
|
-
import { useConfig } from './ConfigProvider.js';
|
|
9
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
10
|
-
import '@bem-react/classname';
|
|
11
|
-
var defaultProps = {
|
|
12
|
-
defaultValue: 1,
|
|
13
|
-
mode: 'multi',
|
|
14
|
-
prevText: '',
|
|
15
|
-
nextText: '',
|
|
16
|
-
pageCount: '',
|
|
17
|
-
totalItems: '0',
|
|
18
|
-
itemsPerPage: '10',
|
|
19
|
-
showPageSize: '5',
|
|
20
|
-
forceEllipses: false,
|
|
21
|
-
className: '',
|
|
22
|
-
pageNodeRender: function pageNodeRender(item) {
|
|
23
|
-
return item.text;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var Pagination = function Pagination(props) {
|
|
27
|
-
var _useConfig = useConfig(),
|
|
28
|
-
locale = _useConfig.locale;
|
|
29
|
-
_objectSpread(_objectSpread({}, defaultProps), props);
|
|
30
|
-
var modelValue = props.modelValue,
|
|
31
|
-
mode = props.mode,
|
|
32
|
-
prevText = props.prevText,
|
|
33
|
-
nextText = props.nextText,
|
|
34
|
-
pageCount = props.pageCount,
|
|
35
|
-
totalItems = props.totalItems,
|
|
36
|
-
itemsPerPage = props.itemsPerPage,
|
|
37
|
-
showPageSize = props.showPageSize,
|
|
38
|
-
onChange = props.onChange,
|
|
39
|
-
updatecurrent = props.updatecurrent,
|
|
40
|
-
forceEllipses = props.forceEllipses,
|
|
41
|
-
pageNodeRender = props.pageNodeRender,
|
|
42
|
-
defaultValue = props.defaultValue,
|
|
43
|
-
className = props.className,
|
|
44
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
45
|
-
var _useState = useState(1),
|
|
46
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
currentPage = _useState2[0],
|
|
48
|
-
setCurrent = _useState2[1];
|
|
49
|
-
var _useState3 = useState([]),
|
|
50
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
-
pages = _useState4[0],
|
|
52
|
-
setPages = _useState4[1];
|
|
53
|
-
var _useState5 = useState(Number(pageCount)),
|
|
54
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
-
countRef = _useState6[0],
|
|
56
|
-
setCountRef = _useState6[1];
|
|
57
|
-
var paginationBem = cn('pagination');
|
|
58
|
-
// 计算页面的数量
|
|
59
|
-
var computedCountRef = function computedCountRef() {
|
|
60
|
-
var num = Number(pageCount) || Math.ceil(Number(totalItems) / Number(itemsPerPage));
|
|
61
|
-
return Number.isNaN(num) ? 1 : Math.max(1, num);
|
|
62
|
-
};
|
|
63
|
-
// 生成pages数组,用来遍历
|
|
64
|
-
var computedPages = function computedPages(_currentPage, _countRef) {
|
|
65
|
-
if (mode === 'simple') return [];
|
|
66
|
-
var items = [];
|
|
67
|
-
var pageCount = _countRef || countRef; // 总的页面数量
|
|
68
|
-
var pageSize = Number(showPageSize); // 展示的页面个数
|
|
69
|
-
var _current = _currentPage || Number(currentPage); // 当前页
|
|
70
|
-
var startPage = 1;
|
|
71
|
-
var endPage = pageCount;
|
|
72
|
-
var partialShow = pageCount > pageSize;
|
|
73
|
-
if (partialShow) {
|
|
74
|
-
// 选中的page在展示的page中间
|
|
75
|
-
startPage = Math.max(_current - Math.floor(pageSize / 2), 1);
|
|
76
|
-
endPage = startPage + pageSize - 1;
|
|
77
|
-
if (endPage > pageCount) {
|
|
78
|
-
endPage = pageCount;
|
|
79
|
-
startPage = endPage - pageSize + 1;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// 遍历生成数组
|
|
83
|
-
for (var i = startPage; i <= endPage; i++) {
|
|
84
|
-
var page = setPage(i, i, _current === i);
|
|
85
|
-
items.push(page);
|
|
86
|
-
}
|
|
87
|
-
// 判断是否有折叠
|
|
88
|
-
if (partialShow && pageSize > 0 && forceEllipses) {
|
|
89
|
-
if (startPage > 1) {
|
|
90
|
-
var prevPage = setPage(startPage - 1, '...');
|
|
91
|
-
items.unshift(prevPage);
|
|
92
|
-
}
|
|
93
|
-
if (endPage < pageCount) {
|
|
94
|
-
var nextPage = setPage(endPage + 1, '...');
|
|
95
|
-
items.push(nextPage);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return items;
|
|
99
|
-
};
|
|
100
|
-
// 点击选择page
|
|
101
|
-
var selectPage = function selectPage(curPage, isSelect) {
|
|
102
|
-
if (curPage > countRef || curPage < 1) return;
|
|
103
|
-
// 是否传入modelValue
|
|
104
|
-
if (!('modelValue' in props)) {
|
|
105
|
-
setCurrent(Number(curPage));
|
|
106
|
-
if (curPage !== currentPage) {
|
|
107
|
-
setPages(computedPages(curPage));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (curPage !== currentPage) {
|
|
111
|
-
updatecurrent && updatecurrent(curPage);
|
|
112
|
-
}
|
|
113
|
-
if (isSelect) onChange && onChange(curPage);
|
|
114
|
-
};
|
|
115
|
-
// set page 对象
|
|
116
|
-
var setPage = function setPage(number, text, active) {
|
|
117
|
-
return {
|
|
118
|
-
number: number,
|
|
119
|
-
text: text,
|
|
120
|
-
active: active
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
useEffect(function () {
|
|
124
|
-
// 初始化 判断是否传入值 计算 当前页,总页数,生成子节点
|
|
125
|
-
var currentValue = props.defaultValue || 1;
|
|
126
|
-
if ('modelValue' in props) {
|
|
127
|
-
currentValue = Number(props.modelValue);
|
|
128
|
-
}
|
|
129
|
-
var pageCount = computedCountRef();
|
|
130
|
-
setCountRef(pageCount);
|
|
131
|
-
setPages(computedPages(currentValue, pageCount));
|
|
132
|
-
}, []);
|
|
133
|
-
if ('modelValue' in props) {
|
|
134
|
-
var current = props.modelValue ? Number(props.modelValue) : 1;
|
|
135
|
-
if (current !== currentPage) {
|
|
136
|
-
setCurrent(current);
|
|
137
|
-
setPages(computedPages(Number(current)));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return React__default.createElement("div", _objectSpread({
|
|
141
|
-
className: "".concat(paginationBem(''), " ").concat(className)
|
|
142
|
-
}, rest), React__default.createElement("div", {
|
|
143
|
-
className: "".concat(paginationBem('prev'), " ").concat(mode === 'multi' ? '' : 'simple-border', " ").concat(currentPage === 1 ? 'disabled' : ''),
|
|
144
|
-
onClick: function onClick(e) {
|
|
145
|
-
return selectPage(Number(currentPage) - 1, true);
|
|
146
|
-
}
|
|
147
|
-
}, prevText || locale.pagination.prev), mode === 'multi' ? React__default.createElement("div", {
|
|
148
|
-
className: "".concat(paginationBem('contain'))
|
|
149
|
-
}, pages.map(function (item, index) {
|
|
150
|
-
return React__default.createElement("div", {
|
|
151
|
-
key: "".concat(index, "pagination"),
|
|
152
|
-
className: "".concat(paginationBem('item'), " ").concat(item.active ? 'active' : ''),
|
|
153
|
-
onClick: function onClick(e) {
|
|
154
|
-
return !item.active ? selectPage(item.number, true) : '';
|
|
155
|
-
}
|
|
156
|
-
}, pageNodeRender ? pageNodeRender(item) : item.text);
|
|
157
|
-
})) : '', mode === 'simple' ? React__default.createElement("div", {
|
|
158
|
-
className: "".concat(paginationBem('contain'))
|
|
159
|
-
}, React__default.createElement("div", {
|
|
160
|
-
className: "".concat(paginationBem('simple'))
|
|
161
|
-
}, currentPage, "/", countRef)) : '', React__default.createElement("div", {
|
|
162
|
-
className: "".concat(paginationBem('next'), " ").concat(Number(currentPage) >= countRef ? 'disabled' : ''),
|
|
163
|
-
onClick: function onClick(e) {
|
|
164
|
-
return selectPage(Number(currentPage) + 1, true);
|
|
165
|
-
}
|
|
166
|
-
}, nextText || locale.pagination.next));
|
|
167
|
-
};
|
|
168
|
-
Pagination.defaultProps = defaultProps;
|
|
169
|
-
Pagination.displayName = 'NutPagination';
|
|
170
|
-
export { Pagination as default };
|