@nutui/nutui-react 1.5.2-beta.0 → 1.5.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -1
- package/dist/esm/ActionSheet/style/index.js +2 -0
- package/dist/esm/ActionSheet.js +92 -0
- package/dist/esm/Address/style/index.js +4 -0
- package/dist/esm/Address.js +622 -0
- package/dist/esm/Animate/style/index.js +2 -0
- package/dist/esm/Animate.js +55 -0
- package/dist/esm/AnimatingNumbers/style/index.js +3 -0
- package/dist/esm/AnimatingNumbers.js +127 -0
- package/dist/esm/Audio/style/index.js +4 -0
- package/dist/esm/Audio.js +266 -0
- package/dist/esm/Avatar/style/index.js +2 -0
- package/dist/esm/Avatar.js +132 -0
- package/dist/esm/AvatarContext-15733596.js +3 -0
- package/dist/esm/AvatarGroup/style/index.js +2 -0
- package/dist/esm/AvatarGroup.js +43 -0
- package/dist/esm/BackTop/style/index.js +2 -0
- package/dist/esm/BackTop.js +139 -0
- package/dist/esm/Badge/style/index.js +2 -0
- package/dist/esm/Badge.js +73 -0
- package/dist/esm/Barrage/style/index.js +2 -0
- package/dist/esm/Barrage.js +99 -0
- package/dist/esm/Button/style/index.js +2 -0
- package/dist/esm/Button.js +109 -0
- package/dist/esm/Calendar/style/index.js +2 -0
- package/dist/esm/Calendar.js +129 -0
- package/dist/esm/CalendarItem/style/index.js +2 -0
- package/dist/esm/CalendarItem.js +676 -0
- package/dist/esm/Card/style/index.js +4 -0
- package/dist/esm/Card.js +63 -0
- package/dist/esm/Cascader/style/index.js +3 -0
- package/dist/esm/Cascader.js +673 -0
- package/dist/esm/Cell/style/index.js +2 -0
- package/dist/esm/Cell.js +103 -0
- package/dist/esm/CellGroup/style/index.js +2 -0
- package/dist/esm/CellGroup.js +5 -0
- package/dist/esm/Checkbox/style/index.js +3 -0
- package/dist/esm/Checkbox.js +8 -0
- package/dist/esm/CheckboxGroup/style/index.js +2 -0
- package/dist/esm/CheckboxGroup.js +113 -0
- package/dist/esm/CircleProgress/style/index.js +2 -0
- package/dist/esm/CircleProgress.js +116 -0
- package/dist/esm/Col/style/index.js +2 -0
- package/dist/esm/Col.js +58 -0
- package/dist/esm/Collapse/style/index.js +2 -0
- package/dist/esm/Collapse.js +99 -0
- package/dist/esm/CollapseItem/style/index.js +2 -0
- package/dist/esm/CollapseItem.js +148 -0
- package/dist/esm/ConfigProvider/style/index.js +2 -0
- package/dist/esm/ConfigProvider.js +187 -0
- package/dist/esm/CountDown/style/index.js +2 -0
- package/dist/esm/CountDown.js +249 -0
- package/dist/esm/DatePicker/style/index.js +2 -0
- package/dist/esm/DatePicker.js +310 -0
- package/dist/esm/Dialog/style/index.js +3 -0
- package/dist/esm/Dialog.js +296 -0
- package/dist/esm/Divider/style/index.js +2 -0
- package/dist/esm/Divider.js +36 -0
- package/dist/esm/Drag/style/index.js +2 -0
- package/dist/esm/Drag.js +120 -0
- package/dist/esm/Elevator/style/index.js +2 -0
- package/dist/esm/Elevator.js +236 -0
- package/dist/esm/Ellipsis/style/index.js +2 -0
- package/dist/esm/Ellipsis.js +177 -0
- package/dist/esm/Empty/style/index.js +2 -0
- package/dist/esm/Empty.js +82 -0
- package/dist/esm/FixedNav/style/index.js +3 -0
- package/dist/esm/FixedNav.js +105 -0
- package/dist/esm/Form/style/index.js +2 -0
- package/dist/esm/Form.js +219 -0
- package/dist/esm/FormItem/style/index.js +2 -0
- package/dist/esm/FormItem.js +5 -0
- package/dist/esm/Grid/style/index.js +2 -0
- package/dist/esm/Grid.js +83 -0
- package/dist/esm/GridItem/style/index.js +2 -0
- package/dist/esm/GridItem.js +125 -0
- package/dist/esm/Icon/style/index.js +4 -0
- package/dist/esm/Icon.js +5 -0
- package/dist/esm/Image/style/index.js +2 -0
- package/dist/esm/Image.js +170 -0
- package/dist/esm/ImagePreview/style/index.js +4 -0
- package/dist/esm/ImagePreview.js +226 -0
- package/dist/esm/Indicator/style/index.js +2 -0
- package/dist/esm/Indicator.js +52 -0
- package/dist/esm/Infiniteloading/style/index.js +2 -0
- package/dist/esm/Infiniteloading.js +217 -0
- package/dist/esm/Input/style/index.js +2 -0
- package/dist/esm/Input.js +363 -0
- package/dist/esm/InputNumber/style/index.js +2 -0
- package/dist/esm/InputNumber.js +277 -0
- package/dist/esm/Layout/style/index.js +2 -0
- package/dist/esm/Layout.js +14 -0
- package/dist/esm/Menu/style/index.js +3 -0
- package/dist/esm/Menu.js +154 -0
- package/dist/esm/MenuItem/style/index.js +3 -0
- package/dist/esm/MenuItem.js +177 -0
- package/dist/esm/NavBar/style/index.js +2 -0
- package/dist/esm/NavBar.js +116 -0
- package/dist/esm/NoticeBar/style/index.js +2 -0
- package/dist/esm/NoticeBar.js +570 -0
- package/dist/esm/Notify/style/index.js +2 -0
- package/dist/esm/Notify.js +236 -0
- package/dist/esm/NumberKeyboard/style/index.js +2 -0
- package/dist/esm/NumberKeyboard.js +249 -0
- package/dist/esm/Overlay/style/index.js +2 -0
- package/dist/esm/Overlay.js +6 -0
- package/dist/esm/Pagination/style/index.js +2 -0
- package/dist/esm/Pagination.js +170 -0
- package/dist/esm/Picker/style/index.js +2 -0
- package/dist/esm/Picker.js +496 -0
- package/dist/esm/Popover/style/index.js +3 -0
- package/dist/esm/Popover.js +225 -0
- package/dist/esm/Popup/style/index.js +3 -0
- package/dist/esm/Popup.js +195 -0
- package/dist/esm/Price/style/index.js +2 -0
- package/dist/esm/Price.js +86 -0
- package/dist/esm/Progress/style/index.js +2 -0
- package/dist/esm/Progress.js +124 -0
- package/dist/esm/PullToRefresh/style/index.js +2 -0
- package/dist/esm/PullToRefresh.js +277 -0
- package/dist/esm/Radio/style/index.js +3 -0
- package/dist/esm/Radio.js +6 -0
- package/dist/esm/RadioGroup/style/index.js +2 -0
- package/dist/esm/RadioGroup.js +123 -0
- package/dist/esm/Range/style/index.js +2 -0
- package/dist/esm/Range.js +407 -0
- package/dist/esm/Rate/style/index.js +2 -0
- package/dist/esm/Rate.js +123 -0
- package/dist/esm/Row/style/index.js +2 -0
- package/dist/esm/Row.js +50 -0
- package/dist/esm/SearchBar/style/index.js +2 -0
- package/dist/esm/SearchBar.js +237 -0
- package/dist/esm/ShortPassword/style/index.js +3 -0
- package/dist/esm/ShortPassword.js +193 -0
- package/dist/esm/SideNavBar/style/index.js +2 -0
- package/dist/esm/SideNavBar.js +58 -0
- package/dist/esm/SideNavBarItem/style/index.js +2 -0
- package/dist/esm/SideNavBarItem.js +25 -0
- package/dist/esm/Signature/style/index.js +2 -0
- package/dist/esm/Signature.js +155 -0
- package/dist/esm/Skeleton/style/index.js +2 -0
- package/dist/esm/Skeleton.js +100 -0
- package/dist/esm/Step/style/index.js +2 -0
- package/dist/esm/Step.js +89 -0
- package/dist/esm/Steps/style/index.js +2 -0
- package/dist/esm/Steps.js +40 -0
- package/dist/esm/Sticky/style/index.js +2 -0
- package/dist/esm/Sticky.js +192 -0
- package/dist/esm/SubSideNavBar/style/index.js +2 -0
- package/dist/esm/SubSideNavBar.js +79 -0
- package/dist/esm/Swipe/style/index.js +2 -0
- package/dist/esm/Swipe.js +232 -0
- package/dist/esm/Swiper/style/index.js +2 -0
- package/dist/esm/Swiper.js +492 -0
- package/dist/esm/SwiperItem/style/index.js +2 -0
- package/dist/esm/SwiperItem.js +38 -0
- package/dist/esm/Switch/style/index.js +2 -0
- package/dist/esm/Switch.js +73 -0
- package/dist/esm/TabPane/style/index.js +2 -0
- package/dist/esm/TabPane.js +6 -0
- package/dist/esm/Tabbar/style/index.js +2 -0
- package/dist/esm/Tabbar.js +70 -0
- package/dist/esm/TabbarItem/style/index.js +2 -0
- package/dist/esm/TabbarItem.js +80 -0
- package/dist/esm/Table/style/index.js +2 -0
- package/dist/esm/Table.js +142 -0
- package/dist/esm/Tabs/style/index.js +4 -0
- package/dist/esm/Tabs.js +9 -0
- package/dist/esm/Tag/style/index.js +2 -0
- package/dist/esm/Tag.js +111 -0
- package/dist/esm/TextArea/style/index.js +2 -0
- package/dist/esm/TextArea.js +150 -0
- package/dist/esm/TimeDetail/style/index.js +2 -0
- package/dist/esm/TimeDetail.js +69 -0
- package/dist/esm/TimePannel/style/index.js +2 -0
- package/dist/esm/TimePannel.js +31 -0
- package/dist/esm/TimeSelect/style/index.js +4 -0
- package/dist/esm/TimeSelect.js +173 -0
- package/dist/esm/Toast/style/index.js +2 -0
- package/dist/esm/Toast.js +271 -0
- package/dist/esm/TrendArrow/style/index.js +2 -0
- package/dist/esm/TrendArrow.js +101 -0
- package/dist/esm/Uploader/style/index.js +4 -0
- package/dist/esm/Uploader.js +568 -0
- package/dist/esm/UserContext-101ad4a4.js +3 -0
- package/dist/esm/UserContext-2629d479.js +3 -0
- package/dist/esm/UserContext-b33bcf21.js +3 -0
- package/dist/esm/Video/style/index.js +2 -0
- package/dist/esm/Video.js +92 -0
- package/dist/esm/VirtualList/style/index.js +2 -0
- package/dist/esm/VirtualList.js +315 -0
- package/dist/esm/WaterMark/style/index.js +2 -0
- package/dist/esm/WaterMark.js +113 -0
- package/dist/esm/bem-3b438e61.js +8 -0
- package/dist/esm/cellgroup-fcc72767.js +34 -0
- package/dist/esm/checkbox-44e13cd0.js +137 -0
- package/dist/esm/date-c7aad4c0.js +97 -0
- package/dist/esm/formitem-8a73a5fb.js +157 -0
- package/dist/esm/get-scroll-parent-5f85dee8.js +24 -0
- package/dist/esm/grid.context-2ee27d95.js +6 -0
- package/dist/esm/icon-4ef1581c.js +70 -0
- package/dist/esm/index-030b7245.js +11 -0
- package/dist/esm/nutui-react.es.js +94 -0
- package/dist/esm/offsetContext-3ab00d40.js +16 -0
- package/dist/esm/overlay-de6c79d5.js +83 -0
- package/dist/esm/radio-9f141e6b.js +118 -0
- package/dist/esm/render-bbebb760.js +79 -0
- package/dist/esm/tabpane-01075e6c.js +29 -0
- package/dist/esm/tabs-e1b4e4b1.js +181 -0
- package/dist/esm/typings-f27b58f4.js +8 -0
- package/dist/esm/useClientRect-56bb675b.js +39 -0
- package/dist/esm/useTouch-cf73a407.js +99 -0
- package/dist/locales/base.d.ts +129 -0
- package/dist/locales/base.js +5 -0
- package/dist/locales/en-US.d.ts +3 -0
- package/dist/locales/en-US.js +135 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +135 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +137 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +135 -0
- package/dist/locales/zh-UG.d.ts +3 -0
- package/dist/locales/zh-UG.js +135 -0
- package/dist/nutui.react.mjs +2 -2
- package/dist/nutui.react.umd.js +2 -2
- package/dist/packages/actionsheet/actionsheet.scss +103 -0
- package/dist/packages/address/address.scss +243 -0
- package/dist/packages/animate/animate.scss +284 -0
- package/dist/packages/animatingnumbers/animatingnumbers.scss +0 -0
- package/dist/packages/animatingnumbers/countup.scss +45 -0
- package/dist/packages/audio/audio.scss +93 -0
- package/dist/packages/avatar/avatar.scss +58 -0
- package/dist/packages/avatargroup/avatargroup.scss +14 -0
- package/dist/packages/backtop/backtop.scss +29 -0
- package/dist/packages/badge/badge.scss +53 -0
- package/dist/packages/barrage/barrage.scss +60 -0
- package/dist/packages/button/button.scss +245 -0
- package/dist/packages/calendar/calendar.scss +265 -0
- package/dist/packages/calendaritem/calendaritem.scss +0 -0
- package/dist/packages/card/card.scss +83 -0
- package/dist/packages/cascader/cascader.scss +108 -0
- package/dist/packages/cell/cell.scss +107 -0
- package/dist/packages/cellgroup/cellgroup.scss +46 -0
- package/dist/packages/checkbox/checkbox.scss +49 -0
- package/dist/packages/checkboxgroup/checkboxgroup.scss +33 -0
- package/dist/packages/circleprogress/circleprogress.scss +33 -0
- package/dist/packages/col/col.scss +24 -0
- package/dist/packages/collapse/collapse.scss +0 -0
- package/dist/packages/collapseitem/collapseitem.scss +161 -0
- package/dist/packages/configprovider/configprovider.scss +0 -0
- package/dist/packages/countdown/countdown.scss +3 -0
- package/dist/packages/datepicker/datepicker.scss +0 -0
- package/dist/packages/dialog/dialog.scss +135 -0
- package/dist/packages/divider/divider.scss +73 -0
- package/dist/packages/drag/drag.scss +10 -0
- package/dist/packages/elevator/elevator.scss +124 -0
- package/dist/packages/ellipsis/ellipsis.scss +17 -0
- package/dist/packages/empty/empty.scss +42 -0
- package/dist/packages/fixednav/fixednav.scss +141 -0
- package/dist/packages/form/form.scss +31 -0
- package/dist/packages/formitem/formitem.scss +100 -0
- package/dist/packages/grid/grid.scss +10 -0
- package/dist/packages/griditem/griditem.scss +108 -0
- package/dist/packages/icon/icon.scss +132 -0
- package/dist/packages/image/image.scss +53 -0
- package/dist/packages/imagepreview/imagepreview.scss +51 -0
- package/dist/packages/indicator/indicator.scss +70 -0
- package/dist/packages/infiniteloading/infiniteloading.scss +69 -0
- package/dist/packages/input/input.scss +203 -0
- package/dist/packages/inputnumber/inputnumber.scss +79 -0
- package/dist/packages/layout/layout.scss +2 -0
- package/dist/packages/menu/menu.scss +75 -0
- package/dist/packages/menuitem/menuitem.scss +120 -0
- package/dist/packages/navbar/navbar.scss +185 -0
- package/dist/packages/noticebar/noticebar.scss +156 -0
- package/dist/packages/notify/notify.scss +93 -0
- package/dist/packages/numberkeyboard/numberkeyboard.scss +147 -0
- package/dist/packages/overlay/overlay.scss +75 -0
- package/dist/packages/pagination/pagination.scss +81 -0
- package/dist/packages/picker/picker.scss +225 -0
- package/dist/packages/popover/popover.scss +288 -0
- package/dist/packages/popup/popup.scss +201 -0
- package/dist/packages/price/price.scss +37 -0
- package/dist/packages/progress/progress.scss +114 -0
- package/dist/packages/pulltorefresh/pulltorefresh.scss +26 -0
- package/dist/packages/radio/radio.scss +84 -0
- package/dist/packages/radiogroup/radiogroup.scss +86 -0
- package/dist/packages/range/range.scss +224 -0
- package/dist/packages/rate/rate.scss +36 -0
- package/dist/packages/row/row.scss +83 -0
- package/dist/packages/searchbar/searchbar.scss +146 -0
- package/dist/packages/shortpassword/shortpassword.scss +203 -0
- package/dist/packages/sidenavbar/sidenavbar.scss +100 -0
- package/dist/packages/sidenavbaritem/sidenavbaritem.scss +25 -0
- package/dist/packages/signature/signature.scss +39 -0
- package/dist/packages/skeleton/skeleton.scss +70 -0
- package/dist/packages/step/step.scss +274 -0
- package/dist/packages/steps/steps.scss +7 -0
- package/dist/packages/sticky/sticky.scss +3 -0
- package/dist/packages/subsidenavbar/subsidenavbar.scss +35 -0
- package/dist/packages/swipe/swipe.scss +33 -0
- package/dist/packages/swiper/swiper.scss +45 -0
- package/dist/packages/swiperitem/swiperitem.scss +3 -0
- package/dist/packages/switch/switch.scss +87 -0
- package/dist/packages/tabbar/tabbar.scss +46 -0
- package/dist/packages/tabbaritem/tabbaritem.scss +97 -0
- package/dist/packages/table/table.scss +152 -0
- package/dist/packages/tabpane/tabpane.scss +23 -0
- package/dist/packages/tabs/tabs.scss +284 -0
- package/dist/packages/tag/tag.scss +67 -0
- package/dist/packages/textarea/textarea.scss +60 -0
- package/dist/packages/timedetail/timedetail.scss +45 -0
- package/dist/packages/timepannel/timepannel.scss +17 -0
- package/dist/packages/timeselect/timeselect.scss +73 -0
- package/dist/packages/toast/toast.scss +98 -0
- package/dist/packages/trendarrow/trendarrow.scss +17 -0
- package/dist/packages/uploader/uploader.scss +237 -0
- package/dist/packages/video/video.scss +18 -0
- package/dist/packages/virtuallist/virtuallist.scss +87 -0
- package/dist/packages/watermark/watermark.scss +13 -0
- package/dist/style.css +1 -0
- package/dist/style.mjs +9 -0
- package/dist/styles/animation/drop.scss +24 -0
- package/dist/styles/animation/ease.scss +23 -0
- package/dist/styles/animation/fade.scss +20 -0
- package/dist/styles/animation/icon.scss +245 -0
- package/dist/styles/animation/index.scss +7 -0
- package/dist/styles/animation/rotate.scss +10 -0
- package/dist/styles/animation/zoom.scss +26 -0
- package/dist/styles/font/config.json +175 -0
- package/dist/styles/font/demo.css +539 -0
- package/dist/styles/font/demo_index.html +3063 -0
- package/dist/styles/font/iconfont.css +515 -0
- package/dist/styles/font/iconfont.eot +0 -0
- package/dist/styles/font/iconfont.js +68 -0
- package/dist/styles/font/iconfont.json +884 -0
- package/dist/styles/font/iconfont.svg +356 -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/mixins/index.scss +2 -0
- package/dist/styles/mixins/make-animation.scss +24 -0
- package/dist/styles/mixins/text-ellipsis.scss +20 -0
- package/dist/styles/theme-dark.scss +26 -0
- package/dist/styles/theme-default.scss +40 -0
- package/dist/styles/themes/default.scss +97 -0
- package/dist/styles/variables.scss +2610 -0
- package/dist/types/index.d.ts +2201 -0
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
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(function FormStore() {
|
|
23
|
+
var _this = this;
|
|
24
|
+
_classCallCheck(this, FormStore);
|
|
25
|
+
_defineProperty(this, "store", {});
|
|
26
|
+
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
27
|
+
_defineProperty(this, "fieldEntities", []);
|
|
28
|
+
// 所有的组件实例
|
|
29
|
+
// 成功和失败的回调
|
|
30
|
+
_defineProperty(this, "callbacks", {});
|
|
31
|
+
_defineProperty(this, "errList", []);
|
|
32
|
+
/**
|
|
33
|
+
* 注册组件实例
|
|
34
|
+
* @param field
|
|
35
|
+
*/
|
|
36
|
+
_defineProperty(this, "registerField", function (field) {
|
|
37
|
+
_this.fieldEntities.push(field);
|
|
38
|
+
return function () {
|
|
39
|
+
_this.fieldEntities = _this.fieldEntities.filter(function (item) {
|
|
40
|
+
return item != field;
|
|
41
|
+
});
|
|
42
|
+
delete _this.store[field.props.name];
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(this, "getFieldValue", function (name) {
|
|
46
|
+
return _this.store[name];
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* 存储组件数据
|
|
50
|
+
* @param newStore { [name]: newValue }
|
|
51
|
+
*/
|
|
52
|
+
_defineProperty(this, "setFieldsValue", function (newStore) {
|
|
53
|
+
_this.store = _objectSpread(_objectSpread({}, _this.store), newStore);
|
|
54
|
+
_this.fieldEntities.forEach(function (enetity) {
|
|
55
|
+
var name = enetity.props.name;
|
|
56
|
+
Object.keys(newStore).forEach(function (key) {
|
|
57
|
+
if (key === name) {
|
|
58
|
+
enetity.onStoreChange();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* 表单校验
|
|
65
|
+
* rules: { required: true, message: '' }
|
|
66
|
+
* descriptor: {
|
|
67
|
+
* username: {
|
|
68
|
+
* type: 'string',
|
|
69
|
+
* required: true,
|
|
70
|
+
* validator: (rule, value) => {
|
|
71
|
+
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
72
|
+
* },
|
|
73
|
+
* },
|
|
74
|
+
* }
|
|
75
|
+
*/
|
|
76
|
+
_defineProperty(this, "validate", function () {
|
|
77
|
+
var err = [];
|
|
78
|
+
_this.errList.length = 0;
|
|
79
|
+
_this.fieldEntities.forEach(function (entity) {
|
|
80
|
+
var _entity$props = entity.props,
|
|
81
|
+
name = _entity$props.name,
|
|
82
|
+
_entity$props$rules = _entity$props.rules,
|
|
83
|
+
rules = _entity$props$rules === void 0 ? [] : _entity$props$rules;
|
|
84
|
+
var descriptor = {};
|
|
85
|
+
if (rules.length) {
|
|
86
|
+
// 多条校验规则
|
|
87
|
+
if (rules.length > 1) {
|
|
88
|
+
descriptor[name] = [];
|
|
89
|
+
rules.map(function (v) {
|
|
90
|
+
descriptor[name].push(v);
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
descriptor[name] = rules[0];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
var validator = new Schema(descriptor);
|
|
97
|
+
validator.validate(_defineProperty({}, name, _this.store[name]), function (errors) {
|
|
98
|
+
if (errors) {
|
|
99
|
+
var _this$errList;
|
|
100
|
+
err.push.apply(err, _toConsumableArray(errors));
|
|
101
|
+
(_this$errList = _this.errList).push.apply(_this$errList, _toConsumableArray(errors));
|
|
102
|
+
// 表单项更新
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
entity.onStoreChange();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
return err;
|
|
109
|
+
});
|
|
110
|
+
_defineProperty(this, "setCallback", function (callback) {
|
|
111
|
+
_this.callbacks = _objectSpread(_objectSpread({}, _this.callbacks), callback);
|
|
112
|
+
});
|
|
113
|
+
_defineProperty(this, "submit", function () {
|
|
114
|
+
var err = _this.validate();
|
|
115
|
+
if (err.length === 0) {
|
|
116
|
+
var _this$callbacks$onFin, _this$callbacks;
|
|
117
|
+
(_this$callbacks$onFin = (_this$callbacks = _this.callbacks).onFinish) === null || _this$callbacks$onFin === void 0 ? void 0 : _this$callbacks$onFin.call(_this$callbacks, _this.store);
|
|
118
|
+
} else if (err.length > 0) {
|
|
119
|
+
var _this$callbacks$onFin2, _this$callbacks2;
|
|
120
|
+
(_this$callbacks$onFin2 = (_this$callbacks2 = _this.callbacks).onFinishFailed) === null || _this$callbacks$onFin2 === void 0 ? void 0 : _this$callbacks$onFin2.call(_this$callbacks2, err);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
_defineProperty(this, "resetFields", function () {
|
|
124
|
+
_this.errList.length = 0;
|
|
125
|
+
_this.fieldEntities.forEach(function (enetity) {
|
|
126
|
+
enetity.onStoreChange();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
_defineProperty(this, "getForm", function () {
|
|
130
|
+
return {
|
|
131
|
+
setCallback: _this.setCallback,
|
|
132
|
+
registerField: _this.registerField,
|
|
133
|
+
getFieldValue: _this.getFieldValue,
|
|
134
|
+
setFieldsValue: _this.setFieldsValue,
|
|
135
|
+
resetFields: _this.resetFields,
|
|
136
|
+
submit: _this.submit,
|
|
137
|
+
store: _this.store,
|
|
138
|
+
errList: _this.errList,
|
|
139
|
+
fieldEntities: _this.fieldEntities
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
this.callbacks = {
|
|
143
|
+
onFinish: function onFinish(value) {},
|
|
144
|
+
onFinishFailed: function onFinishFailed() {}
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
var useForm = function useForm(form) {
|
|
148
|
+
var formRef = useRef();
|
|
149
|
+
if (!formRef.current) {
|
|
150
|
+
if (form) {
|
|
151
|
+
formRef.current = form;
|
|
152
|
+
} else {
|
|
153
|
+
var formStore = new FormStore();
|
|
154
|
+
formRef.current = formStore.getForm();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return [formRef.current];
|
|
158
|
+
};
|
|
159
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
160
|
+
className: '',
|
|
161
|
+
style: undefined,
|
|
162
|
+
form: {},
|
|
163
|
+
labelPosition: 'Right',
|
|
164
|
+
formGroupTitle: '',
|
|
165
|
+
onFinish: function onFinish(obj) {},
|
|
166
|
+
onFinishFailed: function onFinishFailed(value) {},
|
|
167
|
+
starPositon: 'Left'
|
|
168
|
+
});
|
|
169
|
+
var PositionInfo = {
|
|
170
|
+
Top: 'form-layout-top',
|
|
171
|
+
Left: 'form-layout-left',
|
|
172
|
+
Right: 'form-layout-right'
|
|
173
|
+
};
|
|
174
|
+
var Form = function Form(props) {
|
|
175
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
176
|
+
children = _defaultProps$props.children,
|
|
177
|
+
onFinish = _defaultProps$props.onFinish,
|
|
178
|
+
onFinishFailed = _defaultProps$props.onFinishFailed,
|
|
179
|
+
labelPosition = _defaultProps$props.labelPosition,
|
|
180
|
+
starPositon = _defaultProps$props.starPositon,
|
|
181
|
+
form = _defaultProps$props.form,
|
|
182
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
183
|
+
var formInstance = {};
|
|
184
|
+
if (Object.keys(form).length !== 0) {
|
|
185
|
+
formInstance = form;
|
|
186
|
+
} else {
|
|
187
|
+
var _useForm = useForm();
|
|
188
|
+
var _useForm2 = _slicedToArray(_useForm, 1);
|
|
189
|
+
formInstance = _useForm2[0];
|
|
190
|
+
}
|
|
191
|
+
formInstance.starPositon = starPositon;
|
|
192
|
+
var _formInstance = formInstance,
|
|
193
|
+
setCallback = _formInstance.setCallback,
|
|
194
|
+
submit = _formInstance.submit,
|
|
195
|
+
resetFields = _formInstance.resetFields;
|
|
196
|
+
setCallback({
|
|
197
|
+
onFinish: onFinish,
|
|
198
|
+
onFinishFailed: onFinishFailed
|
|
199
|
+
});
|
|
200
|
+
return React__default.createElement("form", {
|
|
201
|
+
className: "nut-form ".concat(PositionInfo[labelPosition], " ").concat(props.className),
|
|
202
|
+
style: props.style,
|
|
203
|
+
onSubmit: function onSubmit(e) {
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
submit();
|
|
206
|
+
},
|
|
207
|
+
onReset: function onReset(e) {
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
resetFields();
|
|
210
|
+
}
|
|
211
|
+
}, React__default.createElement(CellGroup, null, React__default.createElement(FormItemContext.Provider, {
|
|
212
|
+
value: formInstance
|
|
213
|
+
}, children)));
|
|
214
|
+
};
|
|
215
|
+
Form.defaultProps = defaultProps;
|
|
216
|
+
Form.displayName = 'NutForm';
|
|
217
|
+
Form.Item = FormItem;
|
|
218
|
+
Form.useForm = useForm;
|
|
219
|
+
export { Form as default };
|
package/dist/esm/Grid.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
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 };
|
|
@@ -0,0 +1,125 @@
|
|
|
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
ADDED