@bifrostui/react 1.4.6 → 1.4.7-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Calendar/Calendar.js +5 -1
- package/dist/Calendar/Calendar.types.d.ts +5 -0
- package/dist/CitySelector/CitySelectorCore.js +3 -3
- 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 +43 -0
- package/dist/DatePicker/DatePicker.types.js +35 -0
- package/dist/DatePicker/index.d.ts +2 -0
- package/dist/DatePicker/index.js +41 -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 +238 -0
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +57 -0
- package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
- package/dist/DesktopPicker/index.css +37 -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 +246 -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/FunctionalDialog.js +1 -1
- package/dist/ItemSelector/ItemSelector.css +120 -0
- package/dist/ItemSelector/ItemSelector.d.ts +4 -0
- package/dist/ItemSelector/ItemSelector.js +84 -0
- package/dist/ItemSelector/ItemSelector.miniapp.d.ts +5 -0
- package/dist/ItemSelector/ItemSelector.miniapp.js +125 -0
- package/dist/ItemSelector/ItemSelector.types.d.ts +40 -0
- package/dist/ItemSelector/ItemSelector.types.js +15 -0
- package/dist/ItemSelector/ItemSelectorCore.d.ts +5 -0
- package/dist/ItemSelector/ItemSelectorCore.js +217 -0
- package/dist/ItemSelector/Selector/index.css +11 -0
- package/dist/ItemSelector/Selector/index.d.ts +9 -0
- package/dist/ItemSelector/Selector/index.js +48 -0
- package/dist/ItemSelector/index.d.ts +2 -0
- package/dist/ItemSelector/index.js +41 -0
- package/dist/ItemSelector/miniapp.css +4 -0
- 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 +63 -40
- 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 +83 -0
- package/dist/SwipeAction/SwipeAction.types.js +39 -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/index.d.ts +4 -0
- package/dist/SwipeAction/index.js +45 -0
- package/dist/Tabs/Tab.js +13 -4
- package/dist/Tabs/Tabs.js +30 -15
- package/dist/Tabs/utils/scroll.d.ts +2 -0
- package/dist/Tabs/utils/scroll.js +55 -0
- package/dist/Toast/FunctionalToast.js +1 -1
- package/dist/Toast/Toast.css +0 -1
- package/dist/Tooltip/Tooltip.js +70 -27
- package/dist/index.d.ts +7 -0
- package/dist/index.js +15 -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/CitySelector/CitySelectorCore.js +3 -3
- 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 +310 -0
- package/es/DatePicker/DatePicker.types.d.ts +43 -0
- package/es/DatePicker/DatePicker.types.js +1 -0
- package/es/DatePicker/index.d.ts +2 -0
- package/es/DatePicker/index.js +6 -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 +221 -0
- package/es/DesktopPicker/DesktopPicker.types.d.ts +57 -0
- package/es/DesktopPicker/DesktopPicker.types.js +1 -0
- package/es/DesktopPicker/index.css +37 -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 +223 -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/FunctionalDialog.js +2 -2
- package/es/ItemSelector/ItemSelector.css +120 -0
- package/es/ItemSelector/ItemSelector.d.ts +4 -0
- package/es/ItemSelector/ItemSelector.js +57 -0
- package/es/ItemSelector/ItemSelector.miniapp.d.ts +5 -0
- package/es/ItemSelector/ItemSelector.miniapp.js +98 -0
- package/es/ItemSelector/ItemSelector.types.d.ts +40 -0
- package/es/ItemSelector/ItemSelector.types.js +1 -0
- package/es/ItemSelector/ItemSelectorCore.d.ts +5 -0
- package/es/ItemSelector/ItemSelectorCore.js +190 -0
- package/es/ItemSelector/Selector/index.css +11 -0
- package/es/ItemSelector/Selector/index.d.ts +9 -0
- package/es/ItemSelector/Selector/index.js +19 -0
- package/es/ItemSelector/index.d.ts +2 -0
- package/es/ItemSelector/index.js +6 -0
- package/es/ItemSelector/miniapp.css +4 -0
- package/es/Modal/Modal.miniapp.d.ts +1 -1
- 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 +63 -41
- 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 +337 -0
- package/es/SwipeAction/SwipeAction.types.d.ts +83 -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/index.d.ts +4 -0
- package/es/SwipeAction/index.js +9 -0
- package/es/Tabs/Tab.js +13 -4
- package/es/Tabs/Tabs.js +30 -15
- package/es/Tabs/utils/scroll.d.ts +2 -0
- package/es/Tabs/utils/scroll.js +36 -0
- package/es/Toast/FunctionalToast.js +2 -2
- package/es/Toast/Toast.css +0 -1
- package/es/Tooltip/Tooltip.js +73 -29
- package/es/index.d.ts +7 -0
- package/es/index.js +7 -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
|
@@ -10,6 +10,10 @@ export interface IPickerOptionItem {
|
|
|
10
10
|
* 选项对应唯一的值
|
|
11
11
|
*/
|
|
12
12
|
value: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* 是否禁用
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
13
17
|
}
|
|
14
18
|
export type ICascadePickerChildOptionItem = IPickerOptionItem & {
|
|
15
19
|
/**
|
|
@@ -34,6 +38,14 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
|
|
|
34
38
|
* 标题
|
|
35
39
|
*/
|
|
36
40
|
title?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 确认文本内容
|
|
43
|
+
*/
|
|
44
|
+
confirmText?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 取消文本内容
|
|
47
|
+
*/
|
|
48
|
+
cancelText?: string;
|
|
37
49
|
/**
|
|
38
50
|
* 列表数据
|
|
39
51
|
* @default []
|
|
@@ -61,6 +73,7 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
|
|
|
61
73
|
value: (string | number)[];
|
|
62
74
|
options: ICascadePickerChildOptionItem[][];
|
|
63
75
|
currentOption: ICascadePickerChildOptionItem;
|
|
76
|
+
columnIndex: number;
|
|
64
77
|
}) => void;
|
|
65
78
|
/**
|
|
66
79
|
* 点击取消按钮时候回调
|
|
@@ -85,9 +98,9 @@ export type PickerPanelProps<D extends React.ElementType = 'div', P = {}> = Over
|
|
|
85
98
|
*/
|
|
86
99
|
options?: ICascadePickerChildOptionItem[];
|
|
87
100
|
/**
|
|
88
|
-
*
|
|
101
|
+
* 选中值
|
|
89
102
|
*/
|
|
90
|
-
|
|
103
|
+
value?: string | number;
|
|
91
104
|
/**
|
|
92
105
|
* 列索引
|
|
93
106
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.bui-picker-panel {
|
|
2
|
+
--bui-picker-option-disabled-opacity: 0.38;
|
|
2
3
|
flex: 1;
|
|
3
4
|
flex-shrink: 0;
|
|
4
5
|
position: relative;
|
|
@@ -56,6 +57,9 @@
|
|
|
56
57
|
white-space: nowrap;
|
|
57
58
|
width: 100%;
|
|
58
59
|
}
|
|
60
|
+
.bui-picker-panel-option-disabled {
|
|
61
|
+
opacity: var(--bui-picker-option-disabled-opacity);
|
|
62
|
+
}
|
|
59
63
|
.bui-picker-panel-option-hidden {
|
|
60
64
|
visibility: hidden;
|
|
61
65
|
opacity: 0;
|
|
@@ -66,13 +66,13 @@ const PickerPanel = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
66
66
|
var _b;
|
|
67
67
|
const _a = props, {
|
|
68
68
|
options = [],
|
|
69
|
-
|
|
69
|
+
value,
|
|
70
70
|
onSelect,
|
|
71
71
|
columnIndex,
|
|
72
72
|
pickerStyle
|
|
73
73
|
} = _a, others = __objRest(_a, [
|
|
74
74
|
"options",
|
|
75
|
-
"
|
|
75
|
+
"value",
|
|
76
76
|
"onSelect",
|
|
77
77
|
"columnIndex",
|
|
78
78
|
"pickerStyle"
|
|
@@ -102,9 +102,9 @@ const PickerPanel = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
102
102
|
(0, import_utils.useTouchEmulator)(PickerPanelRef.current);
|
|
103
103
|
const updateSelect = () => {
|
|
104
104
|
let index = -1;
|
|
105
|
-
if (
|
|
105
|
+
if (value) {
|
|
106
106
|
options.some((item, idx) => {
|
|
107
|
-
if (item.value ===
|
|
107
|
+
if (item.value === value) {
|
|
108
108
|
index = idx;
|
|
109
109
|
return true;
|
|
110
110
|
}
|
|
@@ -122,7 +122,7 @@ const PickerPanel = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
122
122
|
return () => {
|
|
123
123
|
clearTimeout(timer);
|
|
124
124
|
};
|
|
125
|
-
}, [options]);
|
|
125
|
+
}, [options, value]);
|
|
126
126
|
const setTransform = (type, deg, time = DEFAULT_DURATION, translateY = 0) => {
|
|
127
127
|
let nTime = time;
|
|
128
128
|
if (type !== TOUCH_END) {
|
|
@@ -255,7 +255,8 @@ const PickerPanel = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
255
255
|
"div",
|
|
256
256
|
{
|
|
257
257
|
className: (0, import_clsx.default)(`${prefixCls}-option`, {
|
|
258
|
-
[`${prefixCls}-option-hidden`]: i + 1 <= currIndex - 8 || i + 1 >= currIndex + 8
|
|
258
|
+
[`${prefixCls}-option-hidden`]: i + 1 <= currIndex - 8 || i + 1 >= currIndex + 8,
|
|
259
|
+
[`${prefixCls}-option-disabled`]: item == null ? void 0 : item.disabled
|
|
259
260
|
}),
|
|
260
261
|
key: `${item == null ? void 0 : item.value}-${i}`,
|
|
261
262
|
style: {
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -51,6 +51,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
51
51
|
mod
|
|
52
52
|
));
|
|
53
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
|
+
};
|
|
54
74
|
var Popover_exports = {};
|
|
55
75
|
__export(Popover_exports, {
|
|
56
76
|
default: () => Popover_default
|
|
@@ -73,9 +93,9 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
73
93
|
offsetSpacing = 0,
|
|
74
94
|
placement = "top",
|
|
75
95
|
trigger = "click",
|
|
76
|
-
onOpenChange,
|
|
77
96
|
open,
|
|
78
|
-
hideArrow
|
|
97
|
+
hideArrow,
|
|
98
|
+
onOpenChange
|
|
79
99
|
} = _a, others = __objRest(_a, [
|
|
80
100
|
"className",
|
|
81
101
|
"style",
|
|
@@ -86,9 +106,9 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
86
106
|
"offsetSpacing",
|
|
87
107
|
"placement",
|
|
88
108
|
"trigger",
|
|
89
|
-
"onOpenChange",
|
|
90
109
|
"open",
|
|
91
|
-
"hideArrow"
|
|
110
|
+
"hideArrow",
|
|
111
|
+
"onOpenChange"
|
|
92
112
|
]);
|
|
93
113
|
const controlByUser = typeof open !== "undefined";
|
|
94
114
|
const { direction, location = "center" } = (0, import_utils.parsePlacement)(placement);
|
|
@@ -96,11 +116,18 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
96
116
|
const [openStatus, setOpenStatus] = (0, import_react.useState)(defaultOpen);
|
|
97
117
|
const [arrowDirection, setArrowDirection] = (0, import_react.useState)(direction);
|
|
98
118
|
const [arrowLocation, setArrowLocation] = (0, import_react.useState)(location);
|
|
99
|
-
const [
|
|
100
|
-
const
|
|
119
|
+
const [toolStyles, setToolStyles] = (0, import_react.useState)({});
|
|
120
|
+
const tipRef = (0, import_react.useRef)(null);
|
|
121
|
+
const nodeRef = (0, import_utils.useForkRef)(ref, tipRef);
|
|
122
|
+
const clearRef = (status) => {
|
|
123
|
+
if (status === false) {
|
|
124
|
+
tipRef.current = null;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
101
127
|
const changeOpenStatus = (event, status) => {
|
|
102
128
|
if (controlByUser)
|
|
103
129
|
return;
|
|
130
|
+
clearRef(status);
|
|
104
131
|
setOpenStatus(status);
|
|
105
132
|
onOpenChange == null ? void 0 : onOpenChange(event, { open: status });
|
|
106
133
|
};
|
|
@@ -119,23 +146,33 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
119
146
|
if (!controlByUser)
|
|
120
147
|
return;
|
|
121
148
|
setOpenStatus(open);
|
|
149
|
+
clearRef(open);
|
|
122
150
|
}, [open]);
|
|
151
|
+
(0, import_react.useEffect)(() => {
|
|
152
|
+
if (!openStatus) {
|
|
153
|
+
setToolStyles({
|
|
154
|
+
visibility: "hidden"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}, [openStatus]);
|
|
123
158
|
const clickEventHandler = (event) => {
|
|
124
159
|
if (trigger === "hover" || (trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover")
|
|
125
160
|
return;
|
|
126
161
|
hidePopover(event);
|
|
127
162
|
};
|
|
128
|
-
const onRootElementMouted = (0, import_utils.throttle)(() => {
|
|
163
|
+
const onRootElementMouted = (0, import_utils.throttle)(() => __async(void 0, null, function* () {
|
|
164
|
+
if (!tipRef.current)
|
|
165
|
+
return;
|
|
129
166
|
const {
|
|
130
167
|
direction: newParsedDirection,
|
|
131
168
|
location: newParsedLocation = "center"
|
|
132
169
|
} = (0, import_utils.parsePlacement)(placement);
|
|
133
|
-
const result = (0, import_utils.getStylesAndLocation)({
|
|
170
|
+
const result = yield (0, import_utils.getStylesAndLocation)({
|
|
134
171
|
childrenRef,
|
|
135
172
|
arrowDirection: newParsedDirection,
|
|
136
173
|
arrowLocation: newParsedLocation,
|
|
137
174
|
offsetSpacing,
|
|
138
|
-
|
|
175
|
+
tipRef
|
|
139
176
|
});
|
|
140
177
|
if (!result)
|
|
141
178
|
return;
|
|
@@ -146,26 +183,32 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
146
183
|
if (newArrowLocation !== arrowLocation) {
|
|
147
184
|
setArrowLocation(newArrowLocation);
|
|
148
185
|
}
|
|
149
|
-
|
|
150
|
-
}, 100);
|
|
151
|
-
const bindEvent = () => {
|
|
152
|
-
if (!controlByUser) {
|
|
153
|
-
document.addEventListener("click", clickEventHandler);
|
|
154
|
-
}
|
|
155
|
-
window.addEventListener("resize", onRootElementMouted);
|
|
156
|
-
};
|
|
157
|
-
const unbindEvent = () => {
|
|
158
|
-
if (!controlByUser) {
|
|
159
|
-
document.removeEventListener("click", clickEventHandler);
|
|
160
|
-
}
|
|
161
|
-
window.removeEventListener("resize", onRootElementMouted);
|
|
162
|
-
};
|
|
186
|
+
setToolStyles(styles);
|
|
187
|
+
}), 100);
|
|
163
188
|
(0, import_react.useEffect)(() => {
|
|
189
|
+
const bindEvent = () => {
|
|
190
|
+
if (!tipRef.current)
|
|
191
|
+
return;
|
|
192
|
+
if (!controlByUser) {
|
|
193
|
+
document.addEventListener("click", clickEventHandler);
|
|
194
|
+
}
|
|
195
|
+
if (!import_utils.isMini) {
|
|
196
|
+
window.addEventListener("resize", onRootElementMouted);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
const unbindEvent = () => {
|
|
200
|
+
if (!controlByUser) {
|
|
201
|
+
document.removeEventListener("click", clickEventHandler);
|
|
202
|
+
}
|
|
203
|
+
if (!import_utils.isMini) {
|
|
204
|
+
window.removeEventListener("resize", onRootElementMouted);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
164
207
|
bindEvent();
|
|
165
208
|
return () => {
|
|
166
209
|
unbindEvent();
|
|
167
210
|
};
|
|
168
|
-
}, []);
|
|
211
|
+
}, [openStatus]);
|
|
169
212
|
if (!title && !content)
|
|
170
213
|
return null;
|
|
171
214
|
let triggerEventOption;
|
|
@@ -180,14 +223,14 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
180
223
|
const childrenOptions = __spreadValues({
|
|
181
224
|
ref: childrenRef
|
|
182
225
|
}, triggerEventOption);
|
|
183
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, open || openStatus ? /* @__PURE__ */ import_react.default.createElement(import_Portal.default, { onRootElementMouted
|
|
226
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, open || openStatus ? /* @__PURE__ */ import_react.default.createElement(import_Portal.default, { onRootElementMouted }, /* @__PURE__ */ import_react.default.createElement(
|
|
184
227
|
"div",
|
|
185
228
|
__spreadValues({
|
|
186
229
|
className: (0, import_clsx.default)(prefixCls, className, `popover-${arrowDirection}`, {
|
|
187
230
|
"bui-popover-arrow-hide": hideArrow
|
|
188
231
|
}),
|
|
189
|
-
|
|
190
|
-
|
|
232
|
+
style: __spreadValues(__spreadValues({}, style), toolStyles),
|
|
233
|
+
ref: nodeRef
|
|
191
234
|
}, others),
|
|
192
235
|
!hideArrow ? /* @__PURE__ */ import_react.default.createElement(
|
|
193
236
|
"div",
|
|
@@ -53,7 +53,9 @@ var import_react = __toESM(require("react"));
|
|
|
53
53
|
var import_PortalCore = __toESM(require("./PortalCore"));
|
|
54
54
|
const Portal = (0, import_react.forwardRef)((props, ref) => {
|
|
55
55
|
const { disablePortal } = props;
|
|
56
|
-
const rootWrapperElement = (0, import_react.
|
|
56
|
+
const [rootWrapperElement, setRootWrapperElement] = (0, import_react.useState)();
|
|
57
|
+
(0, import_react.useEffect)(() => {
|
|
58
|
+
let root;
|
|
57
59
|
if (!disablePortal) {
|
|
58
60
|
const currentPages = import_taro.default.getCurrentPages() || [];
|
|
59
61
|
const currentPage = currentPages[currentPages.length - 1];
|
|
@@ -65,11 +67,12 @@ const Portal = (0, import_react.forwardRef)((props, ref) => {
|
|
|
65
67
|
const view = document.createElement("view");
|
|
66
68
|
view.id = portalId;
|
|
67
69
|
rootElement == null ? void 0 : rootElement.appendChild(view);
|
|
68
|
-
|
|
70
|
+
root = view;
|
|
71
|
+
} else {
|
|
72
|
+
root = portalWrapperElement;
|
|
69
73
|
}
|
|
70
|
-
return portalWrapperElement;
|
|
71
74
|
}
|
|
72
|
-
|
|
75
|
+
setRootWrapperElement(root);
|
|
73
76
|
}, []);
|
|
74
77
|
return /* @__PURE__ */ import_react.default.createElement(import_PortalCore.default, __spreadProps(__spreadValues({}, props), { ref, rootElement: rootWrapperElement }));
|
|
75
78
|
});
|
|
@@ -34,12 +34,14 @@ var import_utils = require("@bifrostui/utils");
|
|
|
34
34
|
var import_clsx = __toESM(require("clsx"));
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_ScrollView = require("./ScrollView.css");
|
|
37
|
-
function easeOutScroll(from, to, callback) {
|
|
37
|
+
function easeOutScroll(from, to, callback, dur) {
|
|
38
|
+
if (dur <= 0) {
|
|
39
|
+
dur = 500;
|
|
40
|
+
}
|
|
38
41
|
if (from === to || typeof from !== "number") {
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
44
|
const change = to - from;
|
|
42
|
-
const dur = 500;
|
|
43
45
|
const sTime = +/* @__PURE__ */ new Date();
|
|
44
46
|
function linear(t, b, c, d) {
|
|
45
47
|
return c * t / d + b;
|
|
@@ -74,7 +76,8 @@ const ScrollView = (0, import_react.forwardRef)(
|
|
|
74
76
|
scrollIntoView,
|
|
75
77
|
onTouchMove: propsOnTouchMove,
|
|
76
78
|
scrollIntoViewAlignment,
|
|
77
|
-
children
|
|
79
|
+
children,
|
|
80
|
+
scrollAnimationDuration = 500
|
|
78
81
|
} = props;
|
|
79
82
|
const container = (0, import_react.useRef)(null);
|
|
80
83
|
const handleRef = (0, import_utils.useForkRef)(ref, container);
|
|
@@ -84,10 +87,15 @@ const ScrollView = (0, import_react.forwardRef)(
|
|
|
84
87
|
if (top === void 0)
|
|
85
88
|
return;
|
|
86
89
|
if (isAnimation) {
|
|
87
|
-
easeOutScroll(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
easeOutScroll(
|
|
91
|
+
container.current.scrollTop,
|
|
92
|
+
top,
|
|
93
|
+
(pos) => {
|
|
94
|
+
if (container.current)
|
|
95
|
+
container.current.scrollTop = pos;
|
|
96
|
+
},
|
|
97
|
+
scrollAnimationDuration
|
|
98
|
+
);
|
|
91
99
|
} else if (container.current)
|
|
92
100
|
container.current.scrollTop = top;
|
|
93
101
|
}, []);
|
|
@@ -95,10 +103,15 @@ const ScrollView = (0, import_react.forwardRef)(
|
|
|
95
103
|
if (left === void 0)
|
|
96
104
|
return;
|
|
97
105
|
if (isAnimation) {
|
|
98
|
-
easeOutScroll(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
easeOutScroll(
|
|
107
|
+
container.current.scrollLeft,
|
|
108
|
+
left,
|
|
109
|
+
(pos) => {
|
|
110
|
+
if (container.current)
|
|
111
|
+
container.current.scrollLeft = pos;
|
|
112
|
+
},
|
|
113
|
+
scrollAnimationDuration
|
|
114
|
+
);
|
|
102
115
|
} else if (container.current)
|
|
103
116
|
container.current.scrollLeft = left;
|
|
104
117
|
}, []);
|
|
@@ -138,7 +138,6 @@ export type ScrollViewProps<D extends React.ElementType = 'div', P = {}> = Overr
|
|
|
138
138
|
*/
|
|
139
139
|
fastDeceleration?: boolean;
|
|
140
140
|
/** 当 scroll-with-animation设置为 true 时,可以设置 scroll-animation-duration 来控制动画的执行时间,单位 ms。
|
|
141
|
-
* 仅小程序可用
|
|
142
141
|
*/
|
|
143
142
|
scrollAnimationDuration?: number;
|
|
144
143
|
/** 纵向滚动时,当滚动到顶部或底部时,强制禁止触发页面滚动,仍然只触发 scroll-view 自身的滚动。
|
package/dist/Select/Select.css
CHANGED
|
@@ -48,13 +48,9 @@
|
|
|
48
48
|
.bui-select-option-container {
|
|
49
49
|
position: absolute;
|
|
50
50
|
box-sizing: border-box;
|
|
51
|
-
top: 100%;
|
|
52
|
-
left: 0;
|
|
53
|
-
width: 100%;
|
|
54
51
|
font-size: var(--bui-select-font-size, var(--bui-title-size-3));
|
|
55
52
|
z-index: var(--bui-z-index-tooltip);
|
|
56
53
|
border-radius: 3px;
|
|
57
|
-
background-color: var(--bui-color-bg-view);
|
|
58
54
|
padding: 2px;
|
|
59
55
|
overflow: hidden;
|
|
60
56
|
}
|
|
@@ -71,6 +67,7 @@
|
|
|
71
67
|
border-radius: 3px;
|
|
72
68
|
padding: var(--bui-select-option-container-padding, 3px 0);
|
|
73
69
|
box-shadow: 0 0 0 2px var(--bui-color-bg-default);
|
|
70
|
+
background-color: var(--bui-color-bg-view);
|
|
74
71
|
overflow: hidden;
|
|
75
72
|
}
|
|
76
73
|
.bui-select-option {
|
package/dist/Select/Select.js
CHANGED
|
@@ -54,6 +54,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
54
54
|
mod
|
|
55
55
|
));
|
|
56
56
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
57
|
+
var __async = (__this, __arguments, generator) => {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
var fulfilled = (value) => {
|
|
60
|
+
try {
|
|
61
|
+
step(generator.next(value));
|
|
62
|
+
} catch (e) {
|
|
63
|
+
reject(e);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var rejected = (value) => {
|
|
67
|
+
try {
|
|
68
|
+
step(generator.throw(value));
|
|
69
|
+
} catch (e) {
|
|
70
|
+
reject(e);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
74
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
75
|
+
});
|
|
76
|
+
};
|
|
57
77
|
var Select_exports = {};
|
|
58
78
|
__export(Select_exports, {
|
|
59
79
|
default: () => Select_default
|
|
@@ -121,38 +141,36 @@ const Select = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
121
141
|
const isOpen = open !== void 0 ? open : internalOpen;
|
|
122
142
|
const locatorRef = (0, import_react.useRef)(null);
|
|
123
143
|
const rootRef = (0, import_utils.useForkRef)(ref, locatorRef);
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const updateOptionStyle = (0,
|
|
144
|
+
const optionContainerRef = (0, import_react.useRef)(null);
|
|
145
|
+
const optionMainRef = (0, import_react.useRef)(null);
|
|
146
|
+
const updateOptionStyle = () => __async(void 0, null, function* () {
|
|
127
147
|
const curScrollRoot = scrollContainer();
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
const changeOpen = (newOpen) => {
|
|
148
|
+
const result = yield (0, import_utils.getStylesAndLocation)({
|
|
149
|
+
scrollRoot: curScrollRoot,
|
|
150
|
+
childrenRef: locatorRef,
|
|
151
|
+
tipRef: optionContainerRef,
|
|
152
|
+
arrowDirection: defaultPlacement,
|
|
153
|
+
arrowLocation: "none",
|
|
154
|
+
offsetSpacing: 0
|
|
155
|
+
});
|
|
156
|
+
if (!result)
|
|
157
|
+
return;
|
|
158
|
+
const { styles, childrenStyle, newArrowDirection } = result;
|
|
159
|
+
optionMainRef.current.style.transition = "none";
|
|
160
|
+
optionMainRef.current.style.transform = `translateY(${newArrowDirection === "bottom" ? "-100%" : "100%"})`;
|
|
161
|
+
setPlacement(newArrowDirection);
|
|
162
|
+
setOptionStyle(__spreadProps(__spreadValues({}, styles), { width: childrenStyle == null ? void 0 : childrenStyle.width }));
|
|
163
|
+
});
|
|
164
|
+
const changeOpen = (newOpen) => __async(void 0, null, function* () {
|
|
145
165
|
if (newOpen) {
|
|
146
|
-
updateOptionStyle();
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
onOpen == null ? void 0 : onOpen();
|
|
150
|
-
}, 100);
|
|
166
|
+
yield updateOptionStyle();
|
|
167
|
+
setInternalOpen(newOpen);
|
|
168
|
+
onOpen == null ? void 0 : onOpen();
|
|
151
169
|
} else {
|
|
152
170
|
onClose == null ? void 0 : onClose();
|
|
153
171
|
setInternalOpen(newOpen);
|
|
154
172
|
}
|
|
155
|
-
};
|
|
173
|
+
});
|
|
156
174
|
const handleSelectClick = (e) => {
|
|
157
175
|
if (disabled)
|
|
158
176
|
return;
|
|
@@ -177,10 +195,11 @@ const Select = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
177
195
|
[selectValue, onChange, setRenderValue]
|
|
178
196
|
);
|
|
179
197
|
(0, import_react.useEffect)(() => {
|
|
198
|
+
const resizeCb = (0, import_utils.throttle)(updateOptionStyle, 100);
|
|
180
199
|
if (!import_utils.isMini) {
|
|
181
|
-
window.addEventListener("resize",
|
|
200
|
+
window.addEventListener("resize", resizeCb);
|
|
182
201
|
return () => {
|
|
183
|
-
window.removeEventListener("resize",
|
|
202
|
+
window.removeEventListener("resize", resizeCb);
|
|
184
203
|
};
|
|
185
204
|
}
|
|
186
205
|
}, []);
|
|
@@ -198,8 +217,8 @@ const Select = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
198
217
|
{
|
|
199
218
|
in: isOpen,
|
|
200
219
|
timeout: {
|
|
201
|
-
enter:
|
|
202
|
-
exit:
|
|
220
|
+
enter: 167,
|
|
221
|
+
exit: 167
|
|
203
222
|
}
|
|
204
223
|
},
|
|
205
224
|
/* @__PURE__ */ import_react.default.createElement(
|
|
@@ -213,7 +232,7 @@ const Select = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
213
232
|
[`${prefixCls}-option-container-hide`]: !isOpen
|
|
214
233
|
}
|
|
215
234
|
),
|
|
216
|
-
|
|
235
|
+
ref: optionContainerRef,
|
|
217
236
|
style: optionStyle
|
|
218
237
|
},
|
|
219
238
|
/* @__PURE__ */ import_react.default.createElement(
|
|
@@ -222,11 +241,18 @@ const Select = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
222
241
|
in: isOpen,
|
|
223
242
|
direction: placement === "bottom" ? "down" : "up",
|
|
224
243
|
timeout: {
|
|
225
|
-
enter:
|
|
226
|
-
exit:
|
|
244
|
+
enter: 167,
|
|
245
|
+
exit: 167
|
|
227
246
|
}
|
|
228
247
|
},
|
|
229
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
248
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
className: (0, import_clsx.default)(`${prefixCls}-option-main`),
|
|
252
|
+
ref: optionMainRef
|
|
253
|
+
},
|
|
254
|
+
children
|
|
255
|
+
)
|
|
230
256
|
)
|
|
231
257
|
)
|
|
232
258
|
);
|
|
@@ -254,9 +280,8 @@ const Select = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
254
280
|
[inputProps == null ? void 0 : inputProps.className]: inputProps == null ? void 0 : inputProps.className
|
|
255
281
|
})
|
|
256
282
|
})
|
|
257
|
-
), icon || defaultIcon)
|
|
258
|
-
|
|
259
|
-
), !import_utils.isMini && /* @__PURE__ */ import_react.default.createElement(import_Portal.default, { onRootElementMouted: updateOptionStyle }, renderOptions()), /* @__PURE__ */ import_react.default.createElement(
|
|
283
|
+
), icon || defaultIcon)
|
|
284
|
+
), /* @__PURE__ */ import_react.default.createElement(import_Portal.default, { onRootElementMouted: updateOptionStyle }, renderOptions()), /* @__PURE__ */ import_react.default.createElement(
|
|
260
285
|
import_Backdrop.default,
|
|
261
286
|
__spreadProps(__spreadValues({
|
|
262
287
|
open: isOpen,
|
|
@@ -273,8 +298,6 @@ const Select = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
273
298
|
Select.displayName = "BuiSelect";
|
|
274
299
|
Select.defaultProps = {
|
|
275
300
|
defaultValue: "",
|
|
276
|
-
scrollContainer: () =>
|
|
277
|
-
return import_utils.isMini ? null : document.body;
|
|
278
|
-
}
|
|
301
|
+
scrollContainer: () => null
|
|
279
302
|
};
|
|
280
303
|
var Select_default = Select;
|
package/dist/Slider/Slider.js
CHANGED
|
@@ -128,7 +128,6 @@ const Slider = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
128
128
|
const value = shouldProtection ? latestVal.current : valueProp;
|
|
129
129
|
const [rootRef, setRootRef] = (0, import_react.useState)(null);
|
|
130
130
|
const handleRef = (0, import_utils.useForkRef)(ref, setRootRef);
|
|
131
|
-
(0, import_utils.useTouchEmulator)(rootRef);
|
|
132
131
|
const sliderRect = (0, import_react.useRef)();
|
|
133
132
|
const touchStartPageX = (0, import_react.useRef)();
|
|
134
133
|
const touchStartLeft = (0, import_react.useRef)();
|
|
@@ -199,9 +198,7 @@ const Slider = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
199
198
|
return;
|
|
200
199
|
beforeMoveValue.current = internalValue;
|
|
201
200
|
tooltipRef.current = internalValue;
|
|
202
|
-
|
|
203
|
-
getLineWidth();
|
|
204
|
-
}
|
|
201
|
+
getLineWidth();
|
|
205
202
|
const currentTarget = import_utils.isMini ? e.mpEvent.currentTarget : e.currentTarget;
|
|
206
203
|
touchStartPageX.current = e.touches[0].pageX;
|
|
207
204
|
touchStartLeft.current = currentTarget == null ? void 0 : currentTarget.offsetLeft;
|
|
@@ -260,6 +257,16 @@ const Slider = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
260
257
|
setFrontTooltipVisible(false);
|
|
261
258
|
setEndTooltipVisible(false);
|
|
262
259
|
};
|
|
260
|
+
const onMouseUp = (e) => {
|
|
261
|
+
(0, import_utils.emulateTouchEnd)(e);
|
|
262
|
+
document.removeEventListener("mousemove", import_utils.emulateTouchMove);
|
|
263
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
264
|
+
};
|
|
265
|
+
const onMouseDown = (e) => {
|
|
266
|
+
(0, import_utils.emulateTouchStart)(e);
|
|
267
|
+
document.addEventListener("mousemove", import_utils.emulateTouchMove);
|
|
268
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
269
|
+
};
|
|
263
270
|
const renderButton = (index) => {
|
|
264
271
|
const valuenow = internalValue[index];
|
|
265
272
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -282,7 +289,8 @@ const Slider = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
282
289
|
},
|
|
283
290
|
onTouchMove,
|
|
284
291
|
onTouchEnd,
|
|
285
|
-
onTouchCancel: onTouchEnd
|
|
292
|
+
onTouchCancel: onTouchEnd,
|
|
293
|
+
onMouseDown
|
|
286
294
|
},
|
|
287
295
|
index === SLIDER_BUTTON.FRONT ? startIcon || defaultIcon : endIcon || defaultIcon
|
|
288
296
|
);
|