@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/FixedNav.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
var _excluded = ["fixednavClass", "overlay", "visible", "navList", "activeText", "unActiveText", "position", "onChange", "onSelected", "type", "slotList", "slotBtn", "iconClassPrefix", "iconFontClassName"];
|
|
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 from 'react';
|
|
7
|
-
import classNames from 'classnames';
|
|
8
|
-
import Icon from './Icon.js';
|
|
9
|
-
import Overlay from './Overlay.js';
|
|
10
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
11
|
-
import { useConfig } from './ConfigProvider.js';
|
|
12
|
-
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
13
|
-
import '@bem-react/classname';
|
|
14
|
-
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
15
|
-
fixednavClass: 'nut-fixednav',
|
|
16
|
-
activeText: '',
|
|
17
|
-
unActiveText: '',
|
|
18
|
-
type: 'right',
|
|
19
|
-
position: {
|
|
20
|
-
top: 'auto',
|
|
21
|
-
bottom: 'auto'
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var FixedNav = function FixedNav(props) {
|
|
25
|
-
var _useConfig = useConfig(),
|
|
26
|
-
locale = _useConfig.locale;
|
|
27
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
28
|
-
fixednavClass = _defaultProps$props.fixednavClass,
|
|
29
|
-
overlay = _defaultProps$props.overlay,
|
|
30
|
-
visible = _defaultProps$props.visible,
|
|
31
|
-
navList = _defaultProps$props.navList,
|
|
32
|
-
activeText = _defaultProps$props.activeText,
|
|
33
|
-
unActiveText = _defaultProps$props.unActiveText,
|
|
34
|
-
position = _defaultProps$props.position,
|
|
35
|
-
onChange = _defaultProps$props.onChange,
|
|
36
|
-
onSelected = _defaultProps$props.onSelected,
|
|
37
|
-
type = _defaultProps$props.type,
|
|
38
|
-
slotList = _defaultProps$props.slotList,
|
|
39
|
-
slotBtn = _defaultProps$props.slotBtn,
|
|
40
|
-
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
41
|
-
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
42
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
43
|
-
var b = cn('fixednav');
|
|
44
|
-
var classes = classNames({
|
|
45
|
-
active: visible
|
|
46
|
-
}, type, fixednavClass, b(''));
|
|
47
|
-
var onSelectCb = function onSelectCb(event, item) {
|
|
48
|
-
onSelected(item, event);
|
|
49
|
-
};
|
|
50
|
-
var onUpdateValue = function onUpdateValue() {
|
|
51
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !visible;
|
|
52
|
-
onChange(value);
|
|
53
|
-
};
|
|
54
|
-
// const [classNames, setClassNames] = useState('')
|
|
55
|
-
// const classes = () => {
|
|
56
|
-
// return `${fixednavClass} ${type} ${visible ? 'active' : ''}`
|
|
57
|
-
// }
|
|
58
|
-
// useEffect(() => {
|
|
59
|
-
// setClassNames(classes())
|
|
60
|
-
// }, [visible])
|
|
61
|
-
return React__default.createElement("div", _objectSpread({
|
|
62
|
-
className: classes,
|
|
63
|
-
style: position
|
|
64
|
-
}, rest), overlay && React__default.createElement(Overlay, {
|
|
65
|
-
visible: visible,
|
|
66
|
-
zIndex: 200,
|
|
67
|
-
onClick: function onClick() {
|
|
68
|
-
return onUpdateValue(false);
|
|
69
|
-
}
|
|
70
|
-
}), React__default.createElement("div", {
|
|
71
|
-
className: "list"
|
|
72
|
-
}, slotList || React__default.createElement("div", {
|
|
73
|
-
className: "nut-fixednav__list"
|
|
74
|
-
}, navList.map(function (item, index) {
|
|
75
|
-
return React__default.createElement("div", {
|
|
76
|
-
className: "nut-fixednav__list-item",
|
|
77
|
-
onClick: function onClick(event) {
|
|
78
|
-
return onSelectCb(event, item);
|
|
79
|
-
},
|
|
80
|
-
key: item.id || index
|
|
81
|
-
}, React__default.createElement("img", {
|
|
82
|
-
src: item.icon,
|
|
83
|
-
alt: ""
|
|
84
|
-
}), React__default.createElement("div", {
|
|
85
|
-
className: "nut-fixednav__list-text"
|
|
86
|
-
}, item.text), item.num && React__default.createElement("div", {
|
|
87
|
-
className: "b"
|
|
88
|
-
}, item.num));
|
|
89
|
-
}))), React__default.createElement("div", {
|
|
90
|
-
className: "nut-fixednav__btn",
|
|
91
|
-
onClick: function onClick() {
|
|
92
|
-
return onUpdateValue();
|
|
93
|
-
}
|
|
94
|
-
}, slotBtn || React__default.createElement(React__default.Fragment, null, React__default.createElement(Icon, {
|
|
95
|
-
classPrefix: iconClassPrefix,
|
|
96
|
-
fontClassName: iconFontClassName,
|
|
97
|
-
name: "left",
|
|
98
|
-
color: "#fff"
|
|
99
|
-
}), React__default.createElement("div", {
|
|
100
|
-
className: "text"
|
|
101
|
-
}, visible ? activeText || locale.fixednav.activeText : unActiveText || locale.fixednav.unActiveText))));
|
|
102
|
-
};
|
|
103
|
-
FixedNav.defaultProps = defaultProps;
|
|
104
|
-
FixedNav.displayName = 'NutFixedNav';
|
|
105
|
-
export { FixedNav as default };
|
package/dist/esm/Form.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
var _excluded = ["children", "onFinish", "onFinishFailed", "labelPosition", "starPositon", "form"];
|
|
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
|
-
import React__default, { useRef } from 'react';
|
|
11
|
-
import { C as CellGroup } from './cellgroup-fcc72767.js';
|
|
12
|
-
import { F as FormItemContext, a as FormItem } from './formitem-8a73a5fb.js';
|
|
13
|
-
import Schema from 'async-validator';
|
|
14
|
-
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
15
|
-
import './bem-3b438e61.js';
|
|
16
|
-
import '@bem-react/classname';
|
|
17
|
-
import './Cell.js';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 用于存储表单的数据
|
|
21
|
-
*/
|
|
22
|
-
var FormStore = /*#__PURE__*/_createClass(
|
|
23
|
-
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
24
|
-
// 所有的组件实例
|
|
25
|
-
// 成功和失败的回调
|
|
26
|
-
|
|
27
|
-
function FormStore() {
|
|
28
|
-
var _this = this;
|
|
29
|
-
_classCallCheck(this, FormStore);
|
|
30
|
-
_defineProperty(this, "store", {});
|
|
31
|
-
_defineProperty(this, "fieldEntities", []);
|
|
32
|
-
_defineProperty(this, "callbacks", {});
|
|
33
|
-
_defineProperty(this, "errList", []);
|
|
34
|
-
/**
|
|
35
|
-
* 注册组件实例
|
|
36
|
-
* @param field
|
|
37
|
-
*/
|
|
38
|
-
_defineProperty(this, "registerField", function (field) {
|
|
39
|
-
_this.fieldEntities.push(field);
|
|
40
|
-
return function () {
|
|
41
|
-
_this.fieldEntities = _this.fieldEntities.filter(function (item) {
|
|
42
|
-
return item != field;
|
|
43
|
-
});
|
|
44
|
-
delete _this.store[field.props.name];
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
_defineProperty(this, "getFieldValue", function (name) {
|
|
48
|
-
return _this.store[name];
|
|
49
|
-
});
|
|
50
|
-
/**
|
|
51
|
-
* 存储组件数据
|
|
52
|
-
* @param newStore { [name]: newValue }
|
|
53
|
-
*/
|
|
54
|
-
_defineProperty(this, "setFieldsValue", function (newStore) {
|
|
55
|
-
_this.store = _objectSpread(_objectSpread({}, _this.store), newStore);
|
|
56
|
-
_this.fieldEntities.forEach(function (enetity) {
|
|
57
|
-
var name = enetity.props.name;
|
|
58
|
-
Object.keys(newStore).forEach(function (key) {
|
|
59
|
-
if (key === name) {
|
|
60
|
-
enetity.onStoreChange();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* 表单校验
|
|
67
|
-
* rules: { required: true, message: '' }
|
|
68
|
-
* descriptor: {
|
|
69
|
-
* username: {
|
|
70
|
-
* type: 'string',
|
|
71
|
-
* required: true,
|
|
72
|
-
* validator: (rule, value) => {
|
|
73
|
-
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
74
|
-
* },
|
|
75
|
-
* },
|
|
76
|
-
* }
|
|
77
|
-
*/
|
|
78
|
-
_defineProperty(this, "validate", function () {
|
|
79
|
-
var err = [];
|
|
80
|
-
_this.errList.length = 0;
|
|
81
|
-
_this.fieldEntities.forEach(function (entity) {
|
|
82
|
-
var _entity$props = entity.props,
|
|
83
|
-
name = _entity$props.name,
|
|
84
|
-
_entity$props$rules = _entity$props.rules,
|
|
85
|
-
rules = _entity$props$rules === void 0 ? [] : _entity$props$rules;
|
|
86
|
-
var descriptor = {};
|
|
87
|
-
if (rules.length) {
|
|
88
|
-
// 多条校验规则
|
|
89
|
-
if (rules.length > 1) {
|
|
90
|
-
descriptor[name] = [];
|
|
91
|
-
rules.map(function (v) {
|
|
92
|
-
descriptor[name].push(v);
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
descriptor[name] = rules[0];
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
var validator = new Schema(descriptor);
|
|
99
|
-
validator.validate(_defineProperty({}, name, _this.store[name]), function (errors) {
|
|
100
|
-
if (errors) {
|
|
101
|
-
var _this$errList;
|
|
102
|
-
err.push.apply(err, _toConsumableArray(errors));
|
|
103
|
-
(_this$errList = _this.errList).push.apply(_this$errList, _toConsumableArray(errors));
|
|
104
|
-
// 表单项更新
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
entity.onStoreChange();
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
return err;
|
|
111
|
-
});
|
|
112
|
-
_defineProperty(this, "setCallback", function (callback) {
|
|
113
|
-
_this.callbacks = _objectSpread(_objectSpread({}, _this.callbacks), callback);
|
|
114
|
-
});
|
|
115
|
-
_defineProperty(this, "submit", function () {
|
|
116
|
-
var err = _this.validate();
|
|
117
|
-
if (err.length === 0) {
|
|
118
|
-
var _this$callbacks$onFin, _this$callbacks;
|
|
119
|
-
(_this$callbacks$onFin = (_this$callbacks = _this.callbacks).onFinish) === null || _this$callbacks$onFin === void 0 ? void 0 : _this$callbacks$onFin.call(_this$callbacks, _this.store);
|
|
120
|
-
} else if (err.length > 0) {
|
|
121
|
-
var _this$callbacks$onFin2, _this$callbacks2;
|
|
122
|
-
(_this$callbacks$onFin2 = (_this$callbacks2 = _this.callbacks).onFinishFailed) === null || _this$callbacks$onFin2 === void 0 ? void 0 : _this$callbacks$onFin2.call(_this$callbacks2, err);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
_defineProperty(this, "resetFields", function () {
|
|
126
|
-
_this.errList.length = 0;
|
|
127
|
-
_this.fieldEntities.forEach(function (enetity) {
|
|
128
|
-
enetity.onStoreChange();
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
_defineProperty(this, "getForm", function () {
|
|
132
|
-
return {
|
|
133
|
-
setCallback: _this.setCallback,
|
|
134
|
-
registerField: _this.registerField,
|
|
135
|
-
getFieldValue: _this.getFieldValue,
|
|
136
|
-
setFieldsValue: _this.setFieldsValue,
|
|
137
|
-
resetFields: _this.resetFields,
|
|
138
|
-
submit: _this.submit,
|
|
139
|
-
store: _this.store,
|
|
140
|
-
errList: _this.errList,
|
|
141
|
-
fieldEntities: _this.fieldEntities
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
this.callbacks = {
|
|
145
|
-
onFinish: function onFinish(value) {},
|
|
146
|
-
onFinishFailed: function onFinishFailed() {}
|
|
147
|
-
};
|
|
148
|
-
});
|
|
149
|
-
var useForm = function useForm(form) {
|
|
150
|
-
var formRef = useRef();
|
|
151
|
-
if (!formRef.current) {
|
|
152
|
-
if (form) {
|
|
153
|
-
formRef.current = form;
|
|
154
|
-
} else {
|
|
155
|
-
var formStore = new FormStore();
|
|
156
|
-
formRef.current = formStore.getForm();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return [formRef.current];
|
|
160
|
-
};
|
|
161
|
-
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
162
|
-
className: '',
|
|
163
|
-
style: undefined,
|
|
164
|
-
form: {},
|
|
165
|
-
labelPosition: 'Right',
|
|
166
|
-
formGroupTitle: '',
|
|
167
|
-
onFinish: function onFinish(obj) {},
|
|
168
|
-
onFinishFailed: function onFinishFailed(value) {},
|
|
169
|
-
starPositon: 'Left'
|
|
170
|
-
});
|
|
171
|
-
var PositionInfo = {
|
|
172
|
-
Top: 'form-layout-top',
|
|
173
|
-
Left: 'form-layout-left',
|
|
174
|
-
Right: 'form-layout-right'
|
|
175
|
-
};
|
|
176
|
-
var Form = function Form(props) {
|
|
177
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
178
|
-
children = _defaultProps$props.children,
|
|
179
|
-
onFinish = _defaultProps$props.onFinish,
|
|
180
|
-
onFinishFailed = _defaultProps$props.onFinishFailed,
|
|
181
|
-
labelPosition = _defaultProps$props.labelPosition,
|
|
182
|
-
starPositon = _defaultProps$props.starPositon,
|
|
183
|
-
form = _defaultProps$props.form,
|
|
184
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
185
|
-
var formInstance = {};
|
|
186
|
-
if (Object.keys(form).length !== 0) {
|
|
187
|
-
formInstance = form;
|
|
188
|
-
} else {
|
|
189
|
-
var _useForm = useForm();
|
|
190
|
-
var _useForm2 = _slicedToArray(_useForm, 1);
|
|
191
|
-
formInstance = _useForm2[0];
|
|
192
|
-
}
|
|
193
|
-
formInstance.starPositon = starPositon;
|
|
194
|
-
var _formInstance = formInstance,
|
|
195
|
-
setCallback = _formInstance.setCallback,
|
|
196
|
-
submit = _formInstance.submit,
|
|
197
|
-
resetFields = _formInstance.resetFields;
|
|
198
|
-
setCallback({
|
|
199
|
-
onFinish: onFinish,
|
|
200
|
-
onFinishFailed: onFinishFailed
|
|
201
|
-
});
|
|
202
|
-
return React__default.createElement("form", {
|
|
203
|
-
className: "nut-form ".concat(PositionInfo[labelPosition], " ").concat(props.className),
|
|
204
|
-
style: props.style,
|
|
205
|
-
onSubmit: function onSubmit(e) {
|
|
206
|
-
e.preventDefault();
|
|
207
|
-
submit();
|
|
208
|
-
},
|
|
209
|
-
onReset: function onReset(e) {
|
|
210
|
-
e.preventDefault();
|
|
211
|
-
resetFields();
|
|
212
|
-
}
|
|
213
|
-
}, React__default.createElement(CellGroup, null, React__default.createElement(FormItemContext.Provider, {
|
|
214
|
-
value: formInstance
|
|
215
|
-
}, children)));
|
|
216
|
-
};
|
|
217
|
-
Form.defaultProps = defaultProps;
|
|
218
|
-
Form.displayName = 'NutForm';
|
|
219
|
-
Form.Item = FormItem;
|
|
220
|
-
Form.useForm = useForm;
|
|
221
|
-
export { Form as default };
|
package/dist/esm/FormItem.js
DELETED
package/dist/esm/Grid.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "columnNum", "border", "gutter", "center", "square", "reverse", "direction", "style", "iconSize", "iconColor", "className", "onClick"];
|
|
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 from 'react';
|
|
7
|
-
import classNames from 'classnames';
|
|
8
|
-
import { useConfig } from './ConfigProvider.js';
|
|
9
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
10
|
-
import { G as GridContext } from './grid.context-2ee27d95.js';
|
|
11
|
-
import '@bem-react/classname';
|
|
12
|
-
var defaultProps = {
|
|
13
|
-
columnNum: 4,
|
|
14
|
-
border: true,
|
|
15
|
-
gutter: 0,
|
|
16
|
-
center: true,
|
|
17
|
-
square: false,
|
|
18
|
-
reverse: false,
|
|
19
|
-
direction: 'vertical',
|
|
20
|
-
iconSize: 28,
|
|
21
|
-
iconColor: ''
|
|
22
|
-
};
|
|
23
|
-
var Grid = function Grid(props) {
|
|
24
|
-
useConfig();
|
|
25
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
26
|
-
children = _defaultProps$props.children,
|
|
27
|
-
columnNum = _defaultProps$props.columnNum,
|
|
28
|
-
border = _defaultProps$props.border,
|
|
29
|
-
gutter = _defaultProps$props.gutter,
|
|
30
|
-
center = _defaultProps$props.center,
|
|
31
|
-
square = _defaultProps$props.square,
|
|
32
|
-
reverse = _defaultProps$props.reverse,
|
|
33
|
-
direction = _defaultProps$props.direction,
|
|
34
|
-
style = _defaultProps$props.style,
|
|
35
|
-
iconSize = _defaultProps$props.iconSize,
|
|
36
|
-
iconColor = _defaultProps$props.iconColor,
|
|
37
|
-
className = _defaultProps$props.className,
|
|
38
|
-
onClick = _defaultProps$props.onClick,
|
|
39
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
40
|
-
var childrenDom = React__default.Children.toArray(children);
|
|
41
|
-
var pxCheck = function pxCheck(value) {
|
|
42
|
-
return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
|
|
43
|
-
};
|
|
44
|
-
var b = cn('grid');
|
|
45
|
-
var rootClass = function rootClass() {
|
|
46
|
-
var prefixCls = b();
|
|
47
|
-
return classNames(className, prefixCls, _defineProperty({}, b('border'), border && !gutter));
|
|
48
|
-
};
|
|
49
|
-
var rootStyle = function rootStyle() {
|
|
50
|
-
var styleSelf = {};
|
|
51
|
-
if (style) {
|
|
52
|
-
styleSelf = style;
|
|
53
|
-
}
|
|
54
|
-
if (gutter) {
|
|
55
|
-
styleSelf.paddingLeft = pxCheck(gutter);
|
|
56
|
-
}
|
|
57
|
-
return styleSelf;
|
|
58
|
-
};
|
|
59
|
-
return React__default.createElement("div", _objectSpread({
|
|
60
|
-
className: rootClass(),
|
|
61
|
-
style: rootStyle()
|
|
62
|
-
}, rest), React__default.createElement(GridContext.Provider, {
|
|
63
|
-
value: {
|
|
64
|
-
onClick: onClick
|
|
65
|
-
}
|
|
66
|
-
}, childrenDom.map(function (item, idex) {
|
|
67
|
-
return React__default.cloneElement(item, {
|
|
68
|
-
index: idex,
|
|
69
|
-
columnNum: columnNum,
|
|
70
|
-
center: center,
|
|
71
|
-
border: border,
|
|
72
|
-
gutter: gutter,
|
|
73
|
-
square: square,
|
|
74
|
-
reverse: reverse,
|
|
75
|
-
direction: direction,
|
|
76
|
-
parentIconSize: iconSize,
|
|
77
|
-
parentIconColor: iconColor
|
|
78
|
-
});
|
|
79
|
-
})));
|
|
80
|
-
};
|
|
81
|
-
Grid.defaultProps = defaultProps;
|
|
82
|
-
Grid.displayName = 'NutGrid';
|
|
83
|
-
export { Grid as default };
|
package/dist/esm/GridItem.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
var _excluded = ["children", "columnNum", "index", "gutter", "square", "text", "fontSize", "color", "icon", "iconColor", "iconSize", "parentIconSize", "parentIconColor", "border", "center", "reverse", "direction", "iconClassPrefix", "iconFontClassName", "onClick"];
|
|
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, { useContext } from 'react';
|
|
7
|
-
import classNames from 'classnames';
|
|
8
|
-
import { useConfig } from './ConfigProvider.js';
|
|
9
|
-
import { c as cn } from './bem-3b438e61.js';
|
|
10
|
-
import Icon from './Icon.js';
|
|
11
|
-
import { G as GridContext } from './grid.context-2ee27d95.js';
|
|
12
|
-
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
13
|
-
import '@bem-react/classname';
|
|
14
|
-
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
15
|
-
text: '',
|
|
16
|
-
fontSize: '',
|
|
17
|
-
color: '',
|
|
18
|
-
icon: '',
|
|
19
|
-
iconSize: '',
|
|
20
|
-
iconColor: '',
|
|
21
|
-
parentIconSize: '',
|
|
22
|
-
parentIconColor: '',
|
|
23
|
-
columnNum: 4,
|
|
24
|
-
border: true,
|
|
25
|
-
gutter: 0,
|
|
26
|
-
center: true,
|
|
27
|
-
square: false,
|
|
28
|
-
reverse: false,
|
|
29
|
-
direction: 'vertical'
|
|
30
|
-
});
|
|
31
|
-
var GridItem = function GridItem(props) {
|
|
32
|
-
useConfig();
|
|
33
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
34
|
-
children = _defaultProps$props.children,
|
|
35
|
-
columnNum = _defaultProps$props.columnNum,
|
|
36
|
-
index = _defaultProps$props.index,
|
|
37
|
-
gutter = _defaultProps$props.gutter,
|
|
38
|
-
square = _defaultProps$props.square,
|
|
39
|
-
text = _defaultProps$props.text,
|
|
40
|
-
fontSize = _defaultProps$props.fontSize,
|
|
41
|
-
color = _defaultProps$props.color,
|
|
42
|
-
icon = _defaultProps$props.icon,
|
|
43
|
-
iconColor = _defaultProps$props.iconColor,
|
|
44
|
-
iconSize = _defaultProps$props.iconSize,
|
|
45
|
-
parentIconSize = _defaultProps$props.parentIconSize,
|
|
46
|
-
parentIconColor = _defaultProps$props.parentIconColor,
|
|
47
|
-
border = _defaultProps$props.border,
|
|
48
|
-
center = _defaultProps$props.center,
|
|
49
|
-
reverse = _defaultProps$props.reverse,
|
|
50
|
-
direction = _defaultProps$props.direction,
|
|
51
|
-
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
52
|
-
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
53
|
-
onClick = _defaultProps$props.onClick,
|
|
54
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
55
|
-
var b = cn('grid-item');
|
|
56
|
-
var context = useContext(GridContext);
|
|
57
|
-
var pxCheck = function pxCheck(value) {
|
|
58
|
-
return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
|
|
59
|
-
};
|
|
60
|
-
var rootStyle = function rootStyle() {
|
|
61
|
-
var style = {
|
|
62
|
-
flexBasis: "".concat(100 / +columnNum, "%")
|
|
63
|
-
};
|
|
64
|
-
if (square) {
|
|
65
|
-
style.paddingTop = "".concat(100 / +columnNum, "%");
|
|
66
|
-
} else if (gutter) {
|
|
67
|
-
style.paddingRight = pxCheck(gutter);
|
|
68
|
-
if (index >= columnNum) {
|
|
69
|
-
style.marginTop = pxCheck(gutter);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return style;
|
|
73
|
-
};
|
|
74
|
-
var contentClass = function contentClass() {
|
|
75
|
-
var _classNames;
|
|
76
|
-
return classNames(b('content'), (_classNames = {}, _defineProperty(_classNames, b('content--border'), border), _defineProperty(_classNames, b('content--surround'), border && gutter), _defineProperty(_classNames, b('content--center'), center), _defineProperty(_classNames, b('content--square'), square), _defineProperty(_classNames, b('content--reverse'), reverse), _defineProperty(_classNames, b("content--".concat(direction)), !!direction), _classNames));
|
|
77
|
-
};
|
|
78
|
-
var isIconName = function isIconName() {
|
|
79
|
-
return typeof icon === 'string';
|
|
80
|
-
};
|
|
81
|
-
var handleClick = function handleClick(e) {
|
|
82
|
-
onClick && onClick(e);
|
|
83
|
-
context.onClick && context.onClick({
|
|
84
|
-
text: text,
|
|
85
|
-
icon: icon,
|
|
86
|
-
iconSize: iconSize,
|
|
87
|
-
iconColor: iconColor,
|
|
88
|
-
parentIconSize: parentIconSize,
|
|
89
|
-
parentIconColor: parentIconColor,
|
|
90
|
-
index: index,
|
|
91
|
-
columnNum: columnNum,
|
|
92
|
-
border: border,
|
|
93
|
-
gutter: gutter,
|
|
94
|
-
center: center,
|
|
95
|
-
square: square,
|
|
96
|
-
reverse: reverse,
|
|
97
|
-
direction: direction,
|
|
98
|
-
fontSize: fontSize,
|
|
99
|
-
color: color
|
|
100
|
-
}, index);
|
|
101
|
-
};
|
|
102
|
-
return React__default.createElement("div", _objectSpread(_objectSpread({
|
|
103
|
-
className: b(),
|
|
104
|
-
style: rootStyle()
|
|
105
|
-
}, rest), {}, {
|
|
106
|
-
onClick: handleClick
|
|
107
|
-
}), React__default.createElement("div", {
|
|
108
|
-
className: contentClass()
|
|
109
|
-
}, icon && isIconName() ? React__default.createElement(Icon, {
|
|
110
|
-
classPrefix: iconClassPrefix,
|
|
111
|
-
fontClassName: iconFontClassName,
|
|
112
|
-
name: icon,
|
|
113
|
-
size: iconSize || parentIconSize,
|
|
114
|
-
color: iconColor || parentIconColor
|
|
115
|
-
}) : React__default.createElement(React__default.Fragment, null, icon), text && React__default.createElement("div", {
|
|
116
|
-
className: "nut-grid-item__text",
|
|
117
|
-
style: {
|
|
118
|
-
fontSize: fontSize,
|
|
119
|
-
color: color
|
|
120
|
-
}
|
|
121
|
-
}, text), children && React__default.createElement(React__default.Fragment, null, children)));
|
|
122
|
-
};
|
|
123
|
-
GridItem.defaultProps = defaultProps;
|
|
124
|
-
GridItem.displayName = 'NutGridItem';
|
|
125
|
-
export { GridItem as default };
|
package/dist/esm/Icon.js
DELETED