@nutui/nutui-react-taro 1.3.1 → 1.3.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 +20 -0
- package/dist/esm/ActionSheet.js +5 -5
- package/dist/esm/Address.js +11 -7
- package/dist/esm/Audio.js +7 -8
- package/dist/esm/Avatar.js +3 -3
- package/dist/esm/AvatarGroup.js +4 -4
- package/dist/esm/BackTop.js +3 -3
- package/dist/esm/Badge.js +3 -3
- package/dist/esm/Button.js +3 -3
- package/dist/esm/Calendar.js +8 -8
- package/dist/esm/CalendarItem.js +4 -4
- package/dist/esm/Card.js +5 -3
- package/dist/esm/Cascader.js +6 -7
- package/dist/esm/Cell.js +3 -3
- package/dist/esm/Checkbox.js +4 -3
- package/dist/esm/ConfigProvider.js +3 -3
- package/dist/esm/CountDown.js +4 -4
- package/dist/esm/DatePicker.js +9 -8
- package/dist/esm/Dialog.js +7 -6
- package/dist/esm/Elevator.js +4 -2
- package/dist/esm/Empty.js +4 -4
- package/dist/esm/FixedNav.js +6 -6
- package/dist/esm/Grid.js +4 -4
- package/dist/esm/GridItem.js +5 -5
- package/dist/esm/ImagePreview.js +7 -6
- package/dist/esm/Infiniteloading.js +5 -5
- package/dist/esm/Input.js +5 -5
- package/dist/esm/InputNumber.js +3 -3
- package/dist/esm/MenuItem.js +5 -5
- package/dist/esm/NavBar.js +3 -3
- package/dist/esm/NoticeBar.js +3 -3
- package/dist/esm/NumberKeyboard.js +7 -7
- package/dist/esm/Overlay.js +2 -2
- package/dist/esm/Pagination.js +4 -4
- package/dist/esm/Picker.js +8 -8
- package/dist/esm/Popover.js +4 -4
- package/dist/esm/Popup.js +4 -4
- package/dist/esm/Progress.js +3 -3
- package/dist/esm/PullToRefresh/style/index.js +2 -0
- package/dist/esm/PullToRefresh.js +7 -0
- package/dist/esm/Radio.js +4 -4
- package/dist/esm/RadioGroup.js +2 -2
- package/dist/esm/Range.js +5 -5
- package/dist/esm/Rate.js +3 -3
- package/dist/esm/SearchBar.js +5 -5
- package/dist/esm/ShortPassword.js +7 -7
- package/dist/esm/SideNavBar.js +7 -7
- package/dist/esm/Signature.js +6 -6
- package/dist/esm/Skeleton.js +4 -3
- package/dist/esm/Swiper.js +3 -3
- package/dist/esm/TabbarItem.js +3 -3
- package/dist/esm/Table.js +5 -5
- package/dist/esm/Tabs.js +3 -3
- package/dist/esm/Tag.js +3 -3
- package/dist/esm/TextArea.js +4 -4
- package/dist/esm/TimeDetail.js +4 -4
- package/dist/esm/TimePannel.js +4 -4
- package/dist/esm/TimeSelect.js +9 -7
- package/dist/esm/Toast.js +2 -3
- package/dist/esm/Uploader.js +4 -4
- package/dist/esm/VirtualList.js +4 -4
- package/dist/esm/{actionsheet.taro-f4d407b0.js → actionsheet.taro-1b3e7972.js} +9 -9
- package/dist/esm/{address.taro-4765a826.js → address.taro-f045886a.js} +48 -60
- package/dist/esm/{audio.taro-cd6cc93b.js → audio.taro-b34a1eb6.js} +3 -3
- package/dist/esm/{avatar.taro-0a0472fd.js → avatar.taro-c3a605b9.js} +1 -1
- package/dist/esm/{avatargroup-1ca79066.js → avatargroup-5b2584d9.js} +1 -1
- package/dist/esm/{backtop.taro-0e2e3946.js → backtop.taro-eb9359e8.js} +1 -1
- package/dist/esm/{badge.taro-eeac9de8.js → badge.taro-e6c4fe5f.js} +4 -4
- package/dist/esm/{button-521a516b.js → button.taro-bffc9543.js} +1 -1
- package/dist/esm/{calendar.taro-1abb1925.js → calendar.taro-1fc76ba0.js} +3 -3
- package/dist/esm/{calendaritem.taro-3c06a809.js → calendaritem.taro-11333579.js} +1 -1
- package/dist/esm/card.taro-2fbfbf59.js +67 -0
- package/dist/esm/{cascader.taro-31dbc60e.js → cascader.taro-d7e71bdf.js} +2 -2
- package/dist/esm/{cell.taro-3bb1b0f2.js → cell.taro-263a8927.js} +1 -1
- package/dist/esm/checkbox.taro-9d05ae76.js +140 -0
- package/dist/esm/{configprovider-9c393a29.js → configprovider-3e87d67a.js} +1 -1
- package/dist/esm/{configprovider.taro-1ff7f150.js → configprovider.taro-6c7b3056.js} +1 -1
- package/dist/esm/{countdown.taro-b00d0d46.js → countdown.taro-5d5df894.js} +1 -1
- package/dist/esm/{datepicker.taro-e385849d.js → datepicker.taro-318e9561.js} +22 -274
- package/dist/esm/{dialog.taro-c80b7b5f.js → dialog.taro-0e53ade9.js} +109 -9
- package/dist/esm/{elevator.taro-15b0d8c2.js → elevator.taro-8e385785.js} +39 -47
- package/dist/esm/{empty.taro-20b8adac.js → empty.taro-ab9c4f03.js} +1 -1
- package/dist/esm/{fixednav.taro-75e35339.js → fixednav.taro-6c0279ba.js} +3 -3
- package/dist/esm/{grid.taro-7fb43d02.js → grid.taro-5d75c0ad.js} +1 -1
- package/dist/esm/{griditem.taro-8020b409.js → griditem.taro-edb212e3.js} +2 -2
- package/dist/esm/imagepreview.taro-dae0757b.js +257 -0
- package/dist/esm/{infiniteloading.taro-0a86819e.js → infiniteloading.taro-067759de.js} +2 -2
- package/dist/esm/{input.taro-1d23861d.js → input.taro-505632ac.js} +2 -2
- package/dist/esm/{inputnumber.taro-75662231.js → inputnumber.taro-102203f3.js} +1 -1
- package/dist/esm/{menuitem.taro-56bf3205.js → menuitem.taro-0d8f50f9.js} +7 -7
- package/dist/esm/{navbar.taro-f2eae6a6.js → navbar.taro-2e969a0f.js} +1 -1
- package/dist/esm/{noticebar.taro-1890c693.js → noticebar.taro-f8bb6ae8.js} +1 -1
- package/dist/esm/{numberkeyboard.taro-5d685c76.js → numberkeyboard.taro-cf7d06f4.js} +2 -2
- package/dist/esm/nutui-react.es.js +66 -70
- package/dist/esm/{overlay-ed3eb37d.js → overlay.taro-be45fed5.js} +0 -0
- package/dist/esm/{pagination.taro-10449c4a.js → pagination.taro-62bbd23f.js} +1 -1
- package/dist/esm/picker.taro-62ce13e0.js +633 -0
- package/dist/esm/{popover.taro-9b3da0fa.js → popover.taro-0afa7cfa.js} +2 -2
- package/dist/esm/{popup.taro-a89dd3a1.js → popup.taro-8363fbae.js} +2 -2
- package/dist/esm/{progress.taro-dd93ac38.js → progress.taro-32ca3a69.js} +1 -1
- package/dist/esm/pulltorefresh.taro-8846f019.js +366 -0
- package/dist/esm/{radio.taro-32cb0172.js → radio.taro-1c63512f.js} +2 -2
- package/dist/esm/{radiogroup-e698d3df.js → radiogroup.taro-b5dad516.js} +0 -0
- package/dist/esm/{range.taro-fe08c5f4.js → range.taro-ef3b30f0.js} +2 -119
- package/dist/esm/{rate.taro-a0b21714.js → rate.taro-bb2e6c87.js} +1 -1
- package/dist/esm/{searchbar.taro-450d2f88.js → searchbar.taro-81867286.js} +2 -2
- package/dist/esm/{shortpassword.taro-08a05360.js → shortpassword.taro-2db97cc8.js} +3 -3
- package/dist/esm/{sidenavbar.taro-dd471476.js → sidenavbar.taro-e243b626.js} +2 -2
- package/dist/esm/{signature.taro-7cb77bab.js → signature.taro-e7369db8.js} +2 -2
- package/dist/esm/skeleton.taro-c19acc4e.js +109 -0
- package/dist/esm/{swiper.taro-7a2ef124.js → swiper.taro-448cd0ad.js} +56 -41
- package/dist/esm/{tabbaritem.taro-a88d3ae7.js → tabbaritem.taro-d0f2cec9.js} +1 -1
- package/dist/esm/{table.taro-305e0317.js → table.taro-25aeccba.js} +2 -2
- package/dist/esm/{tabs.taro-d1e85ea5.js → tabs.taro-d6006610.js} +1 -1
- package/dist/esm/{tag.taro-3bbbb557.js → tag.taro-ce9c52cd.js} +1 -1
- package/dist/esm/{textarea.taro-700b04c2.js → textarea.taro-388d1f90.js} +1 -1
- package/dist/esm/{timedetail.taro-7cc00243.js → timedetail.taro-519808cf.js} +1 -1
- package/dist/esm/{timepannel.taro-e24537e4.js → timepannel.taro-9904f6e6.js} +1 -1
- package/dist/esm/{timeselect.taro-210fd548.js → timeselect.taro-eea8d569.js} +16 -111
- package/dist/esm/{Notification-422905bd.js → toast.taro-d4ecd6af.js} +115 -1
- package/dist/esm/{uploader.taro-f7528535.js → uploader.taro-b232b2d3.js} +1 -1
- package/dist/esm/{virtuallist.taro-ce9619f9.js → virtuallist.taro-6858f690.js} +1 -1
- package/dist/esm/{zh-CN-91090ae2.js → zh-CN-14165629.js} +6 -0
- package/dist/locales/base.d.ts +6 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +7 -1
- package/dist/locales/id-ID.js +7 -1
- package/dist/locales/zh-CN.js +7 -1
- package/dist/locales/zh-TW.js +7 -1
- package/dist/nutui.react.es.js +14229 -14812
- package/dist/nutui.react.umd.js +14236 -14818
- package/dist/packages/actionsheet/actionsheet.scss +2 -0
- package/dist/packages/elevator/elevator.scss +1 -0
- package/dist/packages/pulltorefresh/pulltorefresh.scss +18 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +1 -0
- package/dist/types/actionsheet/actionsheet.taro.d.ts +2 -2
- package/dist/types/checkbox/checkbox.taro.d.ts +1 -1
- package/dist/types/elevator/elevator.taro.d.ts +2 -2
- package/dist/types/nutui.react.d.ts +3 -1
- package/dist/types/picker/pickerSlot.taro.d.ts +16 -0
- package/dist/types/popup/popup.taro.d.ts +1 -1
- package/dist/types/pulltorefresh/index.taro.d.ts +2 -0
- package/dist/types/pulltorefresh/pulltorefresh.taro.d.ts +18 -0
- package/dist/types/radio/radio.taro.d.ts +1 -1
- package/dist/types/radiogroup/index.taro.d.ts +1 -1
- package/dist/types/radiogroup/radiogroup.taro.d.ts +11 -0
- package/dist/types/timeselect/timeselect.taro.d.ts +1 -1
- package/package.json +2 -3
- package/dist/esm/button.taro-d5968f9d.js +0 -109
- package/dist/esm/card.taro-0861c7b3.js +0 -265
- package/dist/esm/checkbox.taro-6fbc4b3c.js +0 -255
- package/dist/esm/imagepreview.taro-a0ddd8a2.js +0 -813
- package/dist/esm/overlay.taro-a784329e.js +0 -94
- package/dist/esm/picker.taro-216cc3cb.js +0 -264
- package/dist/esm/pickerSlot-f8e4e542.js +0 -248
- package/dist/esm/popup-67173ec6.js +0 -217
- package/dist/esm/skeleton.taro-5934c7d7.js +0 -245
- package/dist/esm/toast.taro-bb181833.js +0 -122
package/dist/style.es.js
CHANGED
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
@import '../../packages/switch/switch.scss';
|
|
54
54
|
@import '../../packages/toast/toast.scss';
|
|
55
55
|
@import '../../packages/swipe/swipe.scss';
|
|
56
|
+
@import '../../packages/pulltorefresh/pulltorefresh.scss';
|
|
56
57
|
@import '../../packages/circleprogress/circleprogress.scss';
|
|
57
58
|
@import '../../packages/noticebar/noticebar.scss';
|
|
58
59
|
@import '../../packages/steps/steps.scss';
|
|
@@ -11,8 +11,8 @@ export interface ActionSheetProps {
|
|
|
11
11
|
color: string;
|
|
12
12
|
description: string;
|
|
13
13
|
menuItems: ItemType<string | boolean>[];
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
onChoose: (item: any, index: number) => void;
|
|
16
16
|
visible: boolean;
|
|
17
17
|
className: string;
|
|
18
18
|
style: React.CSSProperties;
|
|
@@ -10,8 +10,8 @@ export interface ElevatorProps {
|
|
|
10
10
|
className: string;
|
|
11
11
|
style: React.CSSProperties;
|
|
12
12
|
children: React.ReactNode;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
onClickItem: (key: string, item: ElevatorData) => void;
|
|
14
|
+
onClickIndex: (key: string) => void;
|
|
15
15
|
}
|
|
16
16
|
interface ElevatorData {
|
|
17
17
|
name: string;
|
|
@@ -52,6 +52,7 @@ import Notify from './notify/index.taro';
|
|
|
52
52
|
import Switch from './switch/index.taro';
|
|
53
53
|
import Toast from './toast/index.taro';
|
|
54
54
|
import Swipe from './swipe/index.taro';
|
|
55
|
+
import PullToRefresh from './pulltorefresh/index.taro';
|
|
55
56
|
import CircleProgress from './circleprogress/index.taro';
|
|
56
57
|
import NoticeBar from './noticebar/index.taro';
|
|
57
58
|
import Steps from './steps/index.taro';
|
|
@@ -83,7 +84,7 @@ import Card from './card/index.taro';
|
|
|
83
84
|
import TimePannel from './timepannel/index.taro';
|
|
84
85
|
import TimeDetail from './timedetail/index.taro';
|
|
85
86
|
import TimeSelect from './timeselect/index.taro';
|
|
86
|
-
export { Button, Cell, CellGroup, Icon, Overlay, Popup, ConfigProvider, Layout, Col, Row, Divider, Grid, GridItem, NavBar, FixedNav, Tabbar, TabbarItem, Elevator, Pagination, Tabs, TabPane, Indicator, SideNavBar, SubSideNavBar, SideNavBarItem, Menu, MenuItem, Range, Calendar, Checkbox, CheckboxGroup, DatePicker, InputNumber, Input, Radio, RadioGroup, Rate, CalendarItem, Picker, ShortPassword, TextArea, Uploader, Cascader, SearchBar, NumberKeyboard, ActionSheet, BackTop, Drag, Dialog, Infiniteloading, Notify, Switch, Toast, Swipe, CircleProgress, NoticeBar, Steps, Step, Swiper, SwiperItem, Avatar, AvatarGroup, Price, Badge, Tag, Popover, Skeleton, CountDown, Collapse, CollapseItem, AnimatingNumbers, Empty, VirtualList, Table, Video, Progress, Audio, ImagePreview, Address, Barrage, Signature, Card, TimePannel, TimeDetail, TimeSelect };
|
|
87
|
+
export { Button, Cell, CellGroup, Icon, Overlay, Popup, ConfigProvider, Layout, Col, Row, Divider, Grid, GridItem, NavBar, FixedNav, Tabbar, TabbarItem, Elevator, Pagination, Tabs, TabPane, Indicator, SideNavBar, SubSideNavBar, SideNavBarItem, Menu, MenuItem, Range, Calendar, Checkbox, CheckboxGroup, DatePicker, InputNumber, Input, Radio, RadioGroup, Rate, CalendarItem, Picker, ShortPassword, TextArea, Uploader, Cascader, SearchBar, NumberKeyboard, ActionSheet, BackTop, Drag, Dialog, Infiniteloading, Notify, Switch, Toast, Swipe, PullToRefresh, CircleProgress, NoticeBar, Steps, Step, Swiper, SwiperItem, Avatar, AvatarGroup, Price, Badge, Tag, Popover, Skeleton, CountDown, Collapse, CollapseItem, AnimatingNumbers, Empty, VirtualList, Table, Video, Progress, Audio, ImagePreview, Address, Barrage, Signature, Card, TimePannel, TimeDetail, TimeSelect };
|
|
87
88
|
|
|
88
89
|
export type { ButtonProps } from './button/button.taro';
|
|
89
90
|
export type { CellProps } from './cell/cell.taro';
|
|
@@ -139,6 +140,7 @@ export type { NotifyProps } from './notify/notify.taro';
|
|
|
139
140
|
export type { SwitchProps } from './switch/switch.taro';
|
|
140
141
|
export type { ToastProps } from './toast/toast.taro';
|
|
141
142
|
export type { SwipeProps } from './swipe/swipe.taro';
|
|
143
|
+
export type { PullToRefreshProps } from './pulltorefresh/pulltorefresh.taro';
|
|
142
144
|
export type { CircleProgressProps } from './circleprogress/circleprogress.taro';
|
|
143
145
|
export type { NoticeBarProps } from './noticebar/noticebar.taro';
|
|
144
146
|
export type { StepsProps } from './steps/steps.taro';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PickerOption } from './picker.taro';
|
|
3
|
+
interface IPickerSlotProps {
|
|
4
|
+
keyIndex?: number;
|
|
5
|
+
defaultValue?: string | number;
|
|
6
|
+
listData?: PickerOption[];
|
|
7
|
+
threeDimensional: boolean;
|
|
8
|
+
swipeDuration: number | string;
|
|
9
|
+
itemShow: boolean;
|
|
10
|
+
chooseItem?: (val: PickerOption, idx: number) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const PickerSlot: React.ForwardRefExoticComponent<Partial<IPickerSlotProps> & React.RefAttributes<{
|
|
13
|
+
stopMomentum: () => void;
|
|
14
|
+
moving: boolean;
|
|
15
|
+
}>>;
|
|
16
|
+
export default PickerSlot;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent, MouseEvent } from 'react';
|
|
2
|
-
import { OverlayProps } from '../overlay/overlay';
|
|
2
|
+
import { OverlayProps } from '../overlay/overlay.taro';
|
|
3
3
|
declare type Teleport = HTMLElement | (() => HTMLElement) | null;
|
|
4
4
|
export interface PopupProps extends OverlayProps {
|
|
5
5
|
position: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
export declare type PullStatus = 'pulling' | 'canRelease' | 'refreshing' | 'complete';
|
|
3
|
+
export interface PullToRefreshProps {
|
|
4
|
+
className: string;
|
|
5
|
+
style: React.CSSProperties;
|
|
6
|
+
onRefresh: () => Promise<any>;
|
|
7
|
+
pullingText: ReactNode;
|
|
8
|
+
canReleaseText: ReactNode;
|
|
9
|
+
refreshingText: ReactNode;
|
|
10
|
+
completeText: ReactNode;
|
|
11
|
+
completeDelay: number;
|
|
12
|
+
headHeight: number;
|
|
13
|
+
threshold: number;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
renderText: (status: PullStatus) => ReactNode;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare const PullToRefresh: FunctionComponent<Partial<PullToRefreshProps>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent, MouseEventHandler } from 'react';
|
|
2
|
-
import RadioGroup from '../radiogroup';
|
|
2
|
+
import RadioGroup from '../radiogroup/index.taro';
|
|
3
3
|
declare type Shape = 'button' | 'round';
|
|
4
4
|
declare type Position = 'right' | 'left';
|
|
5
5
|
export interface RadioProps {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RadioGroup } from './radiogroup';
|
|
1
|
+
import { RadioGroup } from './radiogroup.taro';
|
|
2
2
|
export default RadioGroup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Position = 'left' | 'right';
|
|
3
|
+
declare type Direction = 'horizontal' | 'vertical';
|
|
4
|
+
export interface RadioGroupProps {
|
|
5
|
+
value: string | number | boolean | null;
|
|
6
|
+
textPosition: Position;
|
|
7
|
+
direction: Direction;
|
|
8
|
+
onChange: (value: string | number | boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<Partial<RadioGroupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & React.RefAttributes<unknown>>;
|
|
11
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nutui/nutui-react-taro",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"style": "dist/style.css",
|
|
5
5
|
"main": "dist/nutui.react.umd.js",
|
|
6
6
|
"module": "dist/esm/nutui-react.es.js",
|
|
@@ -58,9 +58,8 @@
|
|
|
58
58
|
"prepare": "husky install",
|
|
59
59
|
"test": "jest",
|
|
60
60
|
"test:demo": "jest --testNamePattern=^should match snapshot$ --runTestsByPath ./src/packages/collapse/__test__/collapse.spec.tsx",
|
|
61
|
-
|
|
62
61
|
"generate:file:taro": "node scripts/taro/generate-nutui-taro.js",
|
|
63
|
-
"checked:taro":"npm run generate:file:taro && tsc --project ./tsconfig.taro.json",
|
|
62
|
+
"checked:taro": "npm run generate:file:taro && tsc --project ./tsconfig.taro.json",
|
|
64
63
|
"generate:file:taro:pages": "node scripts/taro/generate-taro-pages.js",
|
|
65
64
|
"dev:taro:weapp": "npm run checked:taro && npm run generate:file:taro:pages && cd ./src/sites/mobile-taro && npm run dev:weapp",
|
|
66
65
|
"replace:taro:types": "node scripts/taro/replace-taro-types-alias.js",
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["color", "shape", "plain", "loading", "disabled", "type", "size", "block", "icon", "children", "onClick", "className", "style"];
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
-
|
|
10
|
-
import React__default, { useCallback, useState, useEffect } from 'react';
|
|
11
|
-
import { I as Icon } from './icon-8dc4de10.js';
|
|
12
|
-
var defaultProps = {
|
|
13
|
-
className: '',
|
|
14
|
-
color: '',
|
|
15
|
-
shape: 'round',
|
|
16
|
-
plain: false,
|
|
17
|
-
loading: false,
|
|
18
|
-
disabled: false,
|
|
19
|
-
type: 'default',
|
|
20
|
-
size: 'normal',
|
|
21
|
-
block: false,
|
|
22
|
-
icon: '',
|
|
23
|
-
style: {},
|
|
24
|
-
children: undefined,
|
|
25
|
-
onClick: function onClick(e) {}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var Button = function Button(props) {
|
|
29
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
30
|
-
color = _defaultProps$props.color,
|
|
31
|
-
shape = _defaultProps$props.shape,
|
|
32
|
-
plain = _defaultProps$props.plain,
|
|
33
|
-
loading = _defaultProps$props.loading,
|
|
34
|
-
disabled = _defaultProps$props.disabled,
|
|
35
|
-
type = _defaultProps$props.type,
|
|
36
|
-
size = _defaultProps$props.size,
|
|
37
|
-
block = _defaultProps$props.block,
|
|
38
|
-
icon = _defaultProps$props.icon,
|
|
39
|
-
children = _defaultProps$props.children,
|
|
40
|
-
onClick = _defaultProps$props.onClick,
|
|
41
|
-
className = _defaultProps$props.className,
|
|
42
|
-
style = _defaultProps$props.style,
|
|
43
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
44
|
-
|
|
45
|
-
var getStyle = useCallback(function () {
|
|
46
|
-
var style = {};
|
|
47
|
-
|
|
48
|
-
if (color) {
|
|
49
|
-
if (plain) {
|
|
50
|
-
style.color = color;
|
|
51
|
-
style.background = '#fff';
|
|
52
|
-
|
|
53
|
-
if (!(color !== null && color !== void 0 && color.includes('gradient'))) {
|
|
54
|
-
style.borderColor = color;
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
style.color = '#fff';
|
|
58
|
-
style.background = color;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return style;
|
|
63
|
-
}, [color, plain]);
|
|
64
|
-
var classes = useCallback(function () {
|
|
65
|
-
var prefixCls = 'nut-button';
|
|
66
|
-
return [prefixCls, "".concat(type ? "".concat(prefixCls, "--").concat(type) : ''), "".concat(size ? "".concat(prefixCls, "--").concat(size) : ''), "".concat(shape ? "".concat(prefixCls, "--").concat(shape) : ''), "".concat(plain ? "".concat(prefixCls, "--plain") : ''), "".concat(block ? "".concat(prefixCls, "--block") : ''), "".concat(disabled ? "".concat(prefixCls, "--disabled") : ''), "".concat(loading ? "".concat(prefixCls, "--loading") : '')].filter(Boolean).join(' ');
|
|
67
|
-
}, [block, disabled, loading, plain, shape, size, type]);
|
|
68
|
-
|
|
69
|
-
var _useState = useState(classes()),
|
|
70
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
-
btnName = _useState2[0],
|
|
72
|
-
setBtnName = _useState2[1];
|
|
73
|
-
|
|
74
|
-
var _useState3 = useState(getStyle()),
|
|
75
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
76
|
-
btnStyle = _useState4[0],
|
|
77
|
-
setBtnStyle = _useState4[1];
|
|
78
|
-
|
|
79
|
-
useEffect(function () {
|
|
80
|
-
setBtnName(classes());
|
|
81
|
-
setBtnStyle(getStyle());
|
|
82
|
-
}, [className, color, shape, plain, loading, disabled, style, type, size, block, icon, children, onClick, classes, getStyle]);
|
|
83
|
-
|
|
84
|
-
var handleClick = function handleClick(e) {
|
|
85
|
-
if (!loading && !disabled && onClick) {
|
|
86
|
-
onClick(e);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return React__default.createElement("div", _objectSpread(_objectSpread({
|
|
91
|
-
className: "".concat(btnName, " ").concat(className),
|
|
92
|
-
style: _objectSpread(_objectSpread({}, btnStyle), style)
|
|
93
|
-
}, rest), {}, {
|
|
94
|
-
onClick: function onClick(e) {
|
|
95
|
-
return handleClick(e);
|
|
96
|
-
}
|
|
97
|
-
}), React__default.createElement("div", {
|
|
98
|
-
className: "nut-button__warp",
|
|
99
|
-
style: getStyle()
|
|
100
|
-
}, loading && React__default.createElement(Icon, {
|
|
101
|
-
name: "loading"
|
|
102
|
-
}), !loading && icon ? React__default.createElement(Icon, {
|
|
103
|
-
name: icon
|
|
104
|
-
}) : '', children));
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
Button.defaultProps = defaultProps;
|
|
108
|
-
Button.displayName = 'NutButton';
|
|
109
|
-
export { Button as B };
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["price", "needSymbol", "symbol", "decimalDigits", "thousands", "className"],
|
|
5
|
-
_excluded2 = ["className", "style", "imgUrl", "title", "price", "vipPrice", "shopDesc", "delivery", "shopName", "shopTagTpl", "originTpl", "prolistTpl", "footerTpl"];
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
import React__default, { useState, useEffect } from 'react';
|
|
12
|
-
import { c as cn } from './bem-893ad28d.js';
|
|
13
|
-
import { I as Icon } from './icon-8dc4de10.js';
|
|
14
|
-
var defaultProps$2 = {
|
|
15
|
-
price: 0,
|
|
16
|
-
needSymbol: true,
|
|
17
|
-
symbol: '¥',
|
|
18
|
-
decimalDigits: 2,
|
|
19
|
-
thousands: false,
|
|
20
|
-
className: ''
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var Price = function Price(props) {
|
|
24
|
-
var _defaultProps$2$props = _objectSpread(_objectSpread({}, defaultProps$2), props),
|
|
25
|
-
price = _defaultProps$2$props.price,
|
|
26
|
-
needSymbol = _defaultProps$2$props.needSymbol,
|
|
27
|
-
symbol = _defaultProps$2$props.symbol,
|
|
28
|
-
decimalDigits = _defaultProps$2$props.decimalDigits,
|
|
29
|
-
thousands = _defaultProps$2$props.thousands,
|
|
30
|
-
className = _defaultProps$2$props.className,
|
|
31
|
-
rest = _objectWithoutProperties(_defaultProps$2$props, _excluded);
|
|
32
|
-
|
|
33
|
-
var b = cn('price');
|
|
34
|
-
|
|
35
|
-
var replaceSpecialChar = function replaceSpecialChar(symbol) {
|
|
36
|
-
var desSymbol = symbol;
|
|
37
|
-
desSymbol = symbol.replace(/"/g, '"');
|
|
38
|
-
desSymbol = symbol.replace(/&/g, '&');
|
|
39
|
-
desSymbol = symbol.replace(/</g, '<');
|
|
40
|
-
desSymbol = symbol.replace(/>/g, '>');
|
|
41
|
-
desSymbol = symbol.replace(/ /g, ' ');
|
|
42
|
-
desSymbol = symbol.replace(/¥/g, '¥');
|
|
43
|
-
return desSymbol;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var showSymbol = function showSymbol() {
|
|
47
|
-
return {
|
|
48
|
-
__html: (needSymbol ? replaceSpecialChar(symbol) : '') || ''
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var checkPoint = function checkPoint(price) {
|
|
53
|
-
return String(price).indexOf('.') > 0;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
var formatThousands = function formatThousands(num) {
|
|
57
|
-
if (Number(num) === 0) {
|
|
58
|
-
num = 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (checkPoint(num)) {
|
|
62
|
-
num = Number(num).toFixed(decimalDigits);
|
|
63
|
-
num = typeof num.split('.') === 'string' ? num.split('.') : num.split('.')[0];
|
|
64
|
-
} else {
|
|
65
|
-
num = num.toString();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (thousands) {
|
|
69
|
-
return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return num;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
var formatDecimal = function formatDecimal(decimalNum) {
|
|
76
|
-
if (Number(decimalNum) === 0) {
|
|
77
|
-
decimalNum = 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (checkPoint(decimalNum)) {
|
|
81
|
-
decimalNum = Number(decimalNum).toFixed(decimalDigits);
|
|
82
|
-
decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1];
|
|
83
|
-
} else {
|
|
84
|
-
decimalNum = 0;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var result = "0.".concat(decimalNum);
|
|
88
|
-
var resultFixed = Number(result).toFixed(decimalDigits);
|
|
89
|
-
return String(resultFixed).substring(2, resultFixed.length);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return React__default.createElement("div", _objectSpread({
|
|
93
|
-
className: "".concat(b(), " ").concat(className)
|
|
94
|
-
}, rest), needSymbol ? React__default.createElement("div", {
|
|
95
|
-
className: "".concat(b('symbol')),
|
|
96
|
-
dangerouslySetInnerHTML: showSymbol()
|
|
97
|
-
}) : null, React__default.createElement("div", {
|
|
98
|
-
className: "".concat(b('big'))
|
|
99
|
-
}, formatThousands(price)), React__default.createElement("div", {
|
|
100
|
-
className: "".concat(b('point'))
|
|
101
|
-
}, "."), React__default.createElement("div", {
|
|
102
|
-
className: "".concat(b('small'))
|
|
103
|
-
}, formatDecimal(price)));
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
Price.defaultProps = defaultProps$2;
|
|
107
|
-
Price.displayName = 'NutPrice';
|
|
108
|
-
var defaultProps$1 = {
|
|
109
|
-
type: 'default',
|
|
110
|
-
color: '',
|
|
111
|
-
textColor: '',
|
|
112
|
-
plain: false,
|
|
113
|
-
round: false,
|
|
114
|
-
mark: false,
|
|
115
|
-
closeable: false,
|
|
116
|
-
prefixCls: 'nut-tag',
|
|
117
|
-
onClose: function onClose(e) {},
|
|
118
|
-
onClick: function onClick(e) {}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
var Tag = function Tag(props) {
|
|
122
|
-
var _defaultProps$1$props = _objectSpread(_objectSpread({}, defaultProps$1), props),
|
|
123
|
-
color = _defaultProps$1$props.color,
|
|
124
|
-
plain = _defaultProps$1$props.plain,
|
|
125
|
-
type = _defaultProps$1$props.type,
|
|
126
|
-
round = _defaultProps$1$props.round,
|
|
127
|
-
prefixCls = _defaultProps$1$props.prefixCls,
|
|
128
|
-
children = _defaultProps$1$props.children,
|
|
129
|
-
mark = _defaultProps$1$props.mark,
|
|
130
|
-
closeable = _defaultProps$1$props.closeable,
|
|
131
|
-
textColor = _defaultProps$1$props.textColor,
|
|
132
|
-
onClick = _defaultProps$1$props.onClick,
|
|
133
|
-
onClose = _defaultProps$1$props.onClose;
|
|
134
|
-
|
|
135
|
-
var _useState = useState(''),
|
|
136
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
137
|
-
btnName = _useState2[0],
|
|
138
|
-
setBtnName = _useState2[1];
|
|
139
|
-
|
|
140
|
-
var _useState3 = useState(true),
|
|
141
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
142
|
-
isTagShow = _useState4[0],
|
|
143
|
-
setIsTagShow = _useState4[1];
|
|
144
|
-
|
|
145
|
-
useEffect(function () {
|
|
146
|
-
setBtnName(classes());
|
|
147
|
-
}, [type, color, textColor, plain, round, mark, closeable, prefixCls, onClick, onClose]);
|
|
148
|
-
|
|
149
|
-
var classes = function classes() {
|
|
150
|
-
var prefixCls = 'nut-tag';
|
|
151
|
-
return "".concat(prefixCls, "\n ").concat(type ? "".concat(prefixCls, "--").concat(type) : '', "\n ").concat(plain ? "".concat(prefixCls, "--plain") : '', "\n ").concat(round ? "".concat(prefixCls, "--round") : '', "\n ").concat(mark ? "".concat(prefixCls, "--mark") : '', "\n ").concat(closeable ? "".concat(prefixCls, "--close") : '');
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
var handleClick = function handleClick(e) {
|
|
155
|
-
if (props.onClick) {
|
|
156
|
-
props.onClick(e);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
var getStyle = function getStyle() {
|
|
161
|
-
var style = {};
|
|
162
|
-
|
|
163
|
-
if (textColor) {
|
|
164
|
-
style.color = textColor;
|
|
165
|
-
|
|
166
|
-
if (plain) {
|
|
167
|
-
style.background = '#fff';
|
|
168
|
-
} else if (color) {
|
|
169
|
-
style.background = color;
|
|
170
|
-
}
|
|
171
|
-
} else if (color) {
|
|
172
|
-
style.color = '#fff';
|
|
173
|
-
style.background = color;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return style;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
return React__default.createElement("div", null, closeable ? isTagShow && React__default.createElement("div", {
|
|
180
|
-
className: "".concat(btnName),
|
|
181
|
-
style: getStyle(),
|
|
182
|
-
onClick: function onClick(e) {
|
|
183
|
-
return handleClick(e);
|
|
184
|
-
}
|
|
185
|
-
}, children && React__default.createElement("span", {
|
|
186
|
-
className: "text"
|
|
187
|
-
}, children), React__default.createElement(Icon, {
|
|
188
|
-
className: "_icon",
|
|
189
|
-
name: "close",
|
|
190
|
-
size: "12",
|
|
191
|
-
onClick: function onClick(e) {
|
|
192
|
-
setIsTagShow(false);
|
|
193
|
-
|
|
194
|
-
if (props.onClose) {
|
|
195
|
-
props.onClose(e);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
})) : React__default.createElement("div", {
|
|
199
|
-
className: "".concat(btnName),
|
|
200
|
-
style: getStyle(),
|
|
201
|
-
onClick: function onClick(e) {
|
|
202
|
-
return handleClick(e);
|
|
203
|
-
}
|
|
204
|
-
}, children && React__default.createElement("span", {
|
|
205
|
-
className: "text"
|
|
206
|
-
}, children)));
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
Tag.defaultProps = defaultProps$1;
|
|
210
|
-
Tag.displayName = 'NutTag';
|
|
211
|
-
var defaultProps = {};
|
|
212
|
-
|
|
213
|
-
var Card = function Card(props) {
|
|
214
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
215
|
-
className = _defaultProps$props.className,
|
|
216
|
-
style = _defaultProps$props.style,
|
|
217
|
-
imgUrl = _defaultProps$props.imgUrl,
|
|
218
|
-
title = _defaultProps$props.title,
|
|
219
|
-
price = _defaultProps$props.price,
|
|
220
|
-
vipPrice = _defaultProps$props.vipPrice,
|
|
221
|
-
shopDesc = _defaultProps$props.shopDesc,
|
|
222
|
-
delivery = _defaultProps$props.delivery,
|
|
223
|
-
shopName = _defaultProps$props.shopName,
|
|
224
|
-
shopTagTpl = _defaultProps$props.shopTagTpl,
|
|
225
|
-
originTpl = _defaultProps$props.originTpl,
|
|
226
|
-
prolistTpl = _defaultProps$props.prolistTpl,
|
|
227
|
-
footerTpl = _defaultProps$props.footerTpl,
|
|
228
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded2);
|
|
229
|
-
|
|
230
|
-
var b = cn('card');
|
|
231
|
-
return React__default.createElement("div", _objectSpread({
|
|
232
|
-
className: "".concat(b(), " ").concat(className),
|
|
233
|
-
style: style
|
|
234
|
-
}, rest), React__default.createElement("div", {
|
|
235
|
-
className: b('left')
|
|
236
|
-
}, React__default.createElement("img", {
|
|
237
|
-
src: imgUrl,
|
|
238
|
-
alt: ""
|
|
239
|
-
})), React__default.createElement("div", {
|
|
240
|
-
className: b('right')
|
|
241
|
-
}, React__default.createElement("div", {
|
|
242
|
-
className: b('right__title')
|
|
243
|
-
}, title), prolistTpl, React__default.createElement("div", {
|
|
244
|
-
className: b('right__price')
|
|
245
|
-
}, React__default.createElement(Price, {
|
|
246
|
-
price: price
|
|
247
|
-
}), originTpl || React__default.createElement(Price, {
|
|
248
|
-
className: b('right__price__origin'),
|
|
249
|
-
price: vipPrice
|
|
250
|
-
})), React__default.createElement("div", {
|
|
251
|
-
className: b('right__other')
|
|
252
|
-
}, shopTagTpl || React__default.createElement(React__default.Fragment, null, React__default.createElement(Tag, {
|
|
253
|
-
type: "danger"
|
|
254
|
-
}, shopDesc), React__default.createElement(Tag, {
|
|
255
|
-
plain: true
|
|
256
|
-
}, delivery))), React__default.createElement("div", {
|
|
257
|
-
className: b('right__shop')
|
|
258
|
-
}, React__default.createElement("div", {
|
|
259
|
-
className: b('right__shop__name')
|
|
260
|
-
}, shopName), footerTpl)));
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
Card.defaultProps = defaultProps;
|
|
264
|
-
Card.displayName = 'NutCard';
|
|
265
|
-
export { Card as C };
|