@bifrostui/react 2.0.0-beta.10 → 2.0.0-beta.12
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/Calendar/Calendar.js +5 -1
- package/dist/Calendar/Calendar.types.d.ts +5 -0
- package/dist/Collapse/Collapse.css +0 -1
- package/dist/Collapse/Collapse.d.ts +1 -1
- package/dist/Collapse/Collapse.js +11 -8
- package/dist/Collapse/Collapse.miniapp.d.ts +5 -0
- package/dist/Collapse/Collapse.miniapp.js +177 -0
- package/dist/CollapsePanel/CollapsePanel.css +4 -2
- package/dist/DatePicker/DatePicker.d.ts +4 -0
- package/dist/DatePicker/DatePicker.js +335 -0
- package/dist/DatePicker/DatePicker.types.d.ts +36 -0
- package/dist/DatePicker/DatePicker.types.js +15 -0
- package/dist/DatePicker/constants.d.ts +9 -0
- package/dist/DatePicker/constants.js +37 -0
- package/dist/DatePicker/index.d.ts +3 -0
- package/dist/DatePicker/index.js +44 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
- package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/dist/DesktopDatePicker/index.css +61 -0
- package/dist/DesktopDatePicker/index.d.ts +2 -0
- package/dist/DesktopDatePicker/index.js +41 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
- package/dist/DesktopDateTimePicker/index.css +66 -0
- package/dist/DesktopDateTimePicker/index.d.ts +2 -0
- package/dist/DesktopDateTimePicker/index.js +41 -0
- package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/dist/DesktopPicker/DesktopPicker.js +243 -0
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
- package/dist/DesktopPicker/index.css +39 -0
- package/dist/DesktopPicker/index.d.ts +2 -0
- package/dist/DesktopPicker/index.js +41 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
- package/dist/DesktopTimePicker/index.css +170 -0
- package/dist/DesktopTimePicker/index.d.ts +2 -0
- package/dist/DesktopTimePicker/index.js +41 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +249 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
- package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/dist/DesktopTimePicker/utils/utils.js +408 -0
- package/dist/Dialog/Dialog.types.d.ts +5 -0
- package/dist/Dialog/FunctionalDialog.js +13 -2
- package/dist/Input/Input.css +0 -2
- package/dist/Modal/Modal.miniapp.d.ts +1 -1
- package/dist/Picker/Picker.css +5 -0
- package/dist/Picker/Picker.js +27 -5
- package/dist/Picker/Picker.types.d.ts +15 -2
- package/dist/Picker/PickerPanel.css +4 -0
- package/dist/Picker/PickerPanel.js +7 -6
- package/dist/Popover/Popover.js +70 -27
- package/dist/Portal/Portal.miniapp.js +7 -4
- package/dist/ScrollView/ScrollView.js +24 -11
- package/dist/ScrollView/ScrollView.types.d.ts +0 -1
- package/dist/Select/Select.css +1 -4
- package/dist/Select/Select.js +62 -37
- package/dist/Slider/Slider.js +13 -5
- package/dist/SwipeAction/SwipeAction.css +79 -0
- package/dist/SwipeAction/SwipeAction.d.ts +5 -0
- package/dist/SwipeAction/SwipeAction.js +349 -0
- package/dist/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/dist/SwipeAction/SwipeAction.types.js +15 -0
- package/dist/SwipeAction/SwipeActionContext.d.ts +4 -0
- package/dist/SwipeAction/SwipeActionContext.js +30 -0
- package/dist/SwipeAction/SwipeActionItem.css +31 -0
- package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/dist/SwipeAction/SwipeActionItem.js +105 -0
- package/dist/SwipeAction/constants.d.ts +9 -0
- package/dist/SwipeAction/constants.js +39 -0
- package/dist/SwipeAction/index.d.ts +5 -0
- package/dist/SwipeAction/index.js +50 -0
- package/dist/TabBar/TabBarItem.js +2 -2
- package/dist/Tabs/Tabs.js +29 -14
- package/dist/Tabs/utils/scroll.d.ts +2 -0
- package/dist/Tabs/utils/scroll.js +55 -0
- package/dist/Toast/FunctionalToast.js +13 -2
- package/dist/Toast/Toast.css +0 -1
- package/dist/Toast/Toast.types.d.ts +5 -0
- package/dist/Tooltip/Tooltip.js +70 -27
- package/dist/index.d.ts +6 -0
- package/dist/index.js +13 -1
- package/dist/locales/base.d.ts +11 -0
- package/dist/locales/en-US.js +24 -0
- package/dist/locales/zh-CN.js +24 -0
- package/dist/locales/zh-TW.js +24 -0
- package/es/Calendar/Calendar.js +5 -1
- package/es/Calendar/Calendar.types.d.ts +5 -0
- package/es/Collapse/Collapse.css +0 -1
- package/es/Collapse/Collapse.d.ts +1 -1
- package/es/Collapse/Collapse.js +11 -8
- package/es/Collapse/Collapse.miniapp.d.ts +5 -0
- package/es/Collapse/Collapse.miniapp.js +157 -0
- package/es/CollapsePanel/CollapsePanel.css +4 -2
- package/es/DatePicker/DatePicker.d.ts +4 -0
- package/es/DatePicker/DatePicker.js +308 -0
- package/es/DatePicker/DatePicker.types.d.ts +36 -0
- package/es/DatePicker/DatePicker.types.js +1 -0
- package/es/DatePicker/constants.d.ts +9 -0
- package/es/DatePicker/constants.js +14 -0
- package/es/DatePicker/index.d.ts +3 -0
- package/es/DatePicker/index.js +8 -0
- package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
- package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/es/DesktopDatePicker/index.css +61 -0
- package/es/DesktopDatePicker/index.d.ts +2 -0
- package/es/DesktopDatePicker/index.js +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
- package/es/DesktopDateTimePicker/index.css +66 -0
- package/es/DesktopDateTimePicker/index.d.ts +2 -0
- package/es/DesktopDateTimePicker/index.js +9 -0
- package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/es/DesktopPicker/DesktopPicker.js +226 -0
- package/es/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/es/DesktopPicker/DesktopPicker.types.js +1 -0
- package/es/DesktopPicker/index.css +39 -0
- package/es/DesktopPicker/index.d.ts +2 -0
- package/es/DesktopPicker/index.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
- package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
- package/es/DesktopTimePicker/index.css +170 -0
- package/es/DesktopTimePicker/index.d.ts +2 -0
- package/es/DesktopTimePicker/index.js +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.js +226 -0
- package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
- package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/es/DesktopTimePicker/utils/utils.js +365 -0
- package/es/Dialog/Dialog.types.d.ts +5 -0
- package/es/Dialog/FunctionalDialog.js +14 -3
- package/es/Input/Input.css +0 -2
- package/es/Picker/Picker.css +5 -0
- package/es/Picker/Picker.js +27 -5
- package/es/Picker/Picker.types.d.ts +15 -2
- package/es/Picker/PickerPanel.css +4 -0
- package/es/Picker/PickerPanel.js +7 -6
- package/es/Popover/Popover.js +73 -29
- package/es/Portal/Portal.miniapp.js +8 -5
- package/es/ScrollView/ScrollView.js +24 -11
- package/es/ScrollView/ScrollView.types.d.ts +0 -1
- package/es/Select/Select.css +1 -4
- package/es/Select/Select.js +62 -38
- package/es/Slider/Slider.js +16 -6
- package/es/SwipeAction/SwipeAction.css +79 -0
- package/es/SwipeAction/SwipeAction.d.ts +5 -0
- package/es/SwipeAction/SwipeAction.js +334 -0
- package/es/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/es/SwipeAction/SwipeAction.types.js +1 -0
- package/es/SwipeAction/SwipeActionContext.d.ts +4 -0
- package/es/SwipeAction/SwipeActionContext.js +11 -0
- package/es/SwipeAction/SwipeActionItem.css +31 -0
- package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/es/SwipeAction/SwipeActionItem.js +78 -0
- package/es/SwipeAction/constants.d.ts +9 -0
- package/es/SwipeAction/constants.js +15 -0
- package/es/SwipeAction/index.d.ts +5 -0
- package/es/SwipeAction/index.js +12 -0
- package/es/TabBar/TabBarItem.js +1 -1
- package/es/Tabs/Tabs.js +29 -14
- package/es/Tabs/utils/scroll.d.ts +2 -0
- package/es/Tabs/utils/scroll.js +36 -0
- package/es/Toast/FunctionalToast.js +14 -3
- package/es/Toast/Toast.css +0 -1
- package/es/Toast/Toast.types.d.ts +5 -0
- package/es/Tooltip/Tooltip.js +73 -29
- package/es/index.d.ts +6 -0
- package/es/index.js +6 -0
- package/es/locales/base.d.ts +11 -0
- package/es/locales/en-US.js +24 -0
- package/es/locales/zh-CN.js +24 -0
- package/es/locales/zh-TW.js +24 -0
- package/package.json +5 -5
- package/dist/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.js +0 -13
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
var __export = (target, all) => {
|
|
34
|
+
for (var name in all)
|
|
35
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
36
|
+
};
|
|
37
|
+
var __copyProps = (to, from, except, desc) => {
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (let key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
41
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
42
|
+
}
|
|
43
|
+
return to;
|
|
44
|
+
};
|
|
45
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
46
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
47
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
48
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
49
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
50
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
51
|
+
mod
|
|
52
|
+
));
|
|
53
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
54
|
+
var __async = (__this, __arguments, generator) => {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
var fulfilled = (value) => {
|
|
57
|
+
try {
|
|
58
|
+
step(generator.next(value));
|
|
59
|
+
} catch (e) {
|
|
60
|
+
reject(e);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var rejected = (value) => {
|
|
64
|
+
try {
|
|
65
|
+
step(generator.throw(value));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
reject(e);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
71
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
var SwipeAction_exports = {};
|
|
75
|
+
__export(SwipeAction_exports, {
|
|
76
|
+
default: () => SwipeAction_default
|
|
77
|
+
});
|
|
78
|
+
module.exports = __toCommonJS(SwipeAction_exports);
|
|
79
|
+
var import_react = __toESM(require("react"));
|
|
80
|
+
var import_clsx = __toESM(require("clsx"));
|
|
81
|
+
var import_utils = require("@bifrostui/utils");
|
|
82
|
+
var import_SwipeActionContext = __toESM(require("./SwipeActionContext"));
|
|
83
|
+
var import_constants = require("./constants");
|
|
84
|
+
var import_SwipeAction2 = require("./SwipeAction.css");
|
|
85
|
+
const classPrefix = "bui-swipe-action";
|
|
86
|
+
const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
87
|
+
(props, ref) => {
|
|
88
|
+
const _a = props, {
|
|
89
|
+
className,
|
|
90
|
+
children,
|
|
91
|
+
rightActions,
|
|
92
|
+
leftActions,
|
|
93
|
+
disabled,
|
|
94
|
+
closeOnClickActionItem = true,
|
|
95
|
+
closeOnClickContainer = false,
|
|
96
|
+
onActionsReveal
|
|
97
|
+
} = _a, others = __objRest(_a, [
|
|
98
|
+
"className",
|
|
99
|
+
"children",
|
|
100
|
+
"rightActions",
|
|
101
|
+
"leftActions",
|
|
102
|
+
"disabled",
|
|
103
|
+
"closeOnClickActionItem",
|
|
104
|
+
"closeOnClickContainer",
|
|
105
|
+
"onActionsReveal"
|
|
106
|
+
]);
|
|
107
|
+
const touch = (0, import_utils.useTouch)();
|
|
108
|
+
const rootRef = (0, import_react.useRef)(null);
|
|
109
|
+
const leftRef = (0, import_react.useRef)(null);
|
|
110
|
+
const rightRef = (0, import_react.useRef)(null);
|
|
111
|
+
const contentRef = (0, import_react.useRef)(null);
|
|
112
|
+
const [translateX, setTranslateX] = (0, import_react.useState)(0);
|
|
113
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
114
|
+
const startingX = (0, import_react.useRef)(0);
|
|
115
|
+
const currentX = (0, import_react.useRef)(0);
|
|
116
|
+
const isDragging = (0, import_react.useRef)(false);
|
|
117
|
+
let pretranslateX = 0;
|
|
118
|
+
let dragPhase = import_constants.DragPhaseEnum.START;
|
|
119
|
+
const dragThreshold = 5;
|
|
120
|
+
const leftWidthCache = (0, import_react.useRef)(0);
|
|
121
|
+
const rightWidthCache = (0, import_react.useRef)(0);
|
|
122
|
+
const getWidth = (_ref) => {
|
|
123
|
+
if (!_ref.current)
|
|
124
|
+
return Promise.resolve(0);
|
|
125
|
+
return new Promise((resolve) => {
|
|
126
|
+
if (import_utils.isMini) {
|
|
127
|
+
(0, import_utils.getBoundingClientRect)(_ref.current).then((rect) => {
|
|
128
|
+
if (rect) {
|
|
129
|
+
resolve(rect.width || 0);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
resolve(_ref.current.offsetWidth);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
const getLefRefWidth = () => __async(void 0, null, function* () {
|
|
138
|
+
if (leftRef.current && leftActions && !leftWidthCache.current) {
|
|
139
|
+
leftWidthCache.current = yield getWidth(leftRef);
|
|
140
|
+
}
|
|
141
|
+
return leftWidthCache.current;
|
|
142
|
+
});
|
|
143
|
+
const getRightRefWidth = () => __async(void 0, null, function* () {
|
|
144
|
+
if (rightRef.current && rightActions && !rightWidthCache.current) {
|
|
145
|
+
rightWidthCache.current = yield getWidth(rightRef);
|
|
146
|
+
}
|
|
147
|
+
return rightWidthCache.current;
|
|
148
|
+
});
|
|
149
|
+
const initRefWidth = () => {
|
|
150
|
+
getLefRefWidth();
|
|
151
|
+
getRightRefWidth();
|
|
152
|
+
};
|
|
153
|
+
const handleTouchStart = (e) => {
|
|
154
|
+
dragPhase = import_constants.DragPhaseEnum.START;
|
|
155
|
+
const isMaskEle = e.target.id === "content-mask";
|
|
156
|
+
if (isDragging.current || disabled || isMaskEle)
|
|
157
|
+
return;
|
|
158
|
+
touch.start(e);
|
|
159
|
+
isDragging.current = true;
|
|
160
|
+
startingX.current = touch.deltaX.current - translateX;
|
|
161
|
+
};
|
|
162
|
+
const handleTouchMove = (0, import_utils.throttle)(
|
|
163
|
+
(e) => __async(void 0, null, function* () {
|
|
164
|
+
if (!isDragging.current || disabled)
|
|
165
|
+
return;
|
|
166
|
+
if (dragPhase === import_constants.DragPhaseEnum.START) {
|
|
167
|
+
dragPhase = import_constants.DragPhaseEnum.MOVE;
|
|
168
|
+
}
|
|
169
|
+
touch.move(e);
|
|
170
|
+
currentX.current = touch.deltaX.current - startingX.current;
|
|
171
|
+
if (Math.abs(currentX.current) < dragThreshold)
|
|
172
|
+
return;
|
|
173
|
+
const leftWidth = yield getLefRefWidth();
|
|
174
|
+
const rightWidth = yield getRightRefWidth();
|
|
175
|
+
currentX.current = Math.max(
|
|
176
|
+
-rightWidth,
|
|
177
|
+
Math.min(leftWidth, currentX.current)
|
|
178
|
+
);
|
|
179
|
+
setTranslateX(currentX.current);
|
|
180
|
+
}),
|
|
181
|
+
100
|
|
182
|
+
);
|
|
183
|
+
const emitActionsReveal = (targetX, stop = false) => {
|
|
184
|
+
const isSpecial = targetX === pretranslateX && targetX !== 0;
|
|
185
|
+
if (targetX === pretranslateX && !isSpecial || stop)
|
|
186
|
+
return;
|
|
187
|
+
let resStr = null;
|
|
188
|
+
const shouldOpen = targetX > 0 && pretranslateX <= 0 || targetX < 0 && pretranslateX >= 0 || isSpecial;
|
|
189
|
+
if (shouldOpen) {
|
|
190
|
+
if (targetX > 0) {
|
|
191
|
+
resStr = import_constants.SideTypeEnum.LEFT;
|
|
192
|
+
} else if (targetX < 0) {
|
|
193
|
+
resStr = import_constants.SideTypeEnum.RIGHT;
|
|
194
|
+
}
|
|
195
|
+
setIsOpen(true);
|
|
196
|
+
} else {
|
|
197
|
+
setIsOpen(false);
|
|
198
|
+
}
|
|
199
|
+
if (resStr) {
|
|
200
|
+
onActionsReveal == null ? void 0 : onActionsReveal({ side: resStr });
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const handleTouchEnd = (e) => __async(void 0, null, function* () {
|
|
204
|
+
if (!isDragging.current)
|
|
205
|
+
return;
|
|
206
|
+
if (dragPhase === import_constants.DragPhaseEnum.MOVE) {
|
|
207
|
+
dragPhase = import_constants.DragPhaseEnum.END;
|
|
208
|
+
}
|
|
209
|
+
const leftWidth = yield getLefRefWidth();
|
|
210
|
+
const rightWidth = yield getRightRefWidth();
|
|
211
|
+
const threshold = 0.5;
|
|
212
|
+
let targetX = 0;
|
|
213
|
+
isDragging.current = false;
|
|
214
|
+
if (Math.abs(currentX.current) < dragThreshold)
|
|
215
|
+
return;
|
|
216
|
+
if (currentX.current > leftWidth * threshold) {
|
|
217
|
+
targetX = leftWidth;
|
|
218
|
+
} else if (currentX.current < -rightWidth * threshold) {
|
|
219
|
+
targetX = -rightWidth;
|
|
220
|
+
}
|
|
221
|
+
if (dragPhase === import_constants.DragPhaseEnum.END || import_utils.isMini) {
|
|
222
|
+
emitActionsReveal(targetX);
|
|
223
|
+
console.log("handleTouchEnd\uFF1A", targetX, e);
|
|
224
|
+
setTranslateX(targetX);
|
|
225
|
+
pretranslateX = targetX;
|
|
226
|
+
}
|
|
227
|
+
currentX.current = 0;
|
|
228
|
+
});
|
|
229
|
+
const close = () => {
|
|
230
|
+
setTranslateX(0);
|
|
231
|
+
pretranslateX = 0;
|
|
232
|
+
setIsOpen(false);
|
|
233
|
+
};
|
|
234
|
+
(0, import_react.useEffect)(() => {
|
|
235
|
+
initRefWidth();
|
|
236
|
+
if (!contentRef.current)
|
|
237
|
+
return;
|
|
238
|
+
const removeTouchEmulator = (0, import_utils.touchEmulator)(contentRef.current);
|
|
239
|
+
return () => {
|
|
240
|
+
removeTouchEmulator();
|
|
241
|
+
};
|
|
242
|
+
}, []);
|
|
243
|
+
(0, import_react.useEffect)(() => {
|
|
244
|
+
var _a2, _b, _c, _d;
|
|
245
|
+
(_a2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a2.addEventListener("touchstart", handleTouchStart);
|
|
246
|
+
(_b = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b.addEventListener("touchmove", handleTouchMove);
|
|
247
|
+
(_c = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c.addEventListener("touchend", handleTouchEnd);
|
|
248
|
+
(_d = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d.addEventListener("touchcancel", handleTouchEnd);
|
|
249
|
+
if (!import_utils.isMini && document) {
|
|
250
|
+
document.addEventListener("mouseup", handleTouchEnd);
|
|
251
|
+
}
|
|
252
|
+
return () => {
|
|
253
|
+
var _a3, _b2, _c2, _d2;
|
|
254
|
+
(_a3 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a3.removeEventListener(
|
|
255
|
+
"touchstart",
|
|
256
|
+
handleTouchStart
|
|
257
|
+
);
|
|
258
|
+
(_b2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b2.removeEventListener("touchmove", handleTouchMove);
|
|
259
|
+
(_c2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c2.removeEventListener("touchend", handleTouchEnd);
|
|
260
|
+
(_d2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d2.removeEventListener("touchcancel", handleTouchEnd);
|
|
261
|
+
if (!import_utils.isMini && document) {
|
|
262
|
+
document.removeEventListener("mouseup", handleTouchEnd);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
}, []);
|
|
266
|
+
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
267
|
+
show: (params) => __async(void 0, null, function* () {
|
|
268
|
+
let targetX = 0;
|
|
269
|
+
if (params && params.side === import_constants.SideTypeEnum.RIGHT) {
|
|
270
|
+
targetX = -(yield getRightRefWidth());
|
|
271
|
+
} else {
|
|
272
|
+
targetX = yield getLefRefWidth();
|
|
273
|
+
}
|
|
274
|
+
setTranslateX(targetX);
|
|
275
|
+
pretranslateX = targetX;
|
|
276
|
+
emitActionsReveal(targetX);
|
|
277
|
+
}),
|
|
278
|
+
close,
|
|
279
|
+
// 获取当前是否打开
|
|
280
|
+
open: isOpen,
|
|
281
|
+
ref: rootRef.current
|
|
282
|
+
}));
|
|
283
|
+
const outClickHandle = (e) => {
|
|
284
|
+
e.preventDefault();
|
|
285
|
+
e.stopPropagation();
|
|
286
|
+
if (translateX !== 0 && closeOnClickContainer) {
|
|
287
|
+
close();
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
const SwipeActionContext = (0, import_react.useMemo)(
|
|
291
|
+
() => ({ closeOnClickActionItem, close }),
|
|
292
|
+
[closeOnClickActionItem]
|
|
293
|
+
);
|
|
294
|
+
return /* @__PURE__ */ import_react.default.createElement(import_SwipeActionContext.default.Provider, { value: SwipeActionContext }, /* @__PURE__ */ import_react.default.createElement(
|
|
295
|
+
"div",
|
|
296
|
+
__spreadValues({
|
|
297
|
+
className: (0, import_clsx.default)(`${classPrefix}`, className),
|
|
298
|
+
ref: rootRef
|
|
299
|
+
}, others),
|
|
300
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
301
|
+
"div",
|
|
302
|
+
{
|
|
303
|
+
className: `${classPrefix}-track`,
|
|
304
|
+
style: {
|
|
305
|
+
transform: `translate3d(${translateX}px, 0, 0)`
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
className: `${classPrefix}-actions ${classPrefix}-actions-left`,
|
|
312
|
+
ref: leftRef
|
|
313
|
+
},
|
|
314
|
+
leftActions
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
317
|
+
"div",
|
|
318
|
+
{
|
|
319
|
+
className: `${classPrefix}-content-container`,
|
|
320
|
+
ref: contentRef,
|
|
321
|
+
onTouchStart: handleTouchStart,
|
|
322
|
+
onTouchMove: handleTouchMove,
|
|
323
|
+
onTouchEnd: handleTouchEnd,
|
|
324
|
+
onTouchCancel: handleTouchEnd
|
|
325
|
+
},
|
|
326
|
+
isOpen && closeOnClickContainer && /* @__PURE__ */ import_react.default.createElement(
|
|
327
|
+
"div",
|
|
328
|
+
{
|
|
329
|
+
className: `${classPrefix}-content-mask`,
|
|
330
|
+
id: "content-mask",
|
|
331
|
+
onClick: outClickHandle
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
children
|
|
335
|
+
),
|
|
336
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
337
|
+
"div",
|
|
338
|
+
{
|
|
339
|
+
className: `${classPrefix}-actions ${classPrefix}-actions-right`,
|
|
340
|
+
ref: rightRef
|
|
341
|
+
},
|
|
342
|
+
rightActions
|
|
343
|
+
)
|
|
344
|
+
)
|
|
345
|
+
));
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
SwipeAction.displayName = "BuiSwipeAction";
|
|
349
|
+
var SwipeAction_default = SwipeAction;
|
|
@@ -0,0 +1,75 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var SwipeAction_types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(SwipeAction_types_exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var SwipeActionContext_exports = {};
|
|
19
|
+
__export(SwipeActionContext_exports, {
|
|
20
|
+
default: () => SwipeActionContext_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(SwipeActionContext_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
const BuiSwipeActionContext = (0, import_react.createContext)({
|
|
25
|
+
closeOnClickActionItem: true,
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
27
|
+
close: () => {
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var SwipeActionContext_default = BuiSwipeActionContext;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
var __export = (target, all) => {
|
|
34
|
+
for (var name in all)
|
|
35
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
36
|
+
};
|
|
37
|
+
var __copyProps = (to, from, except, desc) => {
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (let key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
41
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
42
|
+
}
|
|
43
|
+
return to;
|
|
44
|
+
};
|
|
45
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
46
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
47
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
48
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
49
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
50
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
51
|
+
mod
|
|
52
|
+
));
|
|
53
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
54
|
+
var SwipeActionItem_exports = {};
|
|
55
|
+
__export(SwipeActionItem_exports, {
|
|
56
|
+
default: () => SwipeActionItem_default
|
|
57
|
+
});
|
|
58
|
+
module.exports = __toCommonJS(SwipeActionItem_exports);
|
|
59
|
+
var import_react = __toESM(require("react"));
|
|
60
|
+
var import_clsx = __toESM(require("clsx"));
|
|
61
|
+
var import_SwipeActionContext = __toESM(require("./SwipeActionContext"));
|
|
62
|
+
var import_SwipeActionItem = require("./SwipeActionItem.css");
|
|
63
|
+
const prefixCls = "bui-swipe-action-item";
|
|
64
|
+
const SwipeActionItem = /* @__PURE__ */ import_react.default.forwardRef(
|
|
65
|
+
(props, ref) => {
|
|
66
|
+
const _a = props, {
|
|
67
|
+
className,
|
|
68
|
+
children,
|
|
69
|
+
onClick,
|
|
70
|
+
color = "primary",
|
|
71
|
+
id = ""
|
|
72
|
+
} = _a, others = __objRest(_a, [
|
|
73
|
+
"className",
|
|
74
|
+
"children",
|
|
75
|
+
"onClick",
|
|
76
|
+
"color",
|
|
77
|
+
"id"
|
|
78
|
+
]);
|
|
79
|
+
const { closeOnClickActionItem, close } = (0, import_react.useContext)(import_SwipeActionContext.default);
|
|
80
|
+
const onClickHandle = (e) => {
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
if (closeOnClickActionItem) {
|
|
83
|
+
close == null ? void 0 : close();
|
|
84
|
+
}
|
|
85
|
+
onClick == null ? void 0 : onClick(e, {
|
|
86
|
+
color,
|
|
87
|
+
id,
|
|
88
|
+
text: children
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
92
|
+
"div",
|
|
93
|
+
__spreadValues({
|
|
94
|
+
className: (0, import_clsx.default)(prefixCls, className, {
|
|
95
|
+
[`${prefixCls}-${color}`]: color
|
|
96
|
+
}),
|
|
97
|
+
ref,
|
|
98
|
+
onClick: onClickHandle
|
|
99
|
+
}, others),
|
|
100
|
+
children
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
SwipeActionItem.displayName = "SwipeActionItem";
|
|
105
|
+
var SwipeActionItem_default = SwipeActionItem;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
DragPhaseEnum: () => DragPhaseEnum,
|
|
21
|
+
SideTypeEnum: () => SideTypeEnum
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(constants_exports);
|
|
24
|
+
var SideTypeEnum = /* @__PURE__ */ ((SideTypeEnum2) => {
|
|
25
|
+
SideTypeEnum2["LEFT"] = "left";
|
|
26
|
+
SideTypeEnum2["RIGHT"] = "right";
|
|
27
|
+
return SideTypeEnum2;
|
|
28
|
+
})(SideTypeEnum || {});
|
|
29
|
+
var DragPhaseEnum = /* @__PURE__ */ ((DragPhaseEnum2) => {
|
|
30
|
+
DragPhaseEnum2[DragPhaseEnum2["START"] = 1] = "START";
|
|
31
|
+
DragPhaseEnum2[DragPhaseEnum2["MOVE"] = 2] = "MOVE";
|
|
32
|
+
DragPhaseEnum2[DragPhaseEnum2["END"] = 3] = "END";
|
|
33
|
+
return DragPhaseEnum2;
|
|
34
|
+
})(DragPhaseEnum || {});
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
DragPhaseEnum,
|
|
38
|
+
SideTypeEnum
|
|
39
|
+
});
|