@alifd/chat 0.3.8-beta.1 → 0.3.8-beta.3
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/es/float-button/hooks/useAutoAlign.d.ts +1 -0
- package/es/float-button/hooks/useAutoAlign.js +3 -2
- package/es/float-button/main.scss +3 -0
- package/es/float-button/view/float-button.js +2 -0
- package/es/index.js +1 -1
- package/lib/float-button/hooks/useAutoAlign.d.ts +1 -0
- package/lib/float-button/hooks/useAutoAlign.js +3 -2
- package/lib/float-button/main.scss +3 -0
- package/lib/float-button/view/float-button.js +2 -0
- package/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ const DEFAULT_EDGE_OFFSET = 10;
|
|
|
6
6
|
const { height: screenHeight } = getScreenSize();
|
|
7
7
|
/**
|
|
8
8
|
* 自动调整弹层 align 位置逻辑,设置Balloon 组件中的align参数
|
|
9
|
+
* defaultMaxHeight 用户传的初始希望的面板高度
|
|
9
10
|
*/
|
|
10
11
|
export function useAutoAlign(_dom, // 弹层dom
|
|
11
12
|
trigger, // 触发器dom
|
|
@@ -18,8 +19,8 @@ trigger, // 触发器dom
|
|
|
18
19
|
}
|
|
19
20
|
const domScrollHeight = dom === null || dom === void 0 ? void 0 : dom.scrollHeight;
|
|
20
21
|
const domClientHeight = dom === null || dom === void 0 ? void 0 : dom.clientHeight;
|
|
21
|
-
//
|
|
22
|
-
if (isInScreen(dom) && domScrollHeight <= domClientHeight) {
|
|
22
|
+
// 如果元素没有超出屏幕区域 并且元素没有进行滚动 并且 元素的高度已经达到了用户设置的想要的高度
|
|
23
|
+
if (isInScreen(dom) && (domScrollHeight <= domClientHeight) && domClientHeight >= (defaultMaxHeight || maxHeight)) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
const [edge, subEdge] = getNearlyEdge(trigger, ['top', 'right', 'bottom', 'left']);
|
|
@@ -27,6 +27,7 @@ import { useDragable } from '../hooks/useDragable';
|
|
|
27
27
|
* | SPACE | Trigger the onClick event |
|
|
28
28
|
*/
|
|
29
29
|
const FloatButton = forwardRef((props, ref) => {
|
|
30
|
+
var _a, _b;
|
|
30
31
|
const { className, style, addonAfter, addonBefore, dragable, safeAreaMargin = [10, 10, 10, 10], autoNestleEdge = true, interactiveEdges = ['left', 'right'], autoHide, autoAlign, leftSizeOfHidden, defaultPosition, trigger, triggerType = 'click', showClose = false, align, balloonProps, children, _renderView, beforeNestleEdge, afterNestleEdge } = props, others = __rest(props, ["className", "style", "addonAfter", "addonBefore", "dragable", "safeAreaMargin", "autoNestleEdge", "interactiveEdges", "autoHide", "autoAlign", "leftSizeOfHidden", "defaultPosition", "trigger", "triggerType", "showClose", "align", "balloonProps", "children", "_renderView", "beforeNestleEdge", "afterNestleEdge"]);
|
|
31
32
|
const elRef = useRef(null);
|
|
32
33
|
const triggerRef = useRef(null);
|
|
@@ -45,6 +46,7 @@ const FloatButton = forwardRef((props, ref) => {
|
|
|
45
46
|
const { align: currentAlign, update: _updateAlign, maxHeight: currentMaxHeight } = useAutoAlign(el === null || el === void 0 ? void 0 : el.querySelector(`.${cls}-popup`), triggerEl, {
|
|
46
47
|
enable: autoAlign,
|
|
47
48
|
defaultAlign: align,
|
|
49
|
+
defaultMaxHeight: parseInt(((_a = balloonProps === null || balloonProps === void 0 ? void 0 : balloonProps.popupStyle) === null || _a === void 0 ? void 0 : _a.height) ? ((_b = balloonProps === null || balloonProps === void 0 ? void 0 : balloonProps.popupStyle) === null || _b === void 0 ? void 0 : _b.height) + '' : '600px')
|
|
48
50
|
});
|
|
49
51
|
const updateAlign = () => {
|
|
50
52
|
_updateAlign(el === null || el === void 0 ? void 0 : el.querySelector(`.${cls}-popup`));
|
package/es/index.js
CHANGED
|
@@ -20,4 +20,4 @@ export { default as CardLoading } from './card-loading';
|
|
|
20
20
|
export { default as Origin } from './origin';
|
|
21
21
|
export { default as Loading } from './loading';
|
|
22
22
|
export { default as Drawer } from './drawer';
|
|
23
|
-
export const version = '0.3.8-beta.
|
|
23
|
+
export const version = '0.3.8-beta.3';
|
|
@@ -9,6 +9,7 @@ const DEFAULT_EDGE_OFFSET = 10;
|
|
|
9
9
|
const { height: screenHeight } = (0, util_1.getScreenSize)();
|
|
10
10
|
/**
|
|
11
11
|
* 自动调整弹层 align 位置逻辑,设置Balloon 组件中的align参数
|
|
12
|
+
* defaultMaxHeight 用户传的初始希望的面板高度
|
|
12
13
|
*/
|
|
13
14
|
function useAutoAlign(_dom, // 弹层dom
|
|
14
15
|
trigger, // 触发器dom
|
|
@@ -21,8 +22,8 @@ trigger, // 触发器dom
|
|
|
21
22
|
}
|
|
22
23
|
const domScrollHeight = dom === null || dom === void 0 ? void 0 : dom.scrollHeight;
|
|
23
24
|
const domClientHeight = dom === null || dom === void 0 ? void 0 : dom.clientHeight;
|
|
24
|
-
//
|
|
25
|
-
if ((0, util_1.isInScreen)(dom) && domScrollHeight <= domClientHeight) {
|
|
25
|
+
// 如果元素没有超出屏幕区域 并且元素没有进行滚动 并且 元素的高度已经达到了用户设置的想要的高度
|
|
26
|
+
if ((0, util_1.isInScreen)(dom) && (domScrollHeight <= domClientHeight) && domClientHeight >= (defaultMaxHeight || maxHeight)) {
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
29
|
const [edge, subEdge] = (0, util_1.getNearlyEdge)(trigger, ['top', 'right', 'bottom', 'left']);
|
|
@@ -29,6 +29,7 @@ const useDragable_1 = require("../hooks/useDragable");
|
|
|
29
29
|
* | SPACE | Trigger the onClick event |
|
|
30
30
|
*/
|
|
31
31
|
const FloatButton = (0, react_1.forwardRef)((props, ref) => {
|
|
32
|
+
var _a, _b;
|
|
32
33
|
const { className, style, addonAfter, addonBefore, dragable, safeAreaMargin = [10, 10, 10, 10], autoNestleEdge = true, interactiveEdges = ['left', 'right'], autoHide, autoAlign, leftSizeOfHidden, defaultPosition, trigger, triggerType = 'click', showClose = false, align, balloonProps, children, _renderView, beforeNestleEdge, afterNestleEdge } = props, others = tslib_1.__rest(props, ["className", "style", "addonAfter", "addonBefore", "dragable", "safeAreaMargin", "autoNestleEdge", "interactiveEdges", "autoHide", "autoAlign", "leftSizeOfHidden", "defaultPosition", "trigger", "triggerType", "showClose", "align", "balloonProps", "children", "_renderView", "beforeNestleEdge", "afterNestleEdge"]);
|
|
33
34
|
const elRef = (0, react_1.useRef)(null);
|
|
34
35
|
const triggerRef = (0, react_1.useRef)(null);
|
|
@@ -47,6 +48,7 @@ const FloatButton = (0, react_1.forwardRef)((props, ref) => {
|
|
|
47
48
|
const { align: currentAlign, update: _updateAlign, maxHeight: currentMaxHeight } = (0, useAutoAlign_1.useAutoAlign)(el === null || el === void 0 ? void 0 : el.querySelector(`.${cls}-popup`), triggerEl, {
|
|
48
49
|
enable: autoAlign,
|
|
49
50
|
defaultAlign: align,
|
|
51
|
+
defaultMaxHeight: parseInt(((_a = balloonProps === null || balloonProps === void 0 ? void 0 : balloonProps.popupStyle) === null || _a === void 0 ? void 0 : _a.height) ? ((_b = balloonProps === null || balloonProps === void 0 ? void 0 : balloonProps.popupStyle) === null || _b === void 0 ? void 0 : _b.height) + '' : '600px')
|
|
50
52
|
});
|
|
51
53
|
const updateAlign = () => {
|
|
52
54
|
_updateAlign(el === null || el === void 0 ? void 0 : el.querySelector(`.${cls}-popup`));
|
package/lib/index.js
CHANGED
|
@@ -46,4 +46,4 @@ var loading_1 = require("./loading");
|
|
|
46
46
|
Object.defineProperty(exports, "Loading", { enumerable: true, get: function () { return tslib_1.__importDefault(loading_1).default; } });
|
|
47
47
|
var drawer_1 = require("./drawer");
|
|
48
48
|
Object.defineProperty(exports, "Drawer", { enumerable: true, get: function () { return tslib_1.__importDefault(drawer_1).default; } });
|
|
49
|
-
exports.version = '0.3.8-beta.
|
|
49
|
+
exports.version = '0.3.8-beta.3';
|