@bifrostui/react 1.4.8-beta.0 → 2.0.0-beta.1
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/dist/ActionSheet/ActionSheet.css +2 -2
- package/dist/ActionSheet/ActionSheetItem.js +3 -8
- package/dist/Avatar/Avatar.js +3 -8
- package/dist/Avatar/AvatarGroup.js +2 -6
- package/dist/Badge/Badge.js +3 -8
- package/dist/Button/Button.css +77 -78
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.js +4 -10
- package/dist/Button/Button.types.d.ts +8 -7
- package/dist/Calendar/Calendar.js +7 -19
- package/dist/Calendar/Calendar.types.d.ts +0 -5
- package/dist/Card/Card.css +1 -1
- package/dist/Card/CardContent.css +1 -2
- package/dist/Card/CardFooter.css +2 -4
- package/dist/Card/CardHeader.css +4 -5
- package/dist/Checkbox/Checkbox.js +2 -6
- package/dist/Checkbox/CheckboxGroup.js +4 -7
- package/dist/Collapse/Collapse.css +1 -0
- package/dist/Collapse/Collapse.d.ts +1 -1
- package/dist/Collapse/Collapse.js +8 -11
- package/dist/CollapsePanel/CollapsePanel.css +2 -4
- package/dist/CollapsePanel/CollapsePanelItem.js +45 -46
- package/dist/Countdown/Countdown.js +5 -12
- package/dist/Dialog/FunctionalDialog.js +1 -1
- package/dist/Divider/Divider.js +8 -5
- package/dist/Drawer/Drawer.js +4 -10
- package/dist/Fade/Fade.js +52 -56
- package/dist/IconButton/IconButton.js +5 -12
- package/dist/Image/Image.js +112 -119
- package/dist/Input/Input.js +4 -10
- package/dist/List/List.js +3 -8
- package/dist/List/ListItem.js +42 -44
- package/dist/List/ListItemContent.js +1 -4
- package/dist/List/ListItemExtra.js +9 -4
- package/dist/List/ListItemFooter.js +9 -4
- package/dist/List/ListItemHeader.js +9 -4
- package/dist/Loading/Loading.js +13 -4
- package/dist/Modal/Modal.js +0 -6
- package/dist/Modal/Modal.miniapp.js +4 -10
- package/dist/NavBar/NavBar.js +0 -1
- package/dist/Picker/Picker.css +0 -5
- package/dist/Picker/Picker.js +5 -27
- package/dist/Picker/Picker.types.d.ts +2 -15
- package/dist/Picker/PickerPanel.css +0 -4
- package/dist/Picker/PickerPanel.js +6 -7
- package/dist/Popover/Popover.css +5 -5
- package/dist/Popover/Popover.js +27 -70
- package/dist/Portal/Portal.miniapp.js +4 -7
- package/dist/Radio/Radio.css +0 -1
- package/dist/Radio/Radio.js +2 -6
- package/dist/Radio/RadioGroup.js +0 -3
- package/dist/Rating/Rating.js +8 -18
- package/dist/ScrollView/ScrollView.js +11 -24
- package/dist/ScrollView/ScrollView.types.d.ts +1 -0
- package/dist/Select/Select.css +4 -1
- package/dist/Select/Select.js +41 -68
- package/dist/Skeleton/Skeleton.js +5 -9
- package/dist/Slide/Slide.js +69 -74
- package/dist/Slider/Slider.js +11 -27
- package/dist/Steps/Step.js +81 -82
- package/dist/Steps/Steps.d.ts +1 -1
- package/dist/Steps/Steps.js +57 -60
- package/dist/Switch/Switch.js +75 -78
- package/dist/TabBar/TabBar.js +3 -8
- package/dist/Tabs/Tab.css +10 -16
- package/dist/Tabs/Tab.js +2 -3
- package/dist/Tabs/Tabs.css +13 -22
- package/dist/Tabs/Tabs.js +39 -70
- package/dist/Tabs/Tabs.types.d.ts +0 -10
- package/dist/Tabs/utils/bound.d.ts +1 -0
- package/dist/{DesktopPicker/utils/calcAfterMounted.js → Tabs/utils/bound.js} +14 -7
- package/dist/Tag/Tag.css +1 -1
- package/dist/Tag/Tag.js +2 -6
- package/dist/TextArea/TextArea.js +5 -12
- package/dist/Toast/FunctionalToast.js +1 -1
- package/dist/Toast/Toast.css +1 -0
- package/dist/Tooltip/Tooltip.css +5 -5
- package/dist/Tooltip/Tooltip.js +27 -70
- package/dist/Transition/TransitionCore.js +3 -8
- package/dist/index.d.ts +0 -6
- package/dist/index.js +1 -13
- package/dist/locales/base.d.ts +0 -11
- package/dist/locales/en-US.js +0 -24
- package/dist/locales/zh-CN.js +0 -24
- package/dist/locales/zh-TW.js +0 -24
- package/es/ActionSheet/ActionSheet.css +2 -2
- package/es/ActionSheet/ActionSheetItem.js +3 -8
- package/es/Avatar/Avatar.js +3 -8
- package/es/Avatar/AvatarGroup.js +2 -6
- package/es/Badge/Badge.js +3 -8
- package/es/Button/Button.css +77 -78
- package/es/Button/Button.d.ts +1 -1
- package/es/Button/Button.js +3 -9
- package/es/Button/Button.types.d.ts +8 -7
- package/es/Calendar/Calendar.js +7 -19
- package/es/Calendar/Calendar.types.d.ts +0 -5
- package/es/Card/Card.css +1 -1
- package/es/Card/CardContent.css +1 -2
- package/es/Card/CardFooter.css +2 -4
- package/es/Card/CardHeader.css +4 -5
- package/es/Checkbox/Checkbox.js +2 -6
- package/es/Checkbox/CheckboxGroup.js +4 -7
- package/es/Collapse/Collapse.css +1 -0
- package/es/Collapse/Collapse.d.ts +1 -1
- package/es/Collapse/Collapse.js +8 -11
- package/es/CollapsePanel/CollapsePanel.css +2 -4
- package/es/CollapsePanel/CollapsePanelItem.js +45 -46
- package/es/Countdown/Countdown.js +5 -12
- package/es/Dialog/FunctionalDialog.js +2 -2
- package/es/Divider/Divider.js +8 -5
- package/es/Drawer/Drawer.js +4 -10
- package/es/Fade/Fade.js +52 -56
- package/es/IconButton/IconButton.js +5 -12
- package/es/Image/Image.js +112 -119
- package/es/Input/Input.js +4 -10
- package/es/List/List.js +3 -8
- package/es/List/ListItem.js +42 -44
- package/es/List/ListItemContent.js +1 -4
- package/es/List/ListItemExtra.js +9 -4
- package/es/List/ListItemFooter.js +9 -4
- package/es/List/ListItemHeader.js +9 -4
- package/es/Loading/Loading.js +13 -4
- package/es/Modal/Modal.js +0 -6
- package/es/Modal/Modal.miniapp.d.ts +1 -1
- package/es/Modal/Modal.miniapp.js +4 -10
- package/es/NavBar/NavBar.js +0 -1
- package/es/Picker/Picker.css +0 -5
- package/es/Picker/Picker.js +5 -27
- package/es/Picker/Picker.types.d.ts +2 -15
- package/es/Picker/PickerPanel.css +0 -4
- package/es/Picker/PickerPanel.js +6 -7
- package/es/Popover/Popover.css +5 -5
- package/es/Popover/Popover.js +29 -73
- package/es/Portal/Portal.miniapp.js +5 -8
- package/es/Radio/Radio.css +0 -1
- package/es/Radio/Radio.js +2 -6
- package/es/Radio/RadioGroup.js +0 -3
- package/es/Rating/Rating.js +8 -18
- package/es/ScrollView/ScrollView.js +11 -24
- package/es/ScrollView/ScrollView.types.d.ts +1 -0
- package/es/Select/Select.css +4 -1
- package/es/Select/Select.js +42 -68
- package/es/Skeleton/Skeleton.js +5 -9
- package/es/Slide/Slide.js +69 -74
- package/es/Slider/Slider.js +12 -30
- package/es/Steps/Step.js +81 -82
- package/es/Steps/Steps.d.ts +1 -1
- package/es/Steps/Steps.js +57 -60
- package/es/Switch/Switch.js +75 -78
- package/es/TabBar/TabBar.js +3 -8
- package/es/Tabs/Tab.css +10 -16
- package/es/Tabs/Tab.js +2 -3
- package/es/Tabs/Tabs.css +13 -22
- package/es/Tabs/Tabs.js +41 -83
- package/es/Tabs/Tabs.types.d.ts +0 -10
- package/es/Tabs/utils/bound.d.ts +1 -0
- package/es/Tabs/utils/bound.js +13 -0
- package/es/Tag/Tag.css +1 -1
- package/es/Tag/Tag.js +2 -6
- package/es/TextArea/TextArea.js +5 -12
- package/es/Toast/FunctionalToast.js +2 -2
- package/es/Toast/Toast.css +1 -0
- package/es/Tooltip/Tooltip.css +5 -5
- package/es/Tooltip/Tooltip.js +29 -73
- package/es/Transition/TransitionCore.js +3 -8
- package/es/index.d.ts +0 -6
- package/es/index.js +0 -6
- package/es/locales/base.d.ts +0 -11
- package/es/locales/en-US.js +0 -24
- package/es/locales/zh-CN.js +0 -24
- package/es/locales/zh-TW.js +0 -24
- package/package.json +6 -6
- package/dist/Collapse/Collapse.miniapp.d.ts +0 -5
- package/dist/Collapse/Collapse.miniapp.js +0 -177
- package/dist/DatePicker/DatePicker.d.ts +0 -4
- package/dist/DatePicker/DatePicker.js +0 -335
- package/dist/DatePicker/DatePicker.types.d.ts +0 -36
- package/dist/DatePicker/DatePicker.types.js +0 -15
- package/dist/DatePicker/constants.d.ts +0 -9
- package/dist/DatePicker/constants.js +0 -37
- package/dist/DatePicker/index.d.ts +0 -3
- package/dist/DatePicker/index.js +0 -44
- package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
- package/dist/DesktopDatePicker/DesktopDatePicker.js +0 -280
- package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
- package/dist/DesktopDatePicker/DesktopDatePicker.types.js +0 -15
- package/dist/DesktopDatePicker/deskTopPickerContainer.css +0 -100
- package/dist/DesktopDatePicker/index.css +0 -61
- package/dist/DesktopDatePicker/index.d.ts +0 -2
- package/dist/DesktopDatePicker/index.js +0 -41
- package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
- package/dist/DesktopDatePicker/useGetDatePickerContent.js +0 -343
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -322
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -15
- package/dist/DesktopDateTimePicker/index.css +0 -66
- package/dist/DesktopDateTimePicker/index.d.ts +0 -2
- package/dist/DesktopDateTimePicker/index.js +0 -41
- package/dist/DesktopPicker/DesktopPicker.d.ts +0 -5
- package/dist/DesktopPicker/DesktopPicker.js +0 -238
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +0 -57
- package/dist/DesktopPicker/DesktopPicker.types.js +0 -15
- package/dist/DesktopPicker/index.css +0 -37
- package/dist/DesktopPicker/index.d.ts +0 -2
- package/dist/DesktopPicker/index.js +0 -41
- package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -38
- package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
- package/dist/DesktopTimePicker/DesktopTimePicker.js +0 -288
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
- package/dist/DesktopTimePicker/DesktopTimePicker.types.js +0 -15
- package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
- package/dist/DesktopTimePicker/DesktopTimePickerList.js +0 -111
- package/dist/DesktopTimePicker/index.css +0 -170
- package/dist/DesktopTimePicker/index.d.ts +0 -2
- package/dist/DesktopTimePicker/index.js +0 -41
- package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +0 -249
- package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
- package/dist/DesktopTimePicker/utils/scrollUtil.js +0 -27
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -51
- package/dist/DesktopTimePicker/utils/utils.d.ts +0 -28
- package/dist/DesktopTimePicker/utils/utils.js +0 -408
- package/dist/SwipeAction/SwipeAction.css +0 -79
- package/dist/SwipeAction/SwipeAction.d.ts +0 -5
- package/dist/SwipeAction/SwipeAction.js +0 -349
- package/dist/SwipeAction/SwipeAction.types.d.ts +0 -75
- package/dist/SwipeAction/SwipeAction.types.js +0 -15
- package/dist/SwipeAction/SwipeActionContext.d.ts +0 -4
- package/dist/SwipeAction/SwipeActionContext.js +0 -30
- package/dist/SwipeAction/SwipeActionItem.css +0 -31
- package/dist/SwipeAction/SwipeActionItem.d.ts +0 -5
- package/dist/SwipeAction/SwipeActionItem.js +0 -105
- package/dist/SwipeAction/constants.d.ts +0 -9
- package/dist/SwipeAction/constants.js +0 -39
- package/dist/SwipeAction/index.d.ts +0 -5
- package/dist/SwipeAction/index.js +0 -50
- package/dist/Tabs/utils/scroll.d.ts +0 -2
- package/dist/Tabs/utils/scroll.js +0 -55
- package/es/Collapse/Collapse.miniapp.d.ts +0 -5
- package/es/Collapse/Collapse.miniapp.js +0 -157
- package/es/DatePicker/DatePicker.d.ts +0 -4
- package/es/DatePicker/DatePicker.js +0 -308
- package/es/DatePicker/DatePicker.types.d.ts +0 -36
- package/es/DatePicker/DatePicker.types.js +0 -1
- package/es/DatePicker/constants.d.ts +0 -9
- package/es/DatePicker/constants.js +0 -14
- package/es/DatePicker/index.d.ts +0 -3
- package/es/DatePicker/index.js +0 -8
- package/es/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
- package/es/DesktopDatePicker/DesktopDatePicker.js +0 -253
- package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
- package/es/DesktopDatePicker/DesktopDatePicker.types.js +0 -1
- package/es/DesktopDatePicker/deskTopPickerContainer.css +0 -100
- package/es/DesktopDatePicker/index.css +0 -61
- package/es/DesktopDatePicker/index.d.ts +0 -2
- package/es/DesktopDatePicker/index.js +0 -6
- package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
- package/es/DesktopDatePicker/useGetDatePickerContent.js +0 -316
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -295
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -1
- package/es/DesktopDateTimePicker/index.css +0 -66
- package/es/DesktopDateTimePicker/index.d.ts +0 -2
- package/es/DesktopDateTimePicker/index.js +0 -9
- package/es/DesktopPicker/DesktopPicker.d.ts +0 -5
- package/es/DesktopPicker/DesktopPicker.js +0 -221
- package/es/DesktopPicker/DesktopPicker.types.d.ts +0 -57
- package/es/DesktopPicker/DesktopPicker.types.js +0 -1
- package/es/DesktopPicker/index.css +0 -37
- package/es/DesktopPicker/index.d.ts +0 -2
- package/es/DesktopPicker/index.js +0 -6
- package/es/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
- package/es/DesktopPicker/utils/calcAfterMounted.js +0 -6
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -9
- package/es/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
- package/es/DesktopTimePicker/DesktopTimePicker.js +0 -261
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
- package/es/DesktopTimePicker/DesktopTimePicker.types.js +0 -1
- package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
- package/es/DesktopTimePicker/DesktopTimePickerList.js +0 -84
- package/es/DesktopTimePicker/index.css +0 -170
- package/es/DesktopTimePicker/index.d.ts +0 -2
- package/es/DesktopTimePicker/index.js +0 -6
- package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
- package/es/DesktopTimePicker/useGetTimePickerContent.js +0 -226
- package/es/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
- package/es/DesktopTimePicker/utils/scrollUtil.js +0 -8
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -22
- package/es/DesktopTimePicker/utils/utils.d.ts +0 -28
- package/es/DesktopTimePicker/utils/utils.js +0 -365
- package/es/SwipeAction/SwipeAction.css +0 -79
- package/es/SwipeAction/SwipeAction.d.ts +0 -5
- package/es/SwipeAction/SwipeAction.js +0 -334
- package/es/SwipeAction/SwipeAction.types.d.ts +0 -75
- package/es/SwipeAction/SwipeAction.types.js +0 -1
- package/es/SwipeAction/SwipeActionContext.d.ts +0 -4
- package/es/SwipeAction/SwipeActionContext.js +0 -11
- package/es/SwipeAction/SwipeActionItem.css +0 -31
- package/es/SwipeAction/SwipeActionItem.d.ts +0 -5
- package/es/SwipeAction/SwipeActionItem.js +0 -78
- package/es/SwipeAction/constants.d.ts +0 -9
- package/es/SwipeAction/constants.js +0 -15
- package/es/SwipeAction/index.d.ts +0 -5
- package/es/SwipeAction/index.js +0 -12
- package/es/Tabs/utils/scroll.d.ts +0 -2
- package/es/Tabs/utils/scroll.js +0 -36
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
:root,
|
|
2
|
-
page,
|
|
3
|
-
xhs-page {
|
|
4
|
-
--bui-swipe-action-container-padding: 10px;
|
|
5
|
-
--bui-swipe-action-container-color: var(--bui-color-black);
|
|
6
|
-
}
|
|
7
|
-
.bui-swipe-action {
|
|
8
|
-
background: var(--bui-color-bg-view);
|
|
9
|
-
font-family: var(--bui-font-family);
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
touch-action: pan-x;
|
|
12
|
-
}
|
|
13
|
-
.bui-swipe-action-track {
|
|
14
|
-
position: relative;
|
|
15
|
-
transition: transform 200ms ease;
|
|
16
|
-
}
|
|
17
|
-
.bui-swipe-action-actions {
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 0;
|
|
20
|
-
display: flex;
|
|
21
|
-
width: auto;
|
|
22
|
-
white-space: nowrap;
|
|
23
|
-
}
|
|
24
|
-
.bui-swipe-action-actions-right {
|
|
25
|
-
left: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
margin-left: 1px;
|
|
29
|
-
user-select: none;
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
box-sizing: content-box;
|
|
33
|
-
}
|
|
34
|
-
.bui-swipe-action-actions-left {
|
|
35
|
-
margin-right: 1px;
|
|
36
|
-
right: 100%;
|
|
37
|
-
height: 100%;
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
box-sizing: content-box;
|
|
40
|
-
user-select: none;
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
}
|
|
44
|
-
.bui-swipe-action-button {
|
|
45
|
-
padding: 0 15px;
|
|
46
|
-
display: flex;
|
|
47
|
-
align-items: center;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
height: 100%;
|
|
50
|
-
width: 100%;
|
|
51
|
-
color: #fff;
|
|
52
|
-
box-sizing: content-box;
|
|
53
|
-
white-space: nowrap;
|
|
54
|
-
}
|
|
55
|
-
.bui-swipe-action-content-container {
|
|
56
|
-
overflow: hidden;
|
|
57
|
-
position: relative;
|
|
58
|
-
cursor: grab;
|
|
59
|
-
user-select: none;
|
|
60
|
-
padding: var(--bui-swipe-action-container-padding);
|
|
61
|
-
color: var(--bui-swipe-action-container-color);
|
|
62
|
-
}
|
|
63
|
-
.bui-swipe-action-content-container:active {
|
|
64
|
-
cursor: grabbing;
|
|
65
|
-
}
|
|
66
|
-
.bui-swipe-action-content-mask {
|
|
67
|
-
position: absolute;
|
|
68
|
-
left: 0;
|
|
69
|
-
top: 0;
|
|
70
|
-
width: 100%;
|
|
71
|
-
height: 100%;
|
|
72
|
-
}
|
|
73
|
-
.bui-swipe-action-action {
|
|
74
|
-
display: flex;
|
|
75
|
-
align-items: center;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
padding: 0 10px;
|
|
78
|
-
height: 100%;
|
|
79
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SwipeActionProps, SwipeActionRef } from './SwipeAction.types';
|
|
3
|
-
import './SwipeAction.less';
|
|
4
|
-
declare const SwipeAction: React.ForwardRefExoticComponent<Omit<SwipeActionProps<"div", {}>, "ref"> & React.RefAttributes<SwipeActionRef>>;
|
|
5
|
-
export default SwipeAction;
|
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __objRest = (source, exclude) => {
|
|
18
|
-
var target = {};
|
|
19
|
-
for (var prop in source)
|
|
20
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
-
target[prop] = source[prop];
|
|
22
|
-
if (source != null && __getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
var __async = (__this, __arguments, generator) => {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
var fulfilled = (value) => {
|
|
32
|
-
try {
|
|
33
|
-
step(generator.next(value));
|
|
34
|
-
} catch (e) {
|
|
35
|
-
reject(e);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var rejected = (value) => {
|
|
39
|
-
try {
|
|
40
|
-
step(generator.throw(value));
|
|
41
|
-
} catch (e) {
|
|
42
|
-
reject(e);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
46
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
import React, {
|
|
50
|
-
useImperativeHandle,
|
|
51
|
-
useRef,
|
|
52
|
-
useState,
|
|
53
|
-
useEffect,
|
|
54
|
-
useMemo
|
|
55
|
-
} from "react";
|
|
56
|
-
import clsx from "clsx";
|
|
57
|
-
import {
|
|
58
|
-
useTouch,
|
|
59
|
-
touchEmulator,
|
|
60
|
-
isMini,
|
|
61
|
-
getBoundingClientRect,
|
|
62
|
-
throttle
|
|
63
|
-
} from "@bifrostui/utils";
|
|
64
|
-
import BuiSwipeActionContext from "./SwipeActionContext";
|
|
65
|
-
import { DragPhaseEnum, SideTypeEnum } from "./constants";
|
|
66
|
-
import "./SwipeAction.css";
|
|
67
|
-
const classPrefix = "bui-swipe-action";
|
|
68
|
-
const SwipeAction = /* @__PURE__ */ React.forwardRef(
|
|
69
|
-
(props, ref) => {
|
|
70
|
-
const _a = props, {
|
|
71
|
-
className,
|
|
72
|
-
children,
|
|
73
|
-
rightActions,
|
|
74
|
-
leftActions,
|
|
75
|
-
disabled,
|
|
76
|
-
closeOnClickActionItem = true,
|
|
77
|
-
closeOnClickContainer = false,
|
|
78
|
-
onActionsReveal
|
|
79
|
-
} = _a, others = __objRest(_a, [
|
|
80
|
-
"className",
|
|
81
|
-
"children",
|
|
82
|
-
"rightActions",
|
|
83
|
-
"leftActions",
|
|
84
|
-
"disabled",
|
|
85
|
-
"closeOnClickActionItem",
|
|
86
|
-
"closeOnClickContainer",
|
|
87
|
-
"onActionsReveal"
|
|
88
|
-
]);
|
|
89
|
-
const touch = useTouch();
|
|
90
|
-
const rootRef = useRef(null);
|
|
91
|
-
const leftRef = useRef(null);
|
|
92
|
-
const rightRef = useRef(null);
|
|
93
|
-
const contentRef = useRef(null);
|
|
94
|
-
const [translateX, setTranslateX] = useState(0);
|
|
95
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
96
|
-
const startingX = useRef(0);
|
|
97
|
-
const currentX = useRef(0);
|
|
98
|
-
const isDragging = useRef(false);
|
|
99
|
-
let pretranslateX = 0;
|
|
100
|
-
let dragPhase = DragPhaseEnum.START;
|
|
101
|
-
const dragThreshold = 5;
|
|
102
|
-
const leftWidthCache = useRef(0);
|
|
103
|
-
const rightWidthCache = useRef(0);
|
|
104
|
-
const getWidth = (_ref) => {
|
|
105
|
-
if (!_ref.current)
|
|
106
|
-
return Promise.resolve(0);
|
|
107
|
-
return new Promise((resolve) => {
|
|
108
|
-
if (isMini) {
|
|
109
|
-
getBoundingClientRect(_ref.current).then((rect) => {
|
|
110
|
-
if (rect) {
|
|
111
|
-
resolve(rect.width || 0);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
} else {
|
|
115
|
-
resolve(_ref.current.offsetWidth);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
const getLefRefWidth = () => __async(void 0, null, function* () {
|
|
120
|
-
if (leftRef.current && leftActions && !leftWidthCache.current) {
|
|
121
|
-
leftWidthCache.current = yield getWidth(leftRef);
|
|
122
|
-
}
|
|
123
|
-
return leftWidthCache.current;
|
|
124
|
-
});
|
|
125
|
-
const getRightRefWidth = () => __async(void 0, null, function* () {
|
|
126
|
-
if (rightRef.current && rightActions && !rightWidthCache.current) {
|
|
127
|
-
rightWidthCache.current = yield getWidth(rightRef);
|
|
128
|
-
}
|
|
129
|
-
return rightWidthCache.current;
|
|
130
|
-
});
|
|
131
|
-
const initRefWidth = () => {
|
|
132
|
-
getLefRefWidth();
|
|
133
|
-
getRightRefWidth();
|
|
134
|
-
};
|
|
135
|
-
const handleTouchStart = (e) => {
|
|
136
|
-
dragPhase = DragPhaseEnum.START;
|
|
137
|
-
const isMaskEle = e.target.id === "content-mask";
|
|
138
|
-
if (isDragging.current || disabled || isMaskEle)
|
|
139
|
-
return;
|
|
140
|
-
touch.start(e);
|
|
141
|
-
isDragging.current = true;
|
|
142
|
-
startingX.current = touch.deltaX.current - translateX;
|
|
143
|
-
};
|
|
144
|
-
const handleTouchMove = throttle(
|
|
145
|
-
(e) => __async(void 0, null, function* () {
|
|
146
|
-
if (!isDragging.current || disabled)
|
|
147
|
-
return;
|
|
148
|
-
if (dragPhase === DragPhaseEnum.START) {
|
|
149
|
-
dragPhase = DragPhaseEnum.MOVE;
|
|
150
|
-
}
|
|
151
|
-
touch.move(e);
|
|
152
|
-
currentX.current = touch.deltaX.current - startingX.current;
|
|
153
|
-
if (Math.abs(currentX.current) < dragThreshold)
|
|
154
|
-
return;
|
|
155
|
-
const leftWidth = yield getLefRefWidth();
|
|
156
|
-
const rightWidth = yield getRightRefWidth();
|
|
157
|
-
currentX.current = Math.max(
|
|
158
|
-
-rightWidth,
|
|
159
|
-
Math.min(leftWidth, currentX.current)
|
|
160
|
-
);
|
|
161
|
-
setTranslateX(currentX.current);
|
|
162
|
-
}),
|
|
163
|
-
100
|
|
164
|
-
);
|
|
165
|
-
const emitActionsReveal = (targetX, stop = false) => {
|
|
166
|
-
const isSpecial = targetX === pretranslateX && targetX !== 0;
|
|
167
|
-
if (targetX === pretranslateX && !isSpecial || stop)
|
|
168
|
-
return;
|
|
169
|
-
let resStr = null;
|
|
170
|
-
const shouldOpen = targetX > 0 && pretranslateX <= 0 || targetX < 0 && pretranslateX >= 0 || isSpecial;
|
|
171
|
-
if (shouldOpen) {
|
|
172
|
-
if (targetX > 0) {
|
|
173
|
-
resStr = SideTypeEnum.LEFT;
|
|
174
|
-
} else if (targetX < 0) {
|
|
175
|
-
resStr = SideTypeEnum.RIGHT;
|
|
176
|
-
}
|
|
177
|
-
setIsOpen(true);
|
|
178
|
-
} else {
|
|
179
|
-
setIsOpen(false);
|
|
180
|
-
}
|
|
181
|
-
if (resStr) {
|
|
182
|
-
onActionsReveal == null ? void 0 : onActionsReveal({ side: resStr });
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
const handleTouchEnd = (e) => __async(void 0, null, function* () {
|
|
186
|
-
if (!isDragging.current)
|
|
187
|
-
return;
|
|
188
|
-
if (dragPhase === DragPhaseEnum.MOVE) {
|
|
189
|
-
dragPhase = DragPhaseEnum.END;
|
|
190
|
-
}
|
|
191
|
-
const leftWidth = yield getLefRefWidth();
|
|
192
|
-
const rightWidth = yield getRightRefWidth();
|
|
193
|
-
const threshold = 0.5;
|
|
194
|
-
let targetX = 0;
|
|
195
|
-
isDragging.current = false;
|
|
196
|
-
if (Math.abs(currentX.current) < dragThreshold)
|
|
197
|
-
return;
|
|
198
|
-
if (currentX.current > leftWidth * threshold) {
|
|
199
|
-
targetX = leftWidth;
|
|
200
|
-
} else if (currentX.current < -rightWidth * threshold) {
|
|
201
|
-
targetX = -rightWidth;
|
|
202
|
-
}
|
|
203
|
-
if (dragPhase === DragPhaseEnum.END || isMini) {
|
|
204
|
-
emitActionsReveal(targetX);
|
|
205
|
-
console.log("handleTouchEnd\uFF1A", targetX, e);
|
|
206
|
-
setTranslateX(targetX);
|
|
207
|
-
pretranslateX = targetX;
|
|
208
|
-
}
|
|
209
|
-
currentX.current = 0;
|
|
210
|
-
});
|
|
211
|
-
const close = () => {
|
|
212
|
-
setTranslateX(0);
|
|
213
|
-
pretranslateX = 0;
|
|
214
|
-
setIsOpen(false);
|
|
215
|
-
};
|
|
216
|
-
useEffect(() => {
|
|
217
|
-
initRefWidth();
|
|
218
|
-
if (!contentRef.current)
|
|
219
|
-
return;
|
|
220
|
-
const removeTouchEmulator = touchEmulator(contentRef.current);
|
|
221
|
-
return () => {
|
|
222
|
-
removeTouchEmulator();
|
|
223
|
-
};
|
|
224
|
-
}, []);
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
var _a2, _b, _c, _d;
|
|
227
|
-
(_a2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a2.addEventListener("touchstart", handleTouchStart);
|
|
228
|
-
(_b = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b.addEventListener("touchmove", handleTouchMove);
|
|
229
|
-
(_c = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c.addEventListener("touchend", handleTouchEnd);
|
|
230
|
-
(_d = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d.addEventListener("touchcancel", handleTouchEnd);
|
|
231
|
-
if (!isMini && document) {
|
|
232
|
-
document.addEventListener("mouseup", handleTouchEnd);
|
|
233
|
-
}
|
|
234
|
-
return () => {
|
|
235
|
-
var _a3, _b2, _c2, _d2;
|
|
236
|
-
(_a3 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a3.removeEventListener(
|
|
237
|
-
"touchstart",
|
|
238
|
-
handleTouchStart
|
|
239
|
-
);
|
|
240
|
-
(_b2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b2.removeEventListener("touchmove", handleTouchMove);
|
|
241
|
-
(_c2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c2.removeEventListener("touchend", handleTouchEnd);
|
|
242
|
-
(_d2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d2.removeEventListener("touchcancel", handleTouchEnd);
|
|
243
|
-
if (!isMini && document) {
|
|
244
|
-
document.removeEventListener("mouseup", handleTouchEnd);
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}, []);
|
|
248
|
-
useImperativeHandle(ref, () => ({
|
|
249
|
-
show: (params) => __async(void 0, null, function* () {
|
|
250
|
-
let targetX = 0;
|
|
251
|
-
if (params && params.side === SideTypeEnum.RIGHT) {
|
|
252
|
-
targetX = -(yield getRightRefWidth());
|
|
253
|
-
} else {
|
|
254
|
-
targetX = yield getLefRefWidth();
|
|
255
|
-
}
|
|
256
|
-
setTranslateX(targetX);
|
|
257
|
-
pretranslateX = targetX;
|
|
258
|
-
emitActionsReveal(targetX);
|
|
259
|
-
}),
|
|
260
|
-
close,
|
|
261
|
-
// 获取当前是否打开
|
|
262
|
-
open: isOpen,
|
|
263
|
-
ref: rootRef.current
|
|
264
|
-
}));
|
|
265
|
-
const outClickHandle = (e) => {
|
|
266
|
-
e.preventDefault();
|
|
267
|
-
e.stopPropagation();
|
|
268
|
-
if (translateX !== 0 && closeOnClickContainer) {
|
|
269
|
-
close();
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
const SwipeActionContext = useMemo(
|
|
273
|
-
() => ({ closeOnClickActionItem, close }),
|
|
274
|
-
[closeOnClickActionItem]
|
|
275
|
-
);
|
|
276
|
-
return /* @__PURE__ */ React.createElement(BuiSwipeActionContext.Provider, { value: SwipeActionContext }, /* @__PURE__ */ React.createElement(
|
|
277
|
-
"div",
|
|
278
|
-
__spreadValues({
|
|
279
|
-
className: clsx(`${classPrefix}`, className),
|
|
280
|
-
ref: rootRef
|
|
281
|
-
}, others),
|
|
282
|
-
/* @__PURE__ */ React.createElement(
|
|
283
|
-
"div",
|
|
284
|
-
{
|
|
285
|
-
className: `${classPrefix}-track`,
|
|
286
|
-
style: {
|
|
287
|
-
transform: `translate3d(${translateX}px, 0, 0)`
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
/* @__PURE__ */ React.createElement(
|
|
291
|
-
"div",
|
|
292
|
-
{
|
|
293
|
-
className: `${classPrefix}-actions ${classPrefix}-actions-left`,
|
|
294
|
-
ref: leftRef
|
|
295
|
-
},
|
|
296
|
-
leftActions
|
|
297
|
-
),
|
|
298
|
-
/* @__PURE__ */ React.createElement(
|
|
299
|
-
"div",
|
|
300
|
-
{
|
|
301
|
-
className: `${classPrefix}-content-container`,
|
|
302
|
-
ref: contentRef,
|
|
303
|
-
onTouchStart: handleTouchStart,
|
|
304
|
-
onTouchMove: handleTouchMove,
|
|
305
|
-
onTouchEnd: handleTouchEnd,
|
|
306
|
-
onTouchCancel: handleTouchEnd
|
|
307
|
-
},
|
|
308
|
-
isOpen && closeOnClickContainer && /* @__PURE__ */ React.createElement(
|
|
309
|
-
"div",
|
|
310
|
-
{
|
|
311
|
-
className: `${classPrefix}-content-mask`,
|
|
312
|
-
id: "content-mask",
|
|
313
|
-
onClick: outClickHandle
|
|
314
|
-
}
|
|
315
|
-
),
|
|
316
|
-
children
|
|
317
|
-
),
|
|
318
|
-
/* @__PURE__ */ React.createElement(
|
|
319
|
-
"div",
|
|
320
|
-
{
|
|
321
|
-
className: `${classPrefix}-actions ${classPrefix}-actions-right`,
|
|
322
|
-
ref: rightRef
|
|
323
|
-
},
|
|
324
|
-
rightActions
|
|
325
|
-
)
|
|
326
|
-
)
|
|
327
|
-
));
|
|
328
|
-
}
|
|
329
|
-
);
|
|
330
|
-
SwipeAction.displayName = "BuiSwipeAction";
|
|
331
|
-
var SwipeAction_default = SwipeAction;
|
|
332
|
-
export {
|
|
333
|
-
SwipeAction_default as default
|
|
334
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { OverrideProps, ThemeColor } from '@bifrostui/types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { SideTypeEnum } from './constants';
|
|
4
|
-
export type SwipeActionProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
5
|
-
props: P & {
|
|
6
|
-
/**
|
|
7
|
-
* 右侧的操作按钮列表区域
|
|
8
|
-
*/
|
|
9
|
-
rightActions?: React.ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* 左侧的操作按钮列表区域
|
|
12
|
-
*/
|
|
13
|
-
leftActions?: React.ReactNode;
|
|
14
|
-
/**
|
|
15
|
-
* 是否在点击按钮区自动归位
|
|
16
|
-
*/
|
|
17
|
-
closeOnClickActionItem?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* 是否在点击其他区域时自动归位
|
|
20
|
-
*/
|
|
21
|
-
closeOnClickContainer?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* 操作按钮展开时触发
|
|
24
|
-
*/
|
|
25
|
-
onActionsReveal?: (params: RevealParams) => void;
|
|
26
|
-
/**
|
|
27
|
-
* 是否禁用拖动
|
|
28
|
-
*/
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
};
|
|
31
|
-
defaultComponent: D;
|
|
32
|
-
}, D>;
|
|
33
|
-
interface RevealParams {
|
|
34
|
-
side: SideTypeEnum | '';
|
|
35
|
-
}
|
|
36
|
-
export type SwipeActionItemProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
37
|
-
props: P & {
|
|
38
|
-
/**
|
|
39
|
-
* 颜色风格
|
|
40
|
-
*/
|
|
41
|
-
color?: ThemeColor | 'vip';
|
|
42
|
-
/**
|
|
43
|
-
* id
|
|
44
|
-
*/
|
|
45
|
-
id?: string | number;
|
|
46
|
-
/**
|
|
47
|
-
* 点击事件
|
|
48
|
-
*/
|
|
49
|
-
onClick?: (e: React.SyntheticEvent, item: {
|
|
50
|
-
id: string | number;
|
|
51
|
-
color: ThemeColor | 'vip';
|
|
52
|
-
text: React.ReactNode;
|
|
53
|
-
}) => void;
|
|
54
|
-
};
|
|
55
|
-
defaultComponent: D;
|
|
56
|
-
}, D>;
|
|
57
|
-
export interface BuiSwipeActionContextProps {
|
|
58
|
-
/**
|
|
59
|
-
* 是否在点击操作按钮时自动归位
|
|
60
|
-
*/
|
|
61
|
-
closeOnClickActionItem?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* 关闭函数
|
|
64
|
-
*/
|
|
65
|
-
close: () => void;
|
|
66
|
-
}
|
|
67
|
-
export type SwipeActionRef = {
|
|
68
|
-
close: () => void;
|
|
69
|
-
show: (params?: {
|
|
70
|
-
side: SideTypeEnum;
|
|
71
|
-
}) => void;
|
|
72
|
-
open: boolean;
|
|
73
|
-
ref?: HTMLDivElement;
|
|
74
|
-
};
|
|
75
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createContext } from "react";
|
|
2
|
-
const BuiSwipeActionContext = createContext({
|
|
3
|
-
closeOnClickActionItem: true,
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5
|
-
close: () => {
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
var SwipeActionContext_default = BuiSwipeActionContext;
|
|
9
|
-
export {
|
|
10
|
-
SwipeActionContext_default as default
|
|
11
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
.bui-swipe-action-item {
|
|
2
|
-
padding: 0 15px;
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
height: 100%;
|
|
7
|
-
width: 100%;
|
|
8
|
-
background: var(--background-button-color);
|
|
9
|
-
color: #fff;
|
|
10
|
-
box-sizing: content-box;
|
|
11
|
-
white-space: nowrap;
|
|
12
|
-
font-family: var(--bui-font-family);
|
|
13
|
-
}
|
|
14
|
-
.bui-swipe-action-item-primary {
|
|
15
|
-
background-color: var(--bui-color-primary);
|
|
16
|
-
}
|
|
17
|
-
.bui-swipe-action-item-vip {
|
|
18
|
-
background-color: var(--bui-color-vip);
|
|
19
|
-
}
|
|
20
|
-
.bui-swipe-action-item-success {
|
|
21
|
-
background-color: var(--bui-color-success);
|
|
22
|
-
}
|
|
23
|
-
.bui-swipe-action-item-info {
|
|
24
|
-
background-color: var(--bui-color-info);
|
|
25
|
-
}
|
|
26
|
-
.bui-swipe-action-item-warning {
|
|
27
|
-
background-color: var(--bui-color-warning);
|
|
28
|
-
}
|
|
29
|
-
.bui-swipe-action-item-danger {
|
|
30
|
-
background-color: var(--bui-color-danger);
|
|
31
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SwipeActionItemProps } from './SwipeAction.types';
|
|
3
|
-
import './SwipeActionItem.less';
|
|
4
|
-
declare const SwipeActionItem: React.ForwardRefExoticComponent<Omit<SwipeActionItemProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
export default SwipeActionItem;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __objRest = (source, exclude) => {
|
|
18
|
-
var target = {};
|
|
19
|
-
for (var prop in source)
|
|
20
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
-
target[prop] = source[prop];
|
|
22
|
-
if (source != null && __getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
import React, { useContext } from "react";
|
|
30
|
-
import clsx from "clsx";
|
|
31
|
-
import BuiSwipeActionContext from "./SwipeActionContext";
|
|
32
|
-
import "./SwipeActionItem.css";
|
|
33
|
-
const prefixCls = "bui-swipe-action-item";
|
|
34
|
-
const SwipeActionItem = /* @__PURE__ */ React.forwardRef(
|
|
35
|
-
(props, ref) => {
|
|
36
|
-
const _a = props, {
|
|
37
|
-
className,
|
|
38
|
-
children,
|
|
39
|
-
onClick,
|
|
40
|
-
color = "primary",
|
|
41
|
-
id = ""
|
|
42
|
-
} = _a, others = __objRest(_a, [
|
|
43
|
-
"className",
|
|
44
|
-
"children",
|
|
45
|
-
"onClick",
|
|
46
|
-
"color",
|
|
47
|
-
"id"
|
|
48
|
-
]);
|
|
49
|
-
const { closeOnClickActionItem, close } = useContext(BuiSwipeActionContext);
|
|
50
|
-
const onClickHandle = (e) => {
|
|
51
|
-
e.stopPropagation();
|
|
52
|
-
if (closeOnClickActionItem) {
|
|
53
|
-
close == null ? void 0 : close();
|
|
54
|
-
}
|
|
55
|
-
onClick == null ? void 0 : onClick(e, {
|
|
56
|
-
color,
|
|
57
|
-
id,
|
|
58
|
-
text: children
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
return /* @__PURE__ */ React.createElement(
|
|
62
|
-
"div",
|
|
63
|
-
__spreadValues({
|
|
64
|
-
className: clsx(prefixCls, className, {
|
|
65
|
-
[`${prefixCls}-${color}`]: color
|
|
66
|
-
}),
|
|
67
|
-
ref,
|
|
68
|
-
onClick: onClickHandle
|
|
69
|
-
}, others),
|
|
70
|
-
children
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
SwipeActionItem.displayName = "SwipeActionItem";
|
|
75
|
-
var SwipeActionItem_default = SwipeActionItem;
|
|
76
|
-
export {
|
|
77
|
-
SwipeActionItem_default as default
|
|
78
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var SideTypeEnum = /* @__PURE__ */ ((SideTypeEnum2) => {
|
|
2
|
-
SideTypeEnum2["LEFT"] = "left";
|
|
3
|
-
SideTypeEnum2["RIGHT"] = "right";
|
|
4
|
-
return SideTypeEnum2;
|
|
5
|
-
})(SideTypeEnum || {});
|
|
6
|
-
var DragPhaseEnum = /* @__PURE__ */ ((DragPhaseEnum2) => {
|
|
7
|
-
DragPhaseEnum2[DragPhaseEnum2["START"] = 1] = "START";
|
|
8
|
-
DragPhaseEnum2[DragPhaseEnum2["MOVE"] = 2] = "MOVE";
|
|
9
|
-
DragPhaseEnum2[DragPhaseEnum2["END"] = 3] = "END";
|
|
10
|
-
return DragPhaseEnum2;
|
|
11
|
-
})(DragPhaseEnum || {});
|
|
12
|
-
export {
|
|
13
|
-
DragPhaseEnum,
|
|
14
|
-
SideTypeEnum
|
|
15
|
-
};
|
package/es/SwipeAction/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from "./SwipeAction.types";
|
|
2
|
-
import { default as default2 } from "./SwipeAction";
|
|
3
|
-
import { default as default3 } from "./SwipeAction";
|
|
4
|
-
import { default as default4 } from "./SwipeActionItem";
|
|
5
|
-
import { SideTypeEnum, DragPhaseEnum } from "./constants";
|
|
6
|
-
export {
|
|
7
|
-
DragPhaseEnum,
|
|
8
|
-
SideTypeEnum,
|
|
9
|
-
default3 as SwipeAction,
|
|
10
|
-
default4 as SwipeActionItem,
|
|
11
|
-
default2 as default
|
|
12
|
-
};
|