@bifrostui/react 1.4.7-beta.0 → 1.4.7
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 +1 -5
- package/dist/Calendar/Calendar.types.d.ts +0 -5
- 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/Dialog/FunctionalDialog.js +1 -1
- package/dist/Modal/Modal.miniapp.d.ts +1 -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.js +27 -70
- package/dist/Portal/Portal.miniapp.js +4 -7
- 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 +40 -63
- package/dist/Slider/Slider.js +5 -13
- package/dist/Tabs/Tab.js +4 -13
- package/dist/Tabs/Tabs.js +15 -30
- package/dist/Tabs/utils/bound.d.ts +1 -0
- package/dist/{DesktopPicker/utils/calcAfterMounted.js → Tabs/utils/bound.js} +14 -7
- package/dist/Toast/FunctionalToast.js +1 -1
- package/dist/Toast/Toast.css +1 -0
- package/dist/Tooltip/Tooltip.js +27 -70
- 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/Calendar/Calendar.js +1 -5
- package/es/Calendar/Calendar.types.d.ts +0 -5
- 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/Dialog/FunctionalDialog.js +2 -2
- 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.js +29 -73
- package/es/Portal/Portal.miniapp.js +5 -8
- 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 +41 -63
- package/es/Slider/Slider.js +6 -16
- package/es/Tabs/Tab.js +4 -13
- package/es/Tabs/Tabs.js +15 -30
- package/es/Tabs/utils/bound.d.ts +1 -0
- package/es/Tabs/utils/bound.js +13 -0
- package/es/Toast/FunctionalToast.js +2 -2
- package/es/Toast/Toast.css +1 -0
- package/es/Tooltip/Tooltip.js +29 -73
- 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 +5 -5
- 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 -43
- package/dist/DatePicker/DatePicker.types.js +0 -35
- package/dist/DatePicker/index.d.ts +0 -2
- package/dist/DatePicker/index.js +0 -41
- 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 -246
- 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 -83
- package/dist/SwipeAction/SwipeAction.types.js +0 -39
- 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/index.d.ts +0 -4
- package/dist/SwipeAction/index.js +0 -45
- 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 -310
- package/es/DatePicker/DatePicker.types.d.ts +0 -43
- package/es/DatePicker/DatePicker.types.js +0 -1
- package/es/DatePicker/index.d.ts +0 -2
- package/es/DatePicker/index.js +0 -6
- 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 -223
- 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 -337
- package/es/SwipeAction/SwipeAction.types.d.ts +0 -83
- 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/index.d.ts +0 -4
- package/es/SwipeAction/index.js +0 -9
- package/es/Tabs/utils/scroll.d.ts +0 -2
- package/es/Tabs/utils/scroll.js +0 -36
|
@@ -64,13 +64,11 @@ var import_utils = require("@bifrostui/utils");
|
|
|
64
64
|
var import_clsx = __toESM(require("clsx"));
|
|
65
65
|
var import_dayjs = __toESM(require("dayjs"));
|
|
66
66
|
var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
|
|
67
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
68
67
|
var import_react = __toESM(require("react"));
|
|
69
68
|
var import_utils2 = require("./utils");
|
|
70
69
|
var import_locales = require("../locales");
|
|
71
70
|
var import_Calendar2 = require("./Calendar.css");
|
|
72
71
|
import_dayjs.default.extend(import_isoWeek.default);
|
|
73
|
-
import_dayjs.default.extend(import_customParseFormat.default);
|
|
74
72
|
const classes = {
|
|
75
73
|
root: "bui-calendar",
|
|
76
74
|
handler: "bui-calendar-handler",
|
|
@@ -93,7 +91,6 @@ const Calendar = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
93
91
|
headerBarRightIcon,
|
|
94
92
|
disabledDate,
|
|
95
93
|
highlightDate,
|
|
96
|
-
headerVisible = false,
|
|
97
94
|
dateRender,
|
|
98
95
|
weekRender,
|
|
99
96
|
onMonthChange,
|
|
@@ -111,7 +108,6 @@ const Calendar = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
111
108
|
"headerBarRightIcon",
|
|
112
109
|
"disabledDate",
|
|
113
110
|
"highlightDate",
|
|
114
|
-
"headerVisible",
|
|
115
111
|
"dateRender",
|
|
116
112
|
"weekRender",
|
|
117
113
|
"onMonthChange",
|
|
@@ -326,7 +322,7 @@ const Calendar = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
326
322
|
}, others), {
|
|
327
323
|
"data-mode": mode
|
|
328
324
|
}), data),
|
|
329
|
-
|
|
325
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: classes.handler }, /* @__PURE__ */ import_react.default.createElement("div", { onClick: onClickPrev, className: `${classes.handler}-btn` }, headerBarIcon.left), /* @__PURE__ */ import_react.default.createElement("div", { className: `${classes.handler}-text` }, (0, import_dayjs.default)(renderMonth).format(headerBarFormat)), /* @__PURE__ */ import_react.default.createElement("div", { onClick: onClickNext, className: `${classes.handler}-btn` }, headerBarIcon.right)),
|
|
330
326
|
/* @__PURE__ */ import_react.default.createElement("div", { className: classes.week }, SUNDAY_WEEK_DATA == null ? void 0 : SUNDAY_WEEK_DATA.map((w) => {
|
|
331
327
|
return weekRender ? weekRender(w) : /* @__PURE__ */ import_react.default.createElement("div", { key: w, className: `${classes.week}-item` }, w);
|
|
332
328
|
})),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CollapseProps } from './Collapse.types';
|
|
3
3
|
import './Collapse.less';
|
|
4
|
-
declare const Collapse: React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<
|
|
4
|
+
declare const Collapse: React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<unknown>>;
|
|
5
5
|
export default Collapse;
|
|
@@ -61,14 +61,12 @@ __export(Collapse_exports, {
|
|
|
61
61
|
module.exports = __toCommonJS(Collapse_exports);
|
|
62
62
|
var import_react = __toESM(require("react"));
|
|
63
63
|
var import_utils = require("@bifrostui/utils");
|
|
64
|
-
var import_clsx = __toESM(require("clsx"));
|
|
65
64
|
var import_Transition = require("../Transition");
|
|
66
65
|
var import_Collapse2 = require("./Collapse.css");
|
|
67
66
|
const defaultEasing = {
|
|
68
67
|
enter: import_utils.easing.easeOut,
|
|
69
68
|
exit: import_utils.easing.sharp
|
|
70
69
|
};
|
|
71
|
-
const FIT_CONTENT = "fit-content";
|
|
72
70
|
const defaultTimeout = {
|
|
73
71
|
enter: import_utils.duration.enteringScreen,
|
|
74
72
|
exit: import_utils.duration.leavingScreen
|
|
@@ -97,6 +95,7 @@ const Collapse = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
97
95
|
"className",
|
|
98
96
|
"children"
|
|
99
97
|
]);
|
|
98
|
+
const nodeRef = (0, import_utils.useForkRef)(ref);
|
|
100
99
|
const wrapperRef = (0, import_react.useRef)(null);
|
|
101
100
|
const collapseRef = (0, import_utils.useForkRef)(wrapperRef, ref);
|
|
102
101
|
const transitions = (0, import_utils.createTransitions)();
|
|
@@ -104,11 +103,11 @@ const Collapse = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
104
103
|
const collapsedSize = typeof collapsedSizeProp === "number" ? `${collapsedSizeProp}px` : collapsedSizeProp;
|
|
105
104
|
const size = isHorizontal ? "width" : "height";
|
|
106
105
|
const getCollapseWrapperSize = (reactNode) => {
|
|
107
|
-
return reactNode ? `${reactNode[isHorizontal ? "clientWidth" : "clientHeight"]}px` :
|
|
106
|
+
return reactNode ? `${reactNode[isHorizontal ? "clientWidth" : "clientHeight"]}px` : "fit-content";
|
|
108
107
|
};
|
|
109
108
|
(0, import_react.useEffect)(() => {
|
|
110
109
|
var _a2, _b, _c, _d;
|
|
111
|
-
if (appear === false && inProp === true && ((_b = (_a2 = wrapperRef.current) == null ? void 0 : _a2.style) == null ? void 0 : _b[size]) ===
|
|
110
|
+
if (appear === false && inProp === true && ((_b = (_a2 = wrapperRef.current) == null ? void 0 : _a2.style) == null ? void 0 : _b[size]) === "fit-content") {
|
|
112
111
|
wrapperRef.current.style[size] = getCollapseWrapperSize(
|
|
113
112
|
(_d = (_c = wrapperRef.current) == null ? void 0 : _c.children) == null ? void 0 : _d[0]
|
|
114
113
|
);
|
|
@@ -119,6 +118,7 @@ const Collapse = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
119
118
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
120
119
|
import_Transition.Transition,
|
|
121
120
|
__spreadProps(__spreadValues({}, other), {
|
|
121
|
+
ref: nodeRef,
|
|
122
122
|
in: inProp,
|
|
123
123
|
timeout,
|
|
124
124
|
delay,
|
|
@@ -146,17 +146,14 @@ const Collapse = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
146
146
|
};
|
|
147
147
|
return import_react.default.createElement(
|
|
148
148
|
"div",
|
|
149
|
-
|
|
150
|
-
className:
|
|
151
|
-
className
|
|
152
|
-
}),
|
|
149
|
+
{
|
|
150
|
+
className: `bui-collapse ${className}`,
|
|
153
151
|
style: __spreadValues(__spreadProps(__spreadValues({}, style), {
|
|
154
152
|
transition,
|
|
155
153
|
WebkitTransition: transition
|
|
156
|
-
}), wrapperSize())
|
|
157
|
-
}, childProps), {
|
|
154
|
+
}), wrapperSize()),
|
|
158
155
|
ref: collapseRef
|
|
159
|
-
}
|
|
156
|
+
},
|
|
160
157
|
import_react.default.cloneElement(children, __spreadValues({
|
|
161
158
|
style: __spreadValues({}, (_a2 = children.props) == null ? void 0 : _a2.style)
|
|
162
159
|
}, childProps))
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
--width: var(--bui-collapse-panel-width, 100%);
|
|
3
3
|
--header-padding: var(--bui-collapse-panel-header-padding, var(--bui-spacing-lg) 0);
|
|
4
4
|
--content-padding: var(--bui-collapse-panel-content-padding, var(--bui-spacing-lg) 0);
|
|
5
|
-
--title-font-size: var(--bui-collapse-panel-title-font-size, var(--bui-title-size-3));
|
|
6
|
-
--content-font-size: var(--bui-collapse-panel-content-font-size, var(--bui-text-size-1));
|
|
7
5
|
width: var(--width);
|
|
8
6
|
background-color: var(--bui-color-bg-view);
|
|
9
7
|
color: var(--bui-color-fg-default);
|
|
@@ -17,7 +15,7 @@
|
|
|
17
15
|
}
|
|
18
16
|
.bui-collapse-panel-item-header-label {
|
|
19
17
|
padding: var(--header-padding);
|
|
20
|
-
font-size: var(--title-
|
|
18
|
+
font-size: var(--bui-title-size-2);
|
|
21
19
|
}
|
|
22
20
|
.bui-collapse-panel-item-header-icon-arrow {
|
|
23
21
|
transform: rotate(0deg);
|
|
@@ -28,7 +26,7 @@
|
|
|
28
26
|
}
|
|
29
27
|
.bui-collapse-panel-item-content {
|
|
30
28
|
padding: var(--content-padding);
|
|
31
|
-
font-size: var(--
|
|
29
|
+
font-size: var(--bui-text-size-1);
|
|
32
30
|
transition: height 0.5s ease;
|
|
33
31
|
overflow: hidden;
|
|
34
32
|
}
|
|
@@ -91,7 +91,7 @@ const formatProps = (props) => {
|
|
|
91
91
|
};
|
|
92
92
|
const DialogGenerator = (options) => {
|
|
93
93
|
const rootWrapper = document.createElement("div");
|
|
94
|
-
const rootElement = (0, import_utils.
|
|
94
|
+
const rootElement = (0, import_utils.getRootElement)();
|
|
95
95
|
rootElement.appendChild(rootWrapper);
|
|
96
96
|
const DialogComponent = () => {
|
|
97
97
|
const _a = options, { onConfirm, onCancel, ref } = _a, others = __objRest(_a, ["onConfirm", "onCancel", "ref"]);
|
|
@@ -12,5 +12,5 @@ declare const Modal: React.ForwardRefExoticComponent<Omit<ViewProps & {
|
|
|
12
12
|
keepMounted?: boolean;
|
|
13
13
|
} & import("@bifrostui/types").ICommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
14
|
ref?: React.Ref<HTMLDivElement>;
|
|
15
|
-
},
|
|
15
|
+
}, "open" | "container" | "disablePortal" | keyof import("@bifrostui/types").ICommonProps | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
16
|
export default Modal;
|
package/dist/Picker/Picker.css
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
--panel-container-height: var(--bui-picker-panel-height, 260px);
|
|
9
9
|
--indicator-top: var(--bui-picker-indicator-top, 108px);
|
|
10
10
|
--option-height: var(--bui-picker-option-height, 36px);
|
|
11
|
-
--bui-picker-confirm-disabled-opacity: 0.38;
|
|
12
11
|
font-family: var(--bui-font-family);
|
|
13
12
|
}
|
|
14
13
|
.bui-picker .bui-drawer-content {
|
|
@@ -42,10 +41,6 @@
|
|
|
42
41
|
line-height: var(--confirm-line-height);
|
|
43
42
|
color: var(--bui-color-primary);
|
|
44
43
|
}
|
|
45
|
-
.bui-picker-confirm-disabled {
|
|
46
|
-
color: var(--bui-color-fg-default);
|
|
47
|
-
opacity: var(--bui-picker-confirm-disabled-opacity);
|
|
48
|
-
}
|
|
49
44
|
.bui-picker-container {
|
|
50
45
|
width: 100%;
|
|
51
46
|
height: var(--panel-container-height);
|
package/dist/Picker/Picker.js
CHANGED
|
@@ -67,12 +67,6 @@ var import_locales = require("../locales");
|
|
|
67
67
|
var import_utils = require("./utils");
|
|
68
68
|
var import_Picker2 = require("./Picker.css");
|
|
69
69
|
const prefixCls = "bui-picker";
|
|
70
|
-
const checkDisabled = (values, columns) => values.find(
|
|
71
|
-
(value, index) => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
return (_b = (_a = columns == null ? void 0 : columns[index]) == null ? void 0 : _a.find((column) => (column == null ? void 0 : column.value) === value)) == null ? void 0 : _b.disabled;
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
70
|
const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
77
71
|
const _a = props, {
|
|
78
72
|
className,
|
|
@@ -80,8 +74,6 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
80
74
|
title,
|
|
81
75
|
options = [],
|
|
82
76
|
value,
|
|
83
|
-
confirmText: propConfirmText,
|
|
84
|
-
cancelText: propCancelText,
|
|
85
77
|
contentProps,
|
|
86
78
|
onConfirm,
|
|
87
79
|
onOptionChange,
|
|
@@ -93,8 +85,6 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
93
85
|
"title",
|
|
94
86
|
"options",
|
|
95
87
|
"value",
|
|
96
|
-
"confirmText",
|
|
97
|
-
"cancelText",
|
|
98
88
|
"contentProps",
|
|
99
89
|
"onConfirm",
|
|
100
90
|
"onOptionChange",
|
|
@@ -106,7 +96,6 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
106
96
|
const [columns, setColumns] = (0, import_react.useState)([]);
|
|
107
97
|
const [internalValue, setInternalValue] = (0, import_react.useState)([]);
|
|
108
98
|
const { cancel: cancelText, confirm: confirmText } = (0, import_locales.useLocaleText)("picker");
|
|
109
|
-
const disabled = checkDisabled(internalValue, columns);
|
|
110
99
|
(0, import_react.useEffect)(() => {
|
|
111
100
|
if (!open)
|
|
112
101
|
return;
|
|
@@ -129,7 +118,7 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
129
118
|
}, [value, options]);
|
|
130
119
|
const confirm = (e) => {
|
|
131
120
|
const isMoving = rollerRefs.current.some((roller) => roller == null ? void 0 : roller.isMoving);
|
|
132
|
-
if (isMoving
|
|
121
|
+
if (isMoving)
|
|
133
122
|
return;
|
|
134
123
|
const { safeValue } = (0, import_utils.safeData)({
|
|
135
124
|
value: internalValue,
|
|
@@ -188,8 +177,7 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
188
177
|
onOptionChange == null ? void 0 : onOptionChange(e, {
|
|
189
178
|
value: conbineValues,
|
|
190
179
|
options: formatted,
|
|
191
|
-
currentOption: columnOption
|
|
192
|
-
columnIndex
|
|
180
|
+
currentOption: columnOption
|
|
193
181
|
});
|
|
194
182
|
} else {
|
|
195
183
|
const result = [...internalValue];
|
|
@@ -198,8 +186,7 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
198
186
|
onOptionChange == null ? void 0 : onOptionChange(e, {
|
|
199
187
|
value: result,
|
|
200
188
|
options,
|
|
201
|
-
currentOption: columnOption
|
|
202
|
-
columnIndex
|
|
189
|
+
currentOption: columnOption
|
|
203
190
|
});
|
|
204
191
|
}
|
|
205
192
|
}
|
|
@@ -241,16 +228,7 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
241
228
|
__spreadProps(__spreadValues({}, contentProps), {
|
|
242
229
|
className: (0, import_clsx.default)(`${prefixCls}-content`, contentProps == null ? void 0 : contentProps.className)
|
|
243
230
|
}),
|
|
244
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-header` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-cancel`, onClick: cancel },
|
|
245
|
-
"div",
|
|
246
|
-
{
|
|
247
|
-
className: (0, import_clsx.default)(`${prefixCls}-confirm`, {
|
|
248
|
-
[`${prefixCls}-confirm-disabled`]: disabled
|
|
249
|
-
}),
|
|
250
|
-
onClick: confirm
|
|
251
|
-
},
|
|
252
|
-
propConfirmText || confirmText
|
|
253
|
-
)),
|
|
231
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-header` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-cancel`, onClick: cancel }, cancelText), title && /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-title` }, title), /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-confirm`, onClick: confirm }, confirmText)),
|
|
254
232
|
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-container` }, columns.map((column, index) => /* @__PURE__ */ import_react.default.createElement(
|
|
255
233
|
import_PickerPanel.default,
|
|
256
234
|
{
|
|
@@ -258,7 +236,7 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
258
236
|
key: index,
|
|
259
237
|
options: column,
|
|
260
238
|
columnIndex: index,
|
|
261
|
-
|
|
239
|
+
defaultValue: internalValue == null ? void 0 : internalValue[index],
|
|
262
240
|
onSelect: handleSelect,
|
|
263
241
|
pickerStyle: others == null ? void 0 : others.style
|
|
264
242
|
}
|
|
@@ -10,10 +10,6 @@ export interface IPickerOptionItem {
|
|
|
10
10
|
* 选项对应唯一的值
|
|
11
11
|
*/
|
|
12
12
|
value: string | number;
|
|
13
|
-
/**
|
|
14
|
-
* 是否禁用
|
|
15
|
-
*/
|
|
16
|
-
disabled?: boolean;
|
|
17
13
|
}
|
|
18
14
|
export type ICascadePickerChildOptionItem = IPickerOptionItem & {
|
|
19
15
|
/**
|
|
@@ -38,14 +34,6 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
|
|
|
38
34
|
* 标题
|
|
39
35
|
*/
|
|
40
36
|
title?: string;
|
|
41
|
-
/**
|
|
42
|
-
* 确认文本内容
|
|
43
|
-
*/
|
|
44
|
-
confirmText?: string;
|
|
45
|
-
/**
|
|
46
|
-
* 取消文本内容
|
|
47
|
-
*/
|
|
48
|
-
cancelText?: string;
|
|
49
37
|
/**
|
|
50
38
|
* 列表数据
|
|
51
39
|
* @default []
|
|
@@ -73,7 +61,6 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
|
|
|
73
61
|
value: (string | number)[];
|
|
74
62
|
options: ICascadePickerChildOptionItem[][];
|
|
75
63
|
currentOption: ICascadePickerChildOptionItem;
|
|
76
|
-
columnIndex: number;
|
|
77
64
|
}) => void;
|
|
78
65
|
/**
|
|
79
66
|
* 点击取消按钮时候回调
|
|
@@ -98,9 +85,9 @@ export type PickerPanelProps<D extends React.ElementType = 'div', P = {}> = Over
|
|
|
98
85
|
*/
|
|
99
86
|
options?: ICascadePickerChildOptionItem[];
|
|
100
87
|
/**
|
|
101
|
-
*
|
|
88
|
+
* 默认值
|
|
102
89
|
*/
|
|
103
|
-
|
|
90
|
+
defaultValue?: string | number;
|
|
104
91
|
/**
|
|
105
92
|
* 列索引
|
|
106
93
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.bui-picker-panel {
|
|
2
|
-
--bui-picker-option-disabled-opacity: 0.38;
|
|
3
2
|
flex: 1;
|
|
4
3
|
flex-shrink: 0;
|
|
5
4
|
position: relative;
|
|
@@ -57,9 +56,6 @@
|
|
|
57
56
|
white-space: nowrap;
|
|
58
57
|
width: 100%;
|
|
59
58
|
}
|
|
60
|
-
.bui-picker-panel-option-disabled {
|
|
61
|
-
opacity: var(--bui-picker-option-disabled-opacity);
|
|
62
|
-
}
|
|
63
59
|
.bui-picker-panel-option-hidden {
|
|
64
60
|
visibility: hidden;
|
|
65
61
|
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
|
+
defaultValue,
|
|
70
70
|
onSelect,
|
|
71
71
|
columnIndex,
|
|
72
72
|
pickerStyle
|
|
73
73
|
} = _a, others = __objRest(_a, [
|
|
74
74
|
"options",
|
|
75
|
-
"
|
|
75
|
+
"defaultValue",
|
|
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 (defaultValue) {
|
|
106
106
|
options.some((item, idx) => {
|
|
107
|
-
if (item.value ===
|
|
107
|
+
if (item.value === defaultValue) {
|
|
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]);
|
|
126
126
|
const setTransform = (type, deg, time = DEFAULT_DURATION, translateY = 0) => {
|
|
127
127
|
let nTime = time;
|
|
128
128
|
if (type !== TOUCH_END) {
|
|
@@ -255,8 +255,7 @@ 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
|
|
259
|
-
[`${prefixCls}-option-disabled`]: item == null ? void 0 : item.disabled
|
|
258
|
+
[`${prefixCls}-option-hidden`]: i + 1 <= currIndex - 8 || i + 1 >= currIndex + 8
|
|
260
259
|
}),
|
|
261
260
|
key: `${item == null ? void 0 : item.value}-${i}`,
|
|
262
261
|
style: {
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -51,26 +51,6 @@ 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
|
-
};
|
|
74
54
|
var Popover_exports = {};
|
|
75
55
|
__export(Popover_exports, {
|
|
76
56
|
default: () => Popover_default
|
|
@@ -93,9 +73,9 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
93
73
|
offsetSpacing = 0,
|
|
94
74
|
placement = "top",
|
|
95
75
|
trigger = "click",
|
|
76
|
+
onOpenChange,
|
|
96
77
|
open,
|
|
97
|
-
hideArrow
|
|
98
|
-
onOpenChange
|
|
78
|
+
hideArrow
|
|
99
79
|
} = _a, others = __objRest(_a, [
|
|
100
80
|
"className",
|
|
101
81
|
"style",
|
|
@@ -106,9 +86,9 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
106
86
|
"offsetSpacing",
|
|
107
87
|
"placement",
|
|
108
88
|
"trigger",
|
|
89
|
+
"onOpenChange",
|
|
109
90
|
"open",
|
|
110
|
-
"hideArrow"
|
|
111
|
-
"onOpenChange"
|
|
91
|
+
"hideArrow"
|
|
112
92
|
]);
|
|
113
93
|
const controlByUser = typeof open !== "undefined";
|
|
114
94
|
const { direction, location = "center" } = (0, import_utils.parsePlacement)(placement);
|
|
@@ -116,18 +96,11 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
116
96
|
const [openStatus, setOpenStatus] = (0, import_react.useState)(defaultOpen);
|
|
117
97
|
const [arrowDirection, setArrowDirection] = (0, import_react.useState)(direction);
|
|
118
98
|
const [arrowLocation, setArrowLocation] = (0, import_react.useState)(location);
|
|
119
|
-
const [
|
|
120
|
-
const
|
|
121
|
-
const nodeRef = (0, import_utils.useForkRef)(ref, tipRef);
|
|
122
|
-
const clearRef = (status) => {
|
|
123
|
-
if (status === false) {
|
|
124
|
-
tipRef.current = null;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
99
|
+
const [tooltyles, setTooltyles] = (0, import_react.useState)({});
|
|
100
|
+
const ttId = (0, import_utils.useUniqueId)();
|
|
127
101
|
const changeOpenStatus = (event, status) => {
|
|
128
102
|
if (controlByUser)
|
|
129
103
|
return;
|
|
130
|
-
clearRef(status);
|
|
131
104
|
setOpenStatus(status);
|
|
132
105
|
onOpenChange == null ? void 0 : onOpenChange(event, { open: status });
|
|
133
106
|
};
|
|
@@ -146,33 +119,23 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
146
119
|
if (!controlByUser)
|
|
147
120
|
return;
|
|
148
121
|
setOpenStatus(open);
|
|
149
|
-
clearRef(open);
|
|
150
122
|
}, [open]);
|
|
151
|
-
(0, import_react.useEffect)(() => {
|
|
152
|
-
if (!openStatus) {
|
|
153
|
-
setToolStyles({
|
|
154
|
-
visibility: "hidden"
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}, [openStatus]);
|
|
158
123
|
const clickEventHandler = (event) => {
|
|
159
124
|
if (trigger === "hover" || (trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover")
|
|
160
125
|
return;
|
|
161
126
|
hidePopover(event);
|
|
162
127
|
};
|
|
163
|
-
const onRootElementMouted = (0, import_utils.throttle)(() =>
|
|
164
|
-
if (!tipRef.current)
|
|
165
|
-
return;
|
|
128
|
+
const onRootElementMouted = (0, import_utils.throttle)(() => {
|
|
166
129
|
const {
|
|
167
130
|
direction: newParsedDirection,
|
|
168
131
|
location: newParsedLocation = "center"
|
|
169
132
|
} = (0, import_utils.parsePlacement)(placement);
|
|
170
|
-
const result =
|
|
133
|
+
const result = (0, import_utils.getStylesAndLocation)({
|
|
171
134
|
childrenRef,
|
|
172
135
|
arrowDirection: newParsedDirection,
|
|
173
136
|
arrowLocation: newParsedLocation,
|
|
174
137
|
offsetSpacing,
|
|
175
|
-
|
|
138
|
+
selector: `[data-id="tt_${ttId}"]`
|
|
176
139
|
});
|
|
177
140
|
if (!result)
|
|
178
141
|
return;
|
|
@@ -183,32 +146,26 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
183
146
|
if (newArrowLocation !== arrowLocation) {
|
|
184
147
|
setArrowLocation(newArrowLocation);
|
|
185
148
|
}
|
|
186
|
-
|
|
187
|
-
}
|
|
149
|
+
setTooltyles(styles);
|
|
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
|
+
};
|
|
188
163
|
(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
|
-
};
|
|
207
164
|
bindEvent();
|
|
208
165
|
return () => {
|
|
209
166
|
unbindEvent();
|
|
210
167
|
};
|
|
211
|
-
}, [
|
|
168
|
+
}, []);
|
|
212
169
|
if (!title && !content)
|
|
213
170
|
return null;
|
|
214
171
|
let triggerEventOption;
|
|
@@ -223,14 +180,14 @@ const Popover = /* @__PURE__ */ import_react.default.forwardRef((props, ref) =>
|
|
|
223
180
|
const childrenOptions = __spreadValues({
|
|
224
181
|
ref: childrenRef
|
|
225
182
|
}, triggerEventOption);
|
|
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(
|
|
183
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, open || openStatus ? /* @__PURE__ */ import_react.default.createElement(import_Portal.default, { onRootElementMouted, ref }, /* @__PURE__ */ import_react.default.createElement(
|
|
227
184
|
"div",
|
|
228
185
|
__spreadValues({
|
|
229
186
|
className: (0, import_clsx.default)(prefixCls, className, `popover-${arrowDirection}`, {
|
|
230
187
|
"bui-popover-arrow-hide": hideArrow
|
|
231
188
|
}),
|
|
232
|
-
|
|
233
|
-
|
|
189
|
+
"data-id": `tt_${ttId}`,
|
|
190
|
+
style: __spreadValues(__spreadValues({}, style), tooltyles)
|
|
234
191
|
}, others),
|
|
235
192
|
!hideArrow ? /* @__PURE__ */ import_react.default.createElement(
|
|
236
193
|
"div",
|
|
@@ -53,9 +53,7 @@ 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
|
|
57
|
-
(0, import_react.useEffect)(() => {
|
|
58
|
-
let root;
|
|
56
|
+
const rootWrapperElement = (0, import_react.useMemo)(() => {
|
|
59
57
|
if (!disablePortal) {
|
|
60
58
|
const currentPages = import_taro.default.getCurrentPages() || [];
|
|
61
59
|
const currentPage = currentPages[currentPages.length - 1];
|
|
@@ -67,12 +65,11 @@ const Portal = (0, import_react.forwardRef)((props, ref) => {
|
|
|
67
65
|
const view = document.createElement("view");
|
|
68
66
|
view.id = portalId;
|
|
69
67
|
rootElement == null ? void 0 : rootElement.appendChild(view);
|
|
70
|
-
|
|
71
|
-
} else {
|
|
72
|
-
root = portalWrapperElement;
|
|
68
|
+
return view;
|
|
73
69
|
}
|
|
70
|
+
return portalWrapperElement;
|
|
74
71
|
}
|
|
75
|
-
|
|
72
|
+
return void 0;
|
|
76
73
|
}, []);
|
|
77
74
|
return /* @__PURE__ */ import_react.default.createElement(import_PortalCore.default, __spreadProps(__spreadValues({}, props), { ref, rootElement: rootWrapperElement }));
|
|
78
75
|
});
|
|
@@ -34,14 +34,12 @@ 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
|
|
38
|
-
if (dur <= 0) {
|
|
39
|
-
dur = 500;
|
|
40
|
-
}
|
|
37
|
+
function easeOutScroll(from, to, callback) {
|
|
41
38
|
if (from === to || typeof from !== "number") {
|
|
42
39
|
return;
|
|
43
40
|
}
|
|
44
41
|
const change = to - from;
|
|
42
|
+
const dur = 500;
|
|
45
43
|
const sTime = +/* @__PURE__ */ new Date();
|
|
46
44
|
function linear(t, b, c, d) {
|
|
47
45
|
return c * t / d + b;
|
|
@@ -76,8 +74,7 @@ const ScrollView = (0, import_react.forwardRef)(
|
|
|
76
74
|
scrollIntoView,
|
|
77
75
|
onTouchMove: propsOnTouchMove,
|
|
78
76
|
scrollIntoViewAlignment,
|
|
79
|
-
children
|
|
80
|
-
scrollAnimationDuration = 500
|
|
77
|
+
children
|
|
81
78
|
} = props;
|
|
82
79
|
const container = (0, import_react.useRef)(null);
|
|
83
80
|
const handleRef = (0, import_utils.useForkRef)(ref, container);
|
|
@@ -87,15 +84,10 @@ const ScrollView = (0, import_react.forwardRef)(
|
|
|
87
84
|
if (top === void 0)
|
|
88
85
|
return;
|
|
89
86
|
if (isAnimation) {
|
|
90
|
-
easeOutScroll(
|
|
91
|
-
container.current
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (container.current)
|
|
95
|
-
container.current.scrollTop = pos;
|
|
96
|
-
},
|
|
97
|
-
scrollAnimationDuration
|
|
98
|
-
);
|
|
87
|
+
easeOutScroll(container.current.scrollTop, top, (pos) => {
|
|
88
|
+
if (container.current)
|
|
89
|
+
container.current.scrollTop = pos;
|
|
90
|
+
});
|
|
99
91
|
} else if (container.current)
|
|
100
92
|
container.current.scrollTop = top;
|
|
101
93
|
}, []);
|
|
@@ -103,15 +95,10 @@ const ScrollView = (0, import_react.forwardRef)(
|
|
|
103
95
|
if (left === void 0)
|
|
104
96
|
return;
|
|
105
97
|
if (isAnimation) {
|
|
106
|
-
easeOutScroll(
|
|
107
|
-
container.current
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (container.current)
|
|
111
|
-
container.current.scrollLeft = pos;
|
|
112
|
-
},
|
|
113
|
-
scrollAnimationDuration
|
|
114
|
-
);
|
|
98
|
+
easeOutScroll(container.current.scrollLeft, left, (pos) => {
|
|
99
|
+
if (container.current)
|
|
100
|
+
container.current.scrollLeft = pos;
|
|
101
|
+
});
|
|
115
102
|
} else if (container.current)
|
|
116
103
|
container.current.scrollLeft = left;
|
|
117
104
|
}, []);
|