@alifd/chat 0.3.33-beta.11 → 0.3.33-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/es/image-preview/index.js +48 -8
- package/es/index.js +1 -1
- package/lib/image-preview/index.js +47 -7
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/es/form/index.d.ts +0 -23
- package/es/form/index.js +0 -33
- package/es/form/main.scss +0 -5
- package/es/form/style.d.ts +0 -1
- package/es/form/style.js +0 -1
- package/es/form/types.d.ts +0 -518
- package/es/form/types.js +0 -1
- package/es/html-render/utils.d.ts +0 -2
- package/es/html-render/utils.js +0 -2
- package/es/icon/icon.css +0 -363
- package/lib/form/index.d.ts +0 -23
- package/lib/form/index.js +0 -35
- package/lib/form/main.scss +0 -5
- package/lib/form/style.d.ts +0 -1
- package/lib/form/style.js +0 -3
- package/lib/form/types.d.ts +0 -518
- package/lib/form/types.js +0 -2
- package/lib/html-render/utils.d.ts +0 -2
- package/lib/html-render/utils.js +0 -5
- package/lib/icon/icon.css +0 -363
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @when 需要展示图片并提供预览功能时使用。 - Use when you need to display images and provide preview functionality.
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
|
-
import React, { forwardRef } from 'react';
|
|
9
|
+
import React, { forwardRef, useRef } from 'react';
|
|
10
10
|
import classnames from 'classnames';
|
|
11
11
|
import { PhotoProvider, PhotoView } from 'react-photo-view';
|
|
12
12
|
import { findAncestor } from '../utils';
|
|
@@ -34,26 +34,66 @@ function isInsideLink(e) {
|
|
|
34
34
|
return !!findAncestor(e.target, (t) => t.tagName === 'A' && !!t.href);
|
|
35
35
|
}
|
|
36
36
|
const ImagePreview = forwardRef(({ className, src, children, width, height }, ref) => {
|
|
37
|
+
const touchStartRef = useRef({ x: 0, y: 0, time: 0 });
|
|
38
|
+
const hasMoved = useRef(false);
|
|
37
39
|
let child;
|
|
38
40
|
try {
|
|
39
41
|
child = React.Children.only(children);
|
|
40
42
|
}
|
|
41
43
|
catch (e) { }
|
|
44
|
+
const handleTouchStart = (e) => {
|
|
45
|
+
const touch = e.touches[0];
|
|
46
|
+
touchStartRef.current = {
|
|
47
|
+
x: touch.clientX,
|
|
48
|
+
y: touch.clientY,
|
|
49
|
+
time: Date.now()
|
|
50
|
+
};
|
|
51
|
+
hasMoved.current = false;
|
|
52
|
+
};
|
|
53
|
+
const handleTouchMove = (e) => {
|
|
54
|
+
if (!touchStartRef.current)
|
|
55
|
+
return;
|
|
56
|
+
const touch = e.touches[0];
|
|
57
|
+
const deltaX = Math.abs(touch.clientX - touchStartRef.current.x);
|
|
58
|
+
const deltaY = Math.abs(touch.clientY - touchStartRef.current.y);
|
|
59
|
+
// 如果移动距离超过阈值,认为是滚动操作
|
|
60
|
+
if (deltaX > 10 || deltaY > 10) {
|
|
61
|
+
hasMoved.current = true;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const handleTouchEnd = (e, originalHandler) => {
|
|
65
|
+
// 如果检测到滚动,就不触发图片预览
|
|
66
|
+
if (!hasMoved.current) {
|
|
67
|
+
if (isInsideLink(e)) {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
handleClick(e, src);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
originalHandler === null || originalHandler === void 0 ? void 0 : originalHandler(e);
|
|
75
|
+
};
|
|
42
76
|
if (child && child.props) {
|
|
43
|
-
const { onClick, onTouchEnd } = child.props;
|
|
77
|
+
const { onClick, onTouchEnd, onTouchStart, onTouchMove } = child.props;
|
|
44
78
|
child = React.cloneElement(child, {
|
|
79
|
+
onTouchStart: (e) => {
|
|
80
|
+
handleTouchStart(e);
|
|
81
|
+
onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(e);
|
|
82
|
+
},
|
|
83
|
+
onTouchMove: (e) => {
|
|
84
|
+
handleTouchMove(e);
|
|
85
|
+
onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(e);
|
|
86
|
+
},
|
|
45
87
|
onTouchEnd: (e) => {
|
|
46
|
-
|
|
47
|
-
e.stopPropagation();
|
|
48
|
-
}
|
|
49
|
-
handleClick(e, src);
|
|
50
|
-
onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(e);
|
|
88
|
+
handleTouchEnd(e, onTouchEnd);
|
|
51
89
|
},
|
|
52
90
|
onClick: (e) => {
|
|
53
91
|
if (isInsideLink(e)) {
|
|
54
92
|
e.stopPropagation();
|
|
55
93
|
}
|
|
56
|
-
|
|
94
|
+
else {
|
|
95
|
+
handleClick(e, src);
|
|
96
|
+
}
|
|
57
97
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
58
98
|
}
|
|
59
99
|
});
|
package/es/index.js
CHANGED
|
@@ -32,4 +32,4 @@ export { default as CheckboxGroup } from './checkbox-group';
|
|
|
32
32
|
export { default as Select } from './select';
|
|
33
33
|
export { default as Flip } from './flip';
|
|
34
34
|
export { default as ToolStatus } from './tool-status';
|
|
35
|
-
export const version = '0.3.33-beta.
|
|
35
|
+
export const version = '0.3.33-beta.12';
|
|
@@ -37,26 +37,66 @@ function isInsideLink(e) {
|
|
|
37
37
|
return !!(0, utils_1.findAncestor)(e.target, (t) => t.tagName === 'A' && !!t.href);
|
|
38
38
|
}
|
|
39
39
|
const ImagePreview = (0, react_1.forwardRef)(({ className, src, children, width, height }, ref) => {
|
|
40
|
+
const touchStartRef = (0, react_1.useRef)({ x: 0, y: 0, time: 0 });
|
|
41
|
+
const hasMoved = (0, react_1.useRef)(false);
|
|
40
42
|
let child;
|
|
41
43
|
try {
|
|
42
44
|
child = react_1.default.Children.only(children);
|
|
43
45
|
}
|
|
44
46
|
catch (e) { }
|
|
47
|
+
const handleTouchStart = (e) => {
|
|
48
|
+
const touch = e.touches[0];
|
|
49
|
+
touchStartRef.current = {
|
|
50
|
+
x: touch.clientX,
|
|
51
|
+
y: touch.clientY,
|
|
52
|
+
time: Date.now()
|
|
53
|
+
};
|
|
54
|
+
hasMoved.current = false;
|
|
55
|
+
};
|
|
56
|
+
const handleTouchMove = (e) => {
|
|
57
|
+
if (!touchStartRef.current)
|
|
58
|
+
return;
|
|
59
|
+
const touch = e.touches[0];
|
|
60
|
+
const deltaX = Math.abs(touch.clientX - touchStartRef.current.x);
|
|
61
|
+
const deltaY = Math.abs(touch.clientY - touchStartRef.current.y);
|
|
62
|
+
// 如果移动距离超过阈值,认为是滚动操作
|
|
63
|
+
if (deltaX > 10 || deltaY > 10) {
|
|
64
|
+
hasMoved.current = true;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const handleTouchEnd = (e, originalHandler) => {
|
|
68
|
+
// 如果检测到滚动,就不触发图片预览
|
|
69
|
+
if (!hasMoved.current) {
|
|
70
|
+
if (isInsideLink(e)) {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
handleClick(e, src);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
originalHandler === null || originalHandler === void 0 ? void 0 : originalHandler(e);
|
|
78
|
+
};
|
|
45
79
|
if (child && child.props) {
|
|
46
|
-
const { onClick, onTouchEnd } = child.props;
|
|
80
|
+
const { onClick, onTouchEnd, onTouchStart, onTouchMove } = child.props;
|
|
47
81
|
child = react_1.default.cloneElement(child, {
|
|
82
|
+
onTouchStart: (e) => {
|
|
83
|
+
handleTouchStart(e);
|
|
84
|
+
onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(e);
|
|
85
|
+
},
|
|
86
|
+
onTouchMove: (e) => {
|
|
87
|
+
handleTouchMove(e);
|
|
88
|
+
onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(e);
|
|
89
|
+
},
|
|
48
90
|
onTouchEnd: (e) => {
|
|
49
|
-
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
}
|
|
52
|
-
handleClick(e, src);
|
|
53
|
-
onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(e);
|
|
91
|
+
handleTouchEnd(e, onTouchEnd);
|
|
54
92
|
},
|
|
55
93
|
onClick: (e) => {
|
|
56
94
|
if (isInsideLink(e)) {
|
|
57
95
|
e.stopPropagation();
|
|
58
96
|
}
|
|
59
|
-
|
|
97
|
+
else {
|
|
98
|
+
handleClick(e, src);
|
|
99
|
+
}
|
|
60
100
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
61
101
|
}
|
|
62
102
|
});
|
package/lib/index.js
CHANGED
|
@@ -70,4 +70,4 @@ var flip_1 = require("./flip");
|
|
|
70
70
|
Object.defineProperty(exports, "Flip", { enumerable: true, get: function () { return tslib_1.__importDefault(flip_1).default; } });
|
|
71
71
|
var tool_status_1 = require("./tool-status");
|
|
72
72
|
Object.defineProperty(exports, "ToolStatus", { enumerable: true, get: function () { return tslib_1.__importDefault(tool_status_1).default; } });
|
|
73
|
-
exports.version = '0.3.33-beta.
|
|
73
|
+
exports.version = '0.3.33-beta.12';
|
package/package.json
CHANGED
package/es/form/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @component 输入框
|
|
3
|
-
* @en Input
|
|
4
|
-
* @type 通用 - General
|
|
5
|
-
* @remarks 同 Next Input,按钮用于开始一个即时操作。- Same as Next.Input, Input used to trigger an action.
|
|
6
|
-
* @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Inputs are used for emphasizing important functions on your page.
|
|
7
|
-
* @others
|
|
8
|
-
* ## 无障碍键盘操作指南
|
|
9
|
-
* | 按键 | 说明 |
|
|
10
|
-
* | :---- | :---------- |
|
|
11
|
-
* | Enter | 触发 onClick 事件 |
|
|
12
|
-
* | SPACE | 触发 onClick 事件 |
|
|
13
|
-
* @othersEn
|
|
14
|
-
* ## ARIA and KeyBoard
|
|
15
|
-
* | KeyBoard | Description |
|
|
16
|
-
* | :---------- | :------------------------------ |
|
|
17
|
-
* | Enter | Trigger the onClick event |
|
|
18
|
-
* | SPACE | Trigger the onClick event |
|
|
19
|
-
*/
|
|
20
|
-
import React from 'react';
|
|
21
|
-
export * from './types';
|
|
22
|
-
declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<Pick<any, string | number | symbol> & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/input").InputProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>> & Pick<import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>, "focus" | "getInputNode">>, string | number | symbol> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/input").InputProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>> & Pick<import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>, "focus" | "getInputNode">, {}>;
|
|
23
|
-
export default _default;
|
package/es/form/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @component 输入框
|
|
3
|
-
* @en Input
|
|
4
|
-
* @type 通用 - General
|
|
5
|
-
* @remarks 同 Next Input,按钮用于开始一个即时操作。- Same as Next.Input, Input used to trigger an action.
|
|
6
|
-
* @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Inputs are used for emphasizing important functions on your page.
|
|
7
|
-
* @others
|
|
8
|
-
* ## 无障碍键盘操作指南
|
|
9
|
-
* | 按键 | 说明 |
|
|
10
|
-
* | :---- | :---------- |
|
|
11
|
-
* | Enter | 触发 onClick 事件 |
|
|
12
|
-
* | SPACE | 触发 onClick 事件 |
|
|
13
|
-
* @othersEn
|
|
14
|
-
* ## ARIA and KeyBoard
|
|
15
|
-
* | KeyBoard | Description |
|
|
16
|
-
* | :---------- | :------------------------------ |
|
|
17
|
-
* | Enter | Trigger the onClick event |
|
|
18
|
-
* | SPACE | Trigger the onClick event |
|
|
19
|
-
*/
|
|
20
|
-
import { __rest } from "tslib";
|
|
21
|
-
import React, { forwardRef } from 'react';
|
|
22
|
-
import { Input as NextInput, ConfigProvider } from '@alifd/next';
|
|
23
|
-
import cs from 'classnames';
|
|
24
|
-
import { PREFIX_DEFAULT, assignSubComponent } from '../utils';
|
|
25
|
-
const Input = forwardRef((_a, ref) => {
|
|
26
|
-
var { className, size = 'medium' } = _a, props = __rest(_a, ["className", "size"]);
|
|
27
|
-
return (React.createElement(NextInput, Object.assign({}, props, { className: cs(`${PREFIX_DEFAULT}input`, className), size: size, ref: ref })));
|
|
28
|
-
});
|
|
29
|
-
const InputWithSub = assignSubComponent(Input, {
|
|
30
|
-
displayName: 'Input',
|
|
31
|
-
});
|
|
32
|
-
export * from './types';
|
|
33
|
-
export default ConfigProvider.config(InputWithSub);
|
package/es/form/main.scss
DELETED
package/es/form/style.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@alifd/next/lib/input/style2';
|
package/es/form/style.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@alifd/next/lib/input/style2';
|