@nutui/nutui-react 1.2.3-beta.4 → 1.3.1-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 +28 -0
- package/dist/esm/Audio/style/index.js +4 -0
- package/dist/esm/Audio.js +293 -0
- package/dist/esm/Avatar.js +7 -5
- package/dist/esm/Calendar/style/index.js +1 -2
- package/dist/esm/Calendar.js +80 -33
- package/dist/esm/CalendarItem.js +440 -238
- package/dist/esm/Cascader/style/index.js +2 -0
- package/dist/esm/Cascader.js +788 -0
- package/dist/esm/CheckboxGroup.js +0 -1
- package/dist/esm/ConfigProvider.js +16 -0
- package/dist/esm/DatePicker.js +37 -6
- package/dist/esm/Dialog.js +9 -16
- package/dist/esm/Drag.js +1 -1
- package/dist/esm/Elevator.js +16 -5
- package/dist/esm/Grid/style/index.js +2 -0
- package/dist/esm/Grid.js +91 -0
- package/dist/esm/GridItem/style/index.js +2 -0
- package/dist/esm/GridItem.js +99 -0
- package/dist/esm/Icon/style/index.js +1 -0
- package/dist/esm/Icon.js +2 -2
- package/dist/esm/ImagePreview/style/index.js +2 -0
- package/dist/esm/ImagePreview.js +257 -0
- package/dist/esm/Input.js +8 -2
- package/dist/esm/InputNumber.js +11 -11
- package/dist/esm/Menu/style/index.js +3 -0
- package/dist/esm/Menu.js +153 -0
- package/dist/esm/MenuItem/style/index.js +3 -0
- package/dist/esm/MenuItem.js +197 -0
- package/dist/esm/NoticeBar.js +70 -30
- package/dist/esm/Notify.js +19 -4
- package/dist/esm/Picker.js +9 -4
- package/dist/esm/Popover.js +57 -80
- package/dist/esm/Price.js +14 -3
- package/dist/esm/Progress.js +1 -1
- package/dist/esm/Range.js +11 -48
- package/dist/esm/Swipe/style/index.js +2 -0
- package/dist/esm/Swipe.js +265 -0
- package/dist/esm/Swiper.js +2 -1
- package/dist/esm/TabPane.js +5 -33
- package/dist/esm/TabbarItem.js +1 -1
- package/dist/esm/Tabs.js +6 -196
- package/dist/esm/Tag.js +1 -1
- package/dist/esm/TextArea.js +48 -4
- package/dist/esm/Toast.js +24 -13
- package/dist/esm/Uploader.js +16 -6
- package/dist/esm/{icon-62bd7379.js → icon-8dc4de10.js} +9 -9
- package/dist/esm/nutui-react.es.js +8 -0
- package/dist/esm/render-4a3856cb.js +32 -0
- package/dist/esm/tabpane-c957ab14.js +33 -0
- package/dist/esm/tabs-a48583e9.js +196 -0
- package/dist/esm/useClientRect-839d18c5.js +44 -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 +2639 -768
- package/dist/nutui.react.umd.js +2646 -767
- 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/col/col.scss +2 -2
- package/dist/packages/collapseitem/collapseitem.scss +1 -2
- package/dist/packages/grid/grid.scss +10 -0
- package/dist/packages/griditem/griditem.scss +103 -0
- package/dist/packages/icon/icon.scss +104 -12
- 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/noticebar/noticebar.scss +31 -15
- package/dist/packages/notify/notify.scss +9 -0
- package/dist/packages/popover/popover.scss +205 -83
- package/dist/packages/popup/popup.scss +1 -1
- package/dist/packages/rate/rate.scss +14 -13
- 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/packages/toast/toast.scss +16 -13
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/animation/icon.scss +245 -0
- package/dist/styles/animation/index.scss +1 -0
- package/dist/styles/font/config.json +169 -0
- package/dist/styles/font/demo_index.html +210 -3
- package/dist/styles/font/iconfont.css +39 -3
- package/dist/styles/font/iconfont.js +42 -40
- package/dist/styles/font/iconfont.json +63 -0
- 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/themes/default.scss +8 -0
- package/dist/styles/variables.scss +82 -15
- package/dist/types/actionsheet/actionsheet.taro.d.ts +20 -0
- package/dist/types/actionsheet/index.taro.d.ts +2 -0
- package/dist/types/address/address.taro.d.ts +34 -0
- package/dist/types/address/index.taro.d.ts +2 -0
- package/dist/types/animatingnumbers/animatingnumbers.taro.d.ts +12 -0
- package/dist/types/animatingnumbers/countup.taro.d.ts +11 -0
- package/dist/types/animatingnumbers/index.taro.d.ts +2 -0
- package/dist/types/audio/__test__/audio.spec.d.ts +1 -0
- package/dist/types/audio/audio.d.ts +18 -0
- package/dist/types/audio/audio.taro.d.ts +18 -0
- package/dist/types/audio/demo.d.ts +4 -0
- package/dist/types/audio/index.d.ts +2 -0
- package/dist/types/audio/index.taro.d.ts +2 -0
- package/dist/types/avatar/avatar.taro.d.ts +17 -0
- package/dist/types/avatar/index.taro.d.ts +2 -0
- package/dist/types/avatargroup/index.taro.d.ts +2 -0
- package/dist/types/backtop/__test__/backtop.spec.d.ts +1 -0
- package/dist/types/backtop/backtop.taro.d.ts +15 -0
- package/dist/types/backtop/index.taro.d.ts +2 -0
- package/dist/types/badge/badge.taro.d.ts +14 -0
- package/dist/types/badge/index.taro.d.ts +2 -0
- package/dist/types/barrage/barrage.taro.d.ts +12 -0
- package/dist/types/barrage/index.taro.d.ts +2 -0
- package/dist/types/button/button.taro.d.ts +20 -0
- package/dist/types/button/index.taro.d.ts +2 -0
- package/dist/types/calendar/__tests__/calendar.spec.d.ts +1 -0
- package/dist/types/calendar/calendar.d.ts +22 -2
- package/dist/types/calendar/calendar.taro.d.ts +14 -0
- package/dist/types/calendar/demo.d.ts +1 -0
- package/dist/types/calendar/index.taro.d.ts +2 -0
- package/dist/types/calendaritem/calendaritem.d.ts +21 -3
- package/dist/types/calendaritem/calendaritem.taro.d.ts +17 -0
- package/dist/types/calendaritem/index.taro.d.ts +2 -0
- package/dist/types/card/card.taro.d.ts +17 -0
- package/dist/types/card/index.taro.d.ts +2 -0
- package/dist/types/cascader/__tests__/cascader.spec.d.ts +1 -0
- package/dist/types/cascader/cascader.d.ts +25 -0
- package/dist/types/cascader/cascader.taro.d.ts +25 -0
- package/dist/types/cascader/cascaderItem.d.ts +25 -0
- package/dist/types/cascader/cascaderItem.taro.d.ts +25 -0
- package/dist/types/cascader/demo.d.ts +3 -0
- package/dist/types/cascader/helper.d.ts +4 -0
- package/dist/types/cascader/index.d.ts +2 -0
- package/dist/types/cascader/index.taro.d.ts +2 -0
- package/dist/types/cascader/tree.d.ts +12 -0
- package/dist/types/cascader/types.d.ts +28 -0
- package/dist/types/cell/cell.taro.d.ts +20 -0
- package/dist/types/cell/index.taro.d.ts +2 -0
- package/dist/types/cellgroup/cellgroup.taro.d.ts +10 -0
- package/dist/types/cellgroup/index.taro.d.ts +2 -0
- package/dist/types/checkbox/checkbox.d.ts +2 -2
- package/dist/types/checkbox/checkbox.taro.d.ts +19 -0
- package/dist/types/checkbox/index.taro.d.ts +2 -0
- package/dist/types/checkboxgroup/checkboxgroup.d.ts +2 -2
- package/dist/types/checkboxgroup/checkboxgroup.taro.d.ts +8 -0
- package/dist/types/checkboxgroup/index.taro.d.ts +2 -0
- package/dist/types/circleprogress/circleprogress.taro.d.ts +15 -0
- package/dist/types/circleprogress/index.taro.d.ts +2 -0
- package/dist/types/col/col.taro.d.ts +10 -0
- package/dist/types/col/index.taro.d.ts +2 -0
- package/dist/types/collapse/collapse.taro.d.ts +12 -0
- package/dist/types/collapse/index.taro.d.ts +2 -0
- package/dist/types/collapseitem/index.taro.d.ts +2 -0
- package/dist/types/configprovider/configprovider.taro.d.ts +12 -0
- package/dist/types/configprovider/index.taro.d.ts +2 -0
- package/dist/types/countdown/countdown.taro.d.ts +15 -0
- package/dist/types/countdown/index.taro.d.ts +2 -0
- package/dist/types/datepicker/datepicker.taro.d.ts +27 -0
- package/dist/types/datepicker/index.taro.d.ts +2 -0
- package/dist/types/dialog/__test__/dialog.spec.d.ts +1 -0
- package/dist/types/dialog/config.d.ts +3 -3
- package/dist/types/dialog/dialog.d.ts +2 -1
- package/dist/types/dialog/dialog.taro.d.ts +3 -0
- package/dist/types/dialog/index.taro.d.ts +2 -0
- package/dist/types/divider/divider.taro.d.ts +12 -0
- package/dist/types/divider/index.taro.d.ts +2 -0
- package/dist/types/drag/drag.taro.d.ts +14 -0
- package/dist/types/drag/index.taro.d.ts +2 -0
- package/dist/types/elevator/elevator.taro.d.ts +22 -0
- package/dist/types/elevator/index.taro.d.ts +2 -0
- package/dist/types/empty/empty.taro.d.ts +8 -0
- package/dist/types/empty/index.taro.d.ts +2 -0
- package/dist/types/fixednav/fixednav.d.ts +2 -2
- package/dist/types/fixednav/fixednav.taro.d.ts +22 -0
- package/dist/types/fixednav/index.taro.d.ts +2 -0
- package/dist/types/grid/__test__/grid.spec.d.ts +1 -0
- package/dist/types/grid/demo.d.ts +3 -0
- package/dist/types/grid/grid.d.ts +16 -0
- package/dist/types/grid/grid.taro.d.ts +16 -0
- package/dist/types/grid/index.d.ts +2 -0
- package/dist/types/grid/index.taro.d.ts +2 -0
- package/dist/types/griditem/griditem.d.ts +20 -0
- package/dist/types/griditem/griditem.taro.d.ts +20 -0
- package/dist/types/griditem/index.d.ts +2 -0
- package/dist/types/griditem/index.taro.d.ts +2 -0
- package/dist/types/icon/icon.d.ts +10 -5
- package/dist/types/icon/icon.taro.d.ts +18 -0
- package/dist/types/icon/index.taro.d.ts +2 -0
- package/dist/types/imagepreview/__test__/imagepreview.spec.d.ts +1 -0
- package/dist/types/imagepreview/demo.d.ts +3 -0
- package/dist/types/imagepreview/imagepreview.d.ts +26 -0
- package/dist/types/imagepreview/imagepreview.taro.d.ts +26 -0
- package/dist/types/imagepreview/index.d.ts +2 -0
- package/dist/types/imagepreview/index.taro.d.ts +2 -0
- package/dist/types/indicator/index.taro.d.ts +2 -0
- package/dist/types/indicator/indicator.taro.d.ts +10 -0
- package/dist/types/infiniteloading/index.taro.d.ts +2 -0
- package/dist/types/infiniteloading/infiniteloading.taro.d.ts +20 -0
- package/dist/types/input/__test__/input.spec.d.ts +1 -0
- package/dist/types/input/index.taro.d.ts +2 -0
- package/dist/types/input/input.taro.d.ts +57 -0
- package/dist/types/inputnumber/index.taro.d.ts +2 -0
- package/dist/types/inputnumber/inputnumber.taro.d.ts +22 -0
- package/dist/types/layout/index.taro.d.ts +2 -0
- package/dist/types/layout/layout.taro.d.ts +4 -0
- package/dist/types/menu/__test__/menu.spec.d.ts +1 -0
- package/dist/types/menu/demo.d.ts +4 -0
- package/dist/types/menu/index.d.ts +2 -0
- package/dist/types/menu/index.taro.d.ts +2 -0
- package/dist/types/menu/menu.d.ts +12 -0
- package/dist/types/menu/menu.taro.d.ts +12 -0
- package/dist/types/menuitem/index.d.ts +2 -0
- package/dist/types/menuitem/index.taro.d.ts +2 -0
- package/dist/types/menuitem/menuitem.d.ts +23 -0
- package/dist/types/menuitem/menuitem.taro.d.ts +23 -0
- package/dist/types/navbar/index.taro.d.ts +2 -0
- package/dist/types/navbar/navbar.taro.d.ts +21 -0
- package/dist/types/noticebar/demo.d.ts +1 -0
- package/dist/types/noticebar/index.taro.d.ts +2 -0
- package/dist/types/noticebar/noticebar.d.ts +1 -1
- package/dist/types/noticebar/noticebar.taro.d.ts +23 -0
- package/dist/types/notify/Notification.d.ts +8 -7
- package/dist/types/notify/__test__/notify.spec.d.ts +1 -0
- package/dist/types/notify/index.taro.d.ts +2 -0
- package/dist/types/notify/notify.d.ts +13 -0
- package/dist/types/notify/notify.taro.d.ts +23 -0
- package/dist/types/numberkeyboard/index.taro.d.ts +2 -0
- package/dist/types/numberkeyboard/numberkeyboard.taro.d.ts +20 -0
- package/dist/types/nutui.react.d.ts +95 -1
- package/dist/types/overlay/index.taro.d.ts +2 -0
- package/dist/types/overlay/overlay.taro.d.ts +12 -0
- package/dist/types/pagination/index.taro.d.ts +2 -0
- package/dist/types/pagination/pagination.taro.d.ts +19 -0
- package/dist/types/picker/doc.en.d.ts +142 -0
- package/dist/types/picker/index.taro.d.ts +2 -0
- package/dist/types/picker/picker.d.ts +3 -2
- package/dist/types/picker/picker.taro.d.ts +24 -0
- package/dist/types/picker/pickerSlot.d.ts +1 -0
- package/dist/types/popover/__tests__/popover.spec.d.ts +1 -0
- package/dist/types/popover/index.taro.d.ts +2 -0
- package/dist/types/popover/popover.d.ts +14 -7
- package/dist/types/popover/popover.taro.d.ts +21 -0
- package/dist/types/popup/index.taro.d.ts +2 -0
- package/dist/types/popup/popup.d.ts +1 -1
- package/dist/types/popup/popup.taro.d.ts +25 -0
- package/dist/types/price/index.taro.d.ts +2 -0
- package/dist/types/price/price.taro.d.ts +11 -0
- package/dist/types/progress/index.taro.d.ts +2 -0
- package/dist/types/progress/progress.taro.d.ts +26 -0
- package/dist/types/radio/index.taro.d.ts +2 -0
- package/dist/types/radio/radio.taro.d.ts +21 -0
- package/dist/types/radiogroup/index.taro.d.ts +2 -0
- package/dist/types/range/index.taro.d.ts +2 -0
- package/dist/types/range/range.taro.d.ts +25 -0
- package/dist/types/rate/index.taro.d.ts +2 -0
- package/dist/types/rate/rate.taro.d.ts +17 -0
- package/dist/types/row/index.taro.d.ts +2 -0
- package/dist/types/row/row.taro.d.ts +12 -0
- package/dist/types/searchbar/index.taro.d.ts +2 -0
- package/dist/types/searchbar/searchbar.taro.d.ts +60 -0
- package/dist/types/shortpassword/index.taro.d.ts +2 -0
- package/dist/types/shortpassword/shortpassword.taro.d.ts +21 -0
- package/dist/types/sidenavbar/index.taro.d.ts +2 -0
- package/dist/types/sidenavbar/sidenavbar.d.ts +14 -2
- package/dist/types/sidenavbar/sidenavbar.taro.d.ts +15 -0
- package/dist/types/sidenavbaritem/index.taro.d.ts +2 -0
- package/dist/types/sidenavbaritem/sidenavbaritem.d.ts +10 -2
- package/dist/types/sidenavbaritem/sidenavbaritem.taro.d.ts +11 -0
- package/dist/types/signature/index.taro.d.ts +2 -0
- package/dist/types/signature/signature.taro.d.ts +11 -0
- package/dist/types/skeleton/index.taro.d.ts +2 -0
- package/dist/types/skeleton/skeleton.taro.d.ts +19 -0
- package/dist/types/step/index.taro.d.ts +2 -0
- package/dist/types/steps/index.taro.d.ts +2 -0
- package/dist/types/steps/steps.taro.d.ts +10 -0
- package/dist/types/subsidenavbar/index.taro.d.ts +2 -0
- package/dist/types/subsidenavbar/subsidenavbar.d.ts +13 -3
- package/dist/types/subsidenavbar/subsidenavbar.taro.d.ts +13 -0
- package/dist/types/swipe/__tests__/swipe.spec.d.ts +1 -0
- package/dist/types/swipe/demo.d.ts +3 -0
- package/dist/types/swipe/index.d.ts +2 -0
- package/dist/types/swipe/index.taro.d.ts +2 -0
- package/dist/types/swipe/swipe.d.ts +41 -0
- package/dist/types/swipe/swipe.taro.d.ts +41 -0
- package/dist/types/swiper/index.taro.d.ts +2 -0
- package/dist/types/swiper/swiper.d.ts +1 -2
- package/dist/types/swiper/swiper.taro.d.ts +27 -0
- package/dist/types/swiperitem/index.taro.d.ts +2 -0
- package/dist/types/swiperitem/swiperitem.d.ts +1 -2
- package/dist/types/switch/index.taro.d.ts +2 -0
- package/dist/types/switch/switch.taro.d.ts +14 -0
- package/dist/types/tabbar/index.taro.d.ts +2 -0
- package/dist/types/tabbar/tabbar.taro.d.ts +14 -0
- package/dist/types/tabbaritem/index.taro.d.ts +2 -0
- package/dist/types/tabbaritem/tabbaritem.taro.d.ts +17 -0
- package/dist/types/table/index.taro.d.ts +2 -0
- package/dist/types/table/table.d.ts +2 -1
- package/dist/types/table/table.taro.d.ts +4 -0
- package/dist/types/table/types.d.ts +1 -1
- package/dist/types/tabpane/index.taro.d.ts +2 -0
- package/dist/types/tabpane/tabpane.taro.d.ts +10 -0
- package/dist/types/tabs/index.taro.d.ts +2 -0
- package/dist/types/tabs/tabs.taro.d.ts +30 -0
- package/dist/types/tag/index.taro.d.ts +2 -0
- package/dist/types/tag/tag.taro.d.ts +16 -0
- package/dist/types/textarea/__test__/textarea.spec.d.ts +1 -0
- package/dist/types/textarea/index.taro.d.ts +2 -0
- package/dist/types/textarea/textarea.taro.d.ts +18 -0
- package/dist/types/timedetail/index.taro.d.ts +2 -0
- package/dist/types/timedetail/timedetail.taro.d.ts +13 -0
- package/dist/types/timepannel/index.taro.d.ts +2 -0
- package/dist/types/timepannel/timepannel.taro.d.ts +8 -0
- package/dist/types/timeselect/index.taro.d.ts +2 -0
- package/dist/types/timeselect/timeselect.taro.d.ts +21 -0
- package/dist/types/toast/Notification.d.ts +6 -4
- package/dist/types/toast/__test__/toast.spec.d.ts +1 -0
- package/dist/types/toast/index.taro.d.ts +2 -0
- package/dist/types/toast/toast.d.ts +21 -0
- package/dist/types/toast/toast.taro.d.ts +29 -0
- package/dist/types/uploader/index.taro.d.ts +2 -0
- package/dist/types/uploader/uploader.d.ts +2 -2
- package/dist/types/uploader/uploader.taro.d.ts +68 -0
- package/dist/types/video/index.taro.d.ts +2 -0
- package/dist/types/virtuallist/index.taro.d.ts +2 -0
- package/dist/types/virtuallist/type.d.ts +1 -1
- package/dist/types/virtuallist/virtuallist.d.ts +2 -1
- package/dist/types/virtuallist/virtuallist.taro.d.ts +4 -0
- package/package.json +18 -7
package/dist/esm/Popover.js
CHANGED
|
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
10
|
-
var _excluded = ["children", "list", "theme", "location", "visible", "className", "style", "onClick"];
|
|
10
|
+
var _excluded = ["children", "list", "theme", "location", "visible", "offset", "className", "style", "onClick", "onChoose"];
|
|
11
11
|
|
|
12
12
|
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; }
|
|
13
13
|
|
|
@@ -18,8 +18,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
18
18
|
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; } }
|
|
19
19
|
|
|
20
20
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
21
|
-
import ReactDOM__default from 'react-dom';
|
|
22
21
|
import Icon from './Icon.js';
|
|
22
|
+
import Overlay from './Overlay.js';
|
|
23
|
+
import { g as getRect } from './useClientRect-839d18c5.js';
|
|
23
24
|
/**
|
|
24
25
|
* 过滤ref
|
|
25
26
|
*/
|
|
@@ -101,30 +102,15 @@ var Trigger = /*#__PURE__*/function (_React__default$Compo) {
|
|
|
101
102
|
return Trigger;
|
|
102
103
|
}(React__default.Component);
|
|
103
104
|
|
|
104
|
-
function findDOMNode(node) {
|
|
105
|
-
if (node instanceof HTMLElement) {
|
|
106
|
-
return node;
|
|
107
|
-
} // eslint-disable-next-line react/no-find-dom-node
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return ReactDOM__default.findDOMNode(node);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
var getEleAttr = function getEleAttr(ele) {
|
|
114
|
-
if (ele && ele.getBoundingClientRect) {
|
|
115
|
-
return ele.getBoundingClientRect();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return null;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
105
|
var defaultProps = {
|
|
122
106
|
list: [],
|
|
123
107
|
theme: 'light',
|
|
124
108
|
location: 'bottom',
|
|
125
109
|
visible: false,
|
|
110
|
+
offset: 20,
|
|
126
111
|
className: '',
|
|
127
|
-
onClick: function onClick(e) {}
|
|
112
|
+
onClick: function onClick(e) {},
|
|
113
|
+
onChoose: function onChoose(item, index) {}
|
|
128
114
|
};
|
|
129
115
|
|
|
130
116
|
var Popover = function Popover(props) {
|
|
@@ -134,18 +120,18 @@ var Popover = function Popover(props) {
|
|
|
134
120
|
theme = _defaultProps$props.theme,
|
|
135
121
|
location = _defaultProps$props.location,
|
|
136
122
|
visible = _defaultProps$props.visible,
|
|
123
|
+
offset = _defaultProps$props.offset,
|
|
137
124
|
className = _defaultProps$props.className,
|
|
138
125
|
style = _defaultProps$props.style,
|
|
139
126
|
onClick = _defaultProps$props.onClick,
|
|
127
|
+
onChoose = _defaultProps$props.onChoose,
|
|
140
128
|
reset = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
141
129
|
|
|
142
|
-
var goodItem = useRef(null);
|
|
143
|
-
|
|
144
|
-
var aa = goodItem.current && findDOMNode(goodItem.current);
|
|
130
|
+
var goodItem = useRef(null);
|
|
145
131
|
setTimeout(function () {
|
|
146
|
-
if (
|
|
147
|
-
setElWidth(
|
|
148
|
-
setElHeight(
|
|
132
|
+
if (goodItem.current && getRect(goodItem.current)) {
|
|
133
|
+
setElWidth(getRect(goodItem.current).width);
|
|
134
|
+
setElHeight(getRect(goodItem.current).height);
|
|
149
135
|
}
|
|
150
136
|
});
|
|
151
137
|
|
|
@@ -181,68 +167,43 @@ var Popover = function Popover(props) {
|
|
|
181
167
|
}, [list, theme]);
|
|
182
168
|
|
|
183
169
|
var getStyle = function getStyle() {
|
|
170
|
+
var offNumer = Number(offset) ? Number(offset) : 0;
|
|
184
171
|
var style = {};
|
|
185
172
|
|
|
186
|
-
if (location
|
|
187
|
-
style.bottom = elHeight +
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
style.right =
|
|
192
|
-
} else if (location === 'left') {
|
|
193
|
-
style.top = 0;
|
|
194
|
-
style.left = -elWidth - 20;
|
|
195
|
-
} else {
|
|
196
|
-
style.top = elHeight + 20;
|
|
197
|
-
style.left = 0;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
style.top += 'px';
|
|
201
|
-
style.left += 'px';
|
|
202
|
-
style.bottom += 'px';
|
|
203
|
-
style.right += 'px';
|
|
204
|
-
return style;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
var getArrowStyle = function getArrowStyle() {
|
|
208
|
-
var style = {};
|
|
209
|
-
|
|
210
|
-
if (location === 'top') {
|
|
211
|
-
style.bottom = -20;
|
|
212
|
-
style.left = elWidth / 2;
|
|
213
|
-
} else if (location === 'right') {
|
|
214
|
-
style.top = 20;
|
|
215
|
-
style.left = -20;
|
|
216
|
-
} else if (location === 'left') {
|
|
217
|
-
style.top = 20;
|
|
218
|
-
style.right = -20;
|
|
173
|
+
if (location.includes('top')) {
|
|
174
|
+
style.bottom = "".concat(elHeight + offNumer, "px");
|
|
175
|
+
} else if (location.includes('right')) {
|
|
176
|
+
style.left = "".concat(elWidth + offNumer, "px");
|
|
177
|
+
} else if (location.includes('left')) {
|
|
178
|
+
style.right = "".concat(elWidth + offNumer, "px");
|
|
219
179
|
} else {
|
|
220
|
-
style.
|
|
221
|
-
style.top = -20;
|
|
180
|
+
style.top = "".concat(elHeight + offNumer, "px");
|
|
222
181
|
}
|
|
223
182
|
|
|
224
|
-
style.top += 'px';
|
|
225
|
-
style.left += 'px';
|
|
226
|
-
style.bottom += 'px';
|
|
227
|
-
style.right += 'px';
|
|
228
183
|
return style;
|
|
229
184
|
};
|
|
230
185
|
|
|
231
186
|
var classesSelf = function classesSelf() {
|
|
232
187
|
var prefixCls = 'nut-popover';
|
|
233
|
-
return "".concat(prefixCls, "
|
|
188
|
+
return "".concat(prefixCls, " ").concat(theme ? "".concat(prefixCls, "--").concat(theme) : '');
|
|
234
189
|
};
|
|
235
190
|
|
|
236
191
|
var popoverContentSelf = function popoverContentSelf() {
|
|
237
|
-
var prefixCls = '
|
|
238
|
-
return "".concat(prefixCls, "
|
|
192
|
+
var prefixCls = 'popover-content';
|
|
193
|
+
return "".concat(prefixCls, "-show ").concat(prefixCls, " ").concat(location ? "".concat(prefixCls, "--").concat(location) : '');
|
|
239
194
|
};
|
|
240
195
|
|
|
241
|
-
var
|
|
242
|
-
var
|
|
243
|
-
return
|
|
244
|
-
|
|
196
|
+
var filter = function filter() {
|
|
197
|
+
var ms = ['top', 'bottom', 'left', 'right'];
|
|
198
|
+
return ms.filter(function (m) {
|
|
199
|
+
return location.includes(m);
|
|
200
|
+
})[0];
|
|
201
|
+
};
|
|
245
202
|
|
|
203
|
+
var popoverArrowSelf = function popoverArrowSelf() {
|
|
204
|
+
var prefixCls = 'popover-arrow';
|
|
205
|
+
return "".concat(prefixCls, " ").concat(prefixCls, "-").concat(filter(), " ").concat(location ? "".concat(prefixCls, "--").concat(location) : '');
|
|
206
|
+
};
|
|
246
207
|
|
|
247
208
|
var handleClick = function handleClick(e) {
|
|
248
209
|
if (props.onClick) {
|
|
@@ -250,7 +211,13 @@ var Popover = function Popover(props) {
|
|
|
250
211
|
}
|
|
251
212
|
};
|
|
252
213
|
|
|
253
|
-
|
|
214
|
+
var handleChoose = function handleChoose(item, index) {
|
|
215
|
+
if (!item.disabled) {
|
|
216
|
+
onChoose(item, index);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", _objectSpread({
|
|
254
221
|
className: "".concat(classes, " ").concat(className),
|
|
255
222
|
style: _objectSpread({}, style)
|
|
256
223
|
}, reset), React__default.createElement(Trigger, {
|
|
@@ -263,19 +230,29 @@ var Popover = function Popover(props) {
|
|
|
263
230
|
className: "".concat(popoverContent),
|
|
264
231
|
style: getStyle()
|
|
265
232
|
}, React__default.createElement("div", {
|
|
266
|
-
className: "".concat(popoverArrow)
|
|
267
|
-
|
|
268
|
-
}, ' '), Array.isArray(children) ? children[1] : '', list.map(function (item) {
|
|
233
|
+
className: "".concat(popoverArrow)
|
|
234
|
+
}), Array.isArray(children) ? children[1] : '', list.map(function (item, i) {
|
|
269
235
|
return React__default.createElement("div", {
|
|
270
236
|
key: item.name,
|
|
271
|
-
className: "
|
|
237
|
+
className: "popover-menu-item ".concat(item.disabled ? 'disabled' : ''),
|
|
238
|
+
onClick: function onClick() {
|
|
239
|
+
handleChoose(item, i);
|
|
240
|
+
}
|
|
272
241
|
}, item.icon ? React__default.createElement(Icon, {
|
|
273
|
-
className: "item-img",
|
|
242
|
+
className: "popover-menu-item-img",
|
|
274
243
|
name: item.icon
|
|
275
244
|
}) : '', React__default.createElement("div", {
|
|
276
|
-
className: "
|
|
245
|
+
className: "popover-menu-item-name"
|
|
277
246
|
}, item.name));
|
|
278
|
-
})) : null)))
|
|
247
|
+
})) : null))), visible ? React__default.createElement(Overlay, {
|
|
248
|
+
visible: visible,
|
|
249
|
+
onClick: function onClick(e) {
|
|
250
|
+
return handleClick(e);
|
|
251
|
+
},
|
|
252
|
+
style: {
|
|
253
|
+
background: 'transparent'
|
|
254
|
+
}
|
|
255
|
+
}) : '');
|
|
279
256
|
};
|
|
280
257
|
|
|
281
258
|
Popover.defaultProps = defaultProps;
|
package/dist/esm/Price.js
CHANGED
|
@@ -30,9 +30,20 @@ var Price = function Price(props) {
|
|
|
30
30
|
|
|
31
31
|
var b = cn('price');
|
|
32
32
|
|
|
33
|
+
var replaceSpecialChar = function replaceSpecialChar(symbol) {
|
|
34
|
+
var desSymbol = symbol;
|
|
35
|
+
desSymbol = symbol.replace(/"/g, '"');
|
|
36
|
+
desSymbol = symbol.replace(/&/g, '&');
|
|
37
|
+
desSymbol = symbol.replace(/</g, '<');
|
|
38
|
+
desSymbol = symbol.replace(/>/g, '>');
|
|
39
|
+
desSymbol = symbol.replace(/ /g, ' ');
|
|
40
|
+
desSymbol = symbol.replace(/¥/g, '¥');
|
|
41
|
+
return desSymbol;
|
|
42
|
+
};
|
|
43
|
+
|
|
33
44
|
var showSymbol = function showSymbol() {
|
|
34
45
|
return {
|
|
35
|
-
__html: (needSymbol ? symbol : '') || ''
|
|
46
|
+
__html: (needSymbol ? replaceSpecialChar(symbol) : '') || ''
|
|
36
47
|
};
|
|
37
48
|
};
|
|
38
49
|
|
|
@@ -41,7 +52,7 @@ var Price = function Price(props) {
|
|
|
41
52
|
};
|
|
42
53
|
|
|
43
54
|
var formatThousands = function formatThousands(num) {
|
|
44
|
-
if (Number(num)
|
|
55
|
+
if (Number(num) === 0) {
|
|
45
56
|
num = 0;
|
|
46
57
|
}
|
|
47
58
|
|
|
@@ -60,7 +71,7 @@ var Price = function Price(props) {
|
|
|
60
71
|
};
|
|
61
72
|
|
|
62
73
|
var formatDecimal = function formatDecimal(decimalNum) {
|
|
63
|
-
if (Number(decimalNum)
|
|
74
|
+
if (Number(decimalNum) === 0) {
|
|
64
75
|
decimalNum = 0;
|
|
65
76
|
}
|
|
66
77
|
|
package/dist/esm/Progress.js
CHANGED
|
@@ -8,7 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
|
|
9
9
|
import React__default from 'react';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
|
-
import { I as Icon } from './icon-
|
|
11
|
+
import { I as Icon } from './icon-8dc4de10.js';
|
|
12
12
|
import { c as cn } from './bem-893ad28d.js';
|
|
13
13
|
import '@bem-react/classname';
|
|
14
14
|
var defaultProps = {
|
package/dist/esm/Range.js
CHANGED
|
@@ -7,52 +7,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
|
|
8
8
|
import React__default, { useState, useRef, useEffect, useCallback } from 'react';
|
|
9
9
|
import { u as useTouch } from './useTouch-a2ea68c6.js';
|
|
10
|
+
import { g as getRect } from './useClientRect-839d18c5.js';
|
|
10
11
|
import Toast from './Toast.js';
|
|
11
12
|
import { useConfig } from './ConfigProvider.js';
|
|
12
|
-
/**
|
|
13
|
-
获取元素的大小及其相对于视口的位置,等价于 Element.getBoundingClientRect。
|
|
14
|
-
width 宽度 number
|
|
15
|
-
height 高度 number
|
|
16
|
-
top 顶部与视图窗口左上角的距离 number
|
|
17
|
-
left 左侧与视图窗口左上角的距离 number
|
|
18
|
-
right 右侧与视图窗口左上角的距离 number
|
|
19
|
-
bottom 底部与视图窗口左上角的距离 number
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
function isWindow(val) {
|
|
23
|
-
return val === window;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var getRect = function getRect(elementRef) {
|
|
27
|
-
var element = elementRef;
|
|
28
|
-
|
|
29
|
-
if (isWindow(element)) {
|
|
30
|
-
var width = element.innerWidth;
|
|
31
|
-
var height = element.innerHeight;
|
|
32
|
-
return {
|
|
33
|
-
top: 0,
|
|
34
|
-
left: 0,
|
|
35
|
-
right: width,
|
|
36
|
-
bottom: height,
|
|
37
|
-
width: width,
|
|
38
|
-
height: height
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (element && element.getBoundingClientRect) {
|
|
43
|
-
return element.getBoundingClientRect();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
top: 0,
|
|
48
|
-
left: 0,
|
|
49
|
-
right: 0,
|
|
50
|
-
bottom: 0,
|
|
51
|
-
width: 0,
|
|
52
|
-
height: 0
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
|
|
56
13
|
var defaultProps = {
|
|
57
14
|
range: false,
|
|
58
15
|
hiddenRange: false,
|
|
@@ -80,9 +37,6 @@ var Range = function Range(props) {
|
|
|
80
37
|
buttonColor = _defaultProps$props.buttonColor,
|
|
81
38
|
hiddenRange = _defaultProps$props.hiddenRange,
|
|
82
39
|
hiddenTag = _defaultProps$props.hiddenTag,
|
|
83
|
-
min = _defaultProps$props.min,
|
|
84
|
-
max = _defaultProps$props.max,
|
|
85
|
-
step = _defaultProps$props.step,
|
|
86
40
|
modelValue = _defaultProps$props.modelValue,
|
|
87
41
|
button = _defaultProps$props.button,
|
|
88
42
|
vertical = _defaultProps$props.vertical,
|
|
@@ -91,6 +45,15 @@ var Range = function Range(props) {
|
|
|
91
45
|
dragStart = _defaultProps$props.dragStart,
|
|
92
46
|
dragEnd = _defaultProps$props.dragEnd;
|
|
93
47
|
|
|
48
|
+
var _defaultProps$props2 = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
49
|
+
min = _defaultProps$props2.min,
|
|
50
|
+
max = _defaultProps$props2.max,
|
|
51
|
+
step = _defaultProps$props2.step;
|
|
52
|
+
|
|
53
|
+
min = Number(min);
|
|
54
|
+
max = Number(max);
|
|
55
|
+
step = Number(step);
|
|
56
|
+
|
|
94
57
|
var _useState = useState(0),
|
|
95
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
96
59
|
buttonIndex = _useState2[0],
|
|
@@ -439,7 +402,7 @@ var Range = function Range(props) {
|
|
|
439
402
|
return React__default.createElement("div", {
|
|
440
403
|
role: "slider",
|
|
441
404
|
key: index,
|
|
442
|
-
className: "".concat(index === 0 ? 'nut-range-button-wrapper-left' : '', "\n
|
|
405
|
+
className: "".concat(index === 0 ? 'nut-range-button-wrapper-left' : '', "\n ").concat(index === 1 ? 'nut-range-button-wrapper-right' : ''),
|
|
443
406
|
tabIndex: disabled ? -1 : 0,
|
|
444
407
|
"aria-valuemin": +min,
|
|
445
408
|
"aria-valuenow": curValue(index),
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
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
|
+
|
|
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
|
+
|
|
8
|
+
import React__default, { forwardRef, useRef, useState, useMemo, useCallback, useImperativeHandle, useEffect } from 'react';
|
|
9
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
10
|
+
import { u as useTouch } from './useTouch-a2ea68c6.js';
|
|
11
|
+
import { g as getRect } from './useClientRect-839d18c5.js';
|
|
12
|
+
import '@bem-react/classname';
|
|
13
|
+
|
|
14
|
+
function preventDefault(event, isStopPropagation) {
|
|
15
|
+
if (typeof event.cancelable !== 'boolean' || event.cancelable) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (isStopPropagation) {
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var defaultProps = {
|
|
25
|
+
name: '',
|
|
26
|
+
leftWidth: 0,
|
|
27
|
+
rightWidth: 0
|
|
28
|
+
};
|
|
29
|
+
var Swipe = forwardRef(function (props, instanceRef) {
|
|
30
|
+
var swipeBem = cn('swipe');
|
|
31
|
+
var touch = useTouch();
|
|
32
|
+
|
|
33
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
34
|
+
children = _defaultProps$props.children,
|
|
35
|
+
className = _defaultProps$props.className,
|
|
36
|
+
style = _defaultProps$props.style;
|
|
37
|
+
|
|
38
|
+
var root = useRef();
|
|
39
|
+
var opened = useRef(false);
|
|
40
|
+
var lockClick = useRef(false);
|
|
41
|
+
var startOffset = useRef(0);
|
|
42
|
+
|
|
43
|
+
var _useState = useState({
|
|
44
|
+
offset: 0,
|
|
45
|
+
dragging: false
|
|
46
|
+
}),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
state = _useState2[0],
|
|
49
|
+
setState = _useState2[1];
|
|
50
|
+
|
|
51
|
+
var _useState3 = useState({
|
|
52
|
+
left: 0,
|
|
53
|
+
right: 0
|
|
54
|
+
}),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
actionWidth = _useState4[0],
|
|
57
|
+
setActionWidth = _useState4[1];
|
|
58
|
+
|
|
59
|
+
var wrapperStyle = {
|
|
60
|
+
transform: "translate3d(".concat(state.offset, "px, 0, 0)"),
|
|
61
|
+
transitionDuration: state.dragging ? '0s' : '.6s'
|
|
62
|
+
};
|
|
63
|
+
var leftWidth = useMemo(function () {
|
|
64
|
+
return props.leftWidth ? props.leftWidth : actionWidth.left;
|
|
65
|
+
}, [props.leftWidth, actionWidth.left]);
|
|
66
|
+
var rightWidth = useMemo(function () {
|
|
67
|
+
return props.rightWidth ? props.rightWidth : actionWidth.right;
|
|
68
|
+
}, [props.rightWidth, actionWidth.right]);
|
|
69
|
+
|
|
70
|
+
var _onTouchStart = function onTouchStart(event) {
|
|
71
|
+
if (!props.disabled) {
|
|
72
|
+
startOffset.current = state.offset;
|
|
73
|
+
touch.start(event);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var _onTouchMove = function onTouchMove(event) {
|
|
78
|
+
if (props.disabled) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
touch.move(event);
|
|
83
|
+
|
|
84
|
+
if (touch.isHorizontal()) {
|
|
85
|
+
lockClick.current = true;
|
|
86
|
+
|
|
87
|
+
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
88
|
+
dragging: true
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
var isEdge = !opened || touch.deltaX * startOffset.current < 0;
|
|
92
|
+
|
|
93
|
+
if (isEdge) {
|
|
94
|
+
preventDefault(event, true);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
newState.offset = rangeCalculation(touch.deltaX + startOffset.current, -rightWidth, leftWidth);
|
|
98
|
+
setState(newState);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
var onTouchEnd = function onTouchEnd() {
|
|
103
|
+
if (state.dragging) {
|
|
104
|
+
setState(function (v) {
|
|
105
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
106
|
+
dragging: false
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
toggle(state.offset > 0 ? 'left' : 'right');
|
|
110
|
+
setTimeout(function () {
|
|
111
|
+
lockClick.current = false;
|
|
112
|
+
}, 0);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var toggle = function toggle(side) {
|
|
117
|
+
var offset = Math.abs(state.offset);
|
|
118
|
+
var base = 0.3;
|
|
119
|
+
var baseNum = opened ? 1 - base : base;
|
|
120
|
+
var width = side === 'left' ? leftWidth : rightWidth;
|
|
121
|
+
|
|
122
|
+
if (width && offset > Number(width) * baseNum) {
|
|
123
|
+
open(side);
|
|
124
|
+
} else {
|
|
125
|
+
_close(side);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
var open = function open(side) {
|
|
130
|
+
var _props$onOpen;
|
|
131
|
+
|
|
132
|
+
opened.current = true;
|
|
133
|
+
var offset = side === 'left' ? leftWidth : -rightWidth;
|
|
134
|
+
var name = props.name;
|
|
135
|
+
(_props$onOpen = props.onOpen) === null || _props$onOpen === void 0 ? void 0 : _props$onOpen.call(props, {
|
|
136
|
+
name: name,
|
|
137
|
+
position: side
|
|
138
|
+
});
|
|
139
|
+
setState(function (v) {
|
|
140
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
141
|
+
offset: Number(offset) || 0
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
var _close = function close(position) {
|
|
147
|
+
if (opened.current) {
|
|
148
|
+
var _props$onClose;
|
|
149
|
+
|
|
150
|
+
opened.current = false;
|
|
151
|
+
(_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props, {
|
|
152
|
+
name: props.name,
|
|
153
|
+
position: position || 'left'
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
setState(function (v) {
|
|
158
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
159
|
+
offset: 0
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var rangeCalculation = function rangeCalculation(num, min, max) {
|
|
165
|
+
return Math.min(Math.max(Number(num), Number(min)), Number(max));
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
var getNodeWidth = function getNodeWidth(node) {
|
|
169
|
+
if (node) {
|
|
170
|
+
var ele = getRect(node);
|
|
171
|
+
return ele.width;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return 0;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
var leftRef = useCallback(function (node) {
|
|
178
|
+
if (node !== null) {
|
|
179
|
+
setActionWidth(function (v) {
|
|
180
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
181
|
+
left: getNodeWidth(node)
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}, [props.leftAction]);
|
|
186
|
+
var rightRef = useCallback(function (node) {
|
|
187
|
+
if (node !== null) {
|
|
188
|
+
setActionWidth(function (v) {
|
|
189
|
+
return _objectSpread(_objectSpread({}, v), {}, {
|
|
190
|
+
right: getNodeWidth(node)
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}, [props.rightAction]);
|
|
195
|
+
|
|
196
|
+
var renderActionContent = function renderActionContent(side, measuredRef) {
|
|
197
|
+
if (props["".concat(side, "Action")]) {
|
|
198
|
+
return React__default.createElement("div", {
|
|
199
|
+
ref: measuredRef,
|
|
200
|
+
className: "".concat(swipeBem(side)),
|
|
201
|
+
onClick: function onClick(e) {
|
|
202
|
+
return handleOperate(e, side);
|
|
203
|
+
}
|
|
204
|
+
}, props["".concat(side, "Action")]);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return null;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
var handleOperate = function handleOperate(event, position) {
|
|
211
|
+
event.stopPropagation();
|
|
212
|
+
|
|
213
|
+
if (props.beforeClose) {
|
|
214
|
+
props.beforeClose(position);
|
|
215
|
+
} else {
|
|
216
|
+
props.onActionClick && props.onActionClick(event, position);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
useImperativeHandle(instanceRef, function () {
|
|
221
|
+
return {
|
|
222
|
+
open: open,
|
|
223
|
+
close: function close() {
|
|
224
|
+
return _close();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
useEffect(function () {
|
|
229
|
+
var handler = function handler(event) {
|
|
230
|
+
var targets = [root];
|
|
231
|
+
|
|
232
|
+
if (targets.some(function (targetItem) {
|
|
233
|
+
var targetElement = targetItem.current || targetItem;
|
|
234
|
+
return !targetElement || (targetElement === null || targetElement === void 0 ? void 0 : targetElement.contains(event.target));
|
|
235
|
+
})) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
_close();
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
document.addEventListener('touchstart', handler);
|
|
243
|
+
return function () {
|
|
244
|
+
document.removeEventListener('touchstart', handler);
|
|
245
|
+
};
|
|
246
|
+
}, []);
|
|
247
|
+
return React__default.createElement("div", {
|
|
248
|
+
ref: root,
|
|
249
|
+
className: "".concat(swipeBem(), " ").concat(className),
|
|
250
|
+
onTouchStart: function onTouchStart(e) {
|
|
251
|
+
return _onTouchStart(e);
|
|
252
|
+
},
|
|
253
|
+
onTouchMove: function onTouchMove(e) {
|
|
254
|
+
return _onTouchMove(e);
|
|
255
|
+
},
|
|
256
|
+
onTouchEnd: onTouchEnd,
|
|
257
|
+
style: style
|
|
258
|
+
}, React__default.createElement("div", {
|
|
259
|
+
className: "".concat(swipeBem('wrapper')),
|
|
260
|
+
style: wrapperStyle
|
|
261
|
+
}, renderActionContent('left', leftRef), children, renderActionContent('right', rightRef)));
|
|
262
|
+
});
|
|
263
|
+
Swipe.defaultProps = defaultProps;
|
|
264
|
+
Swipe.displayName = 'NutSwipe';
|
|
265
|
+
export { Swipe as default };
|
package/dist/esm/Swiper.js
CHANGED
|
@@ -12,6 +12,7 @@ import React__default, { useRef, useState, useMemo, useEffect } from 'react';
|
|
|
12
12
|
import classNames from 'classnames';
|
|
13
13
|
import { D as DataContext } from './UserContext-b4181162.js';
|
|
14
14
|
import { c as cn } from './bem-893ad28d.js';
|
|
15
|
+
import { g as getRect } from './useClientRect-839d18c5.js';
|
|
15
16
|
import '@bem-react/classname';
|
|
16
17
|
var defaultProps = {
|
|
17
18
|
width: (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' ? window.innerWidth : 375,
|
|
@@ -442,7 +443,7 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
442
443
|
|
|
443
444
|
var init = function init() {
|
|
444
445
|
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : +propSwiper.initPage;
|
|
445
|
-
var rect = container.current
|
|
446
|
+
var rect = getRect(container === null || container === void 0 ? void 0 : container.current);
|
|
446
447
|
|
|
447
448
|
var _active = Math.max(Math.min(childCount - 1, active), 0);
|
|
448
449
|
|
package/dist/esm/TabPane.js
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React__default from 'react';
|
|
8
|
-
import classNames from 'classnames';
|
|
9
|
-
import { c as cn } from './bem-893ad28d.js';
|
|
1
|
+
import { T as TabPane } from './tabpane-c957ab14.js';
|
|
2
|
+
export { T as default } from './tabpane-c957ab14.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import './bem-893ad28d.js';
|
|
10
6
|
import '@bem-react/classname';
|
|
11
|
-
var defaultProps = {
|
|
12
|
-
title: '',
|
|
13
|
-
paneKey: '',
|
|
14
|
-
activeKey: '',
|
|
15
|
-
disabled: false
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
var TabPane = function TabPane(props) {
|
|
19
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
20
|
-
children = _defaultProps$props.children,
|
|
21
|
-
paneKey = _defaultProps$props.paneKey,
|
|
22
|
-
activeKey = _defaultProps$props.activeKey,
|
|
23
|
-
autoHeightClassName = _defaultProps$props.autoHeightClassName;
|
|
24
|
-
|
|
25
|
-
var b = cn('tabpane');
|
|
26
|
-
var classes = classNames({
|
|
27
|
-
active: paneKey === activeKey
|
|
28
|
-
}, b(''), autoHeightClassName);
|
|
29
|
-
return React__default.createElement("div", {
|
|
30
|
-
className: classes
|
|
31
|
-
}, children);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { TabPane as default };
|