@steedos-widgets/amis-object 6.10.53-beta.20 → 6.10.53-beta.26
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/assets.json
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
{
|
|
4
4
|
"package": "@steedos-widgets/amis-object",
|
|
5
5
|
"urls": [
|
|
6
|
-
"https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.
|
|
7
|
-
"https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.
|
|
6
|
+
"https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.26/dist/amis-object.umd.js",
|
|
7
|
+
"https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.26/dist/amis-object.umd.css"
|
|
8
8
|
],
|
|
9
9
|
"library": "BuilderAmisObject"
|
|
10
10
|
}
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"npm": {
|
|
16
16
|
"package": "@steedos-widgets/amis-object"
|
|
17
17
|
},
|
|
18
|
-
"url": "https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.
|
|
18
|
+
"url": "https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.26/dist/meta.js",
|
|
19
19
|
"urls": {
|
|
20
|
-
"default": "https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.
|
|
21
|
-
"design": "https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.
|
|
20
|
+
"default": "https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.26/dist/meta.js",
|
|
21
|
+
"design": "https://unpkg.com/@steedos-widgets/amis-object@6.10.53-beta.26/dist/meta.js"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 移动端触摸拖拽排序 Hook。
|
|
3
|
+
*
|
|
4
|
+
* 封装从 MobileDrawerContent 抽出的 touch 事件 + DOM clone 浮层算法,
|
|
5
|
+
* 兼容 iOS Safari(HTML5 drag/drop 在 iOS 上不触发,所以移动端必须自己实现)。
|
|
6
|
+
*
|
|
7
|
+
* 使用方式:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const { bind, dragActiveIndex, dropTargetIndex } = useTouchSort({
|
|
10
|
+
* itemCount: items.length,
|
|
11
|
+
* onReorder: (from, to) => setItems(reorder(items, from, to)),
|
|
12
|
+
* excludeSelector: '.my-remove-btn', // 在该按钮上按下时不触发拖拽
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* items.map((item, index) => (
|
|
16
|
+
* <div {...bind(index)} style={{ touchAction: 'none', userSelect: 'none' }}>...</div>
|
|
17
|
+
* ));
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* 视觉反馈建议由调用方根据 dragActiveIndex / dropTargetIndex 自行处理
|
|
21
|
+
* (如原位 opacity:0.3、目标位 borderTop:'2px solid #1890ff')。
|
|
22
|
+
*/
|
|
23
|
+
export interface UseTouchSortOptions {
|
|
24
|
+
/** 列表项数量;用于计算拖拽目标 index 的上下边界 */
|
|
25
|
+
itemCount: number;
|
|
26
|
+
/** 拖拽完成时回调,调用方负责实际重排数组 */
|
|
27
|
+
onReorder: (fromIndex: number, toIndex: number) => void;
|
|
28
|
+
/** CSS 选择器;若 touchstart 的 target 命中该选择器则不进入拖拽(用于排除删除按钮等子元素) */
|
|
29
|
+
excludeSelector?: string;
|
|
30
|
+
/** 是否触发触觉反馈(开始拖 20ms / 换位 10ms)。默认 true */
|
|
31
|
+
vibrate?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface UseTouchSortReturn {
|
|
34
|
+
/** 把返回值 spread 到列表项 DOM 上即可接入拖拽事件 */
|
|
35
|
+
bind: (index: number) => {
|
|
36
|
+
onTouchStart: (e: React.TouchEvent) => void;
|
|
37
|
+
onTouchMove: (e: React.TouchEvent) => void;
|
|
38
|
+
onTouchEnd: () => void;
|
|
39
|
+
};
|
|
40
|
+
/** 当前正在被拖动的原始 index;非拖拽态为 null */
|
|
41
|
+
dragActiveIndex: number | null;
|
|
42
|
+
/** 当前手指悬停的目标 index;非拖拽态为 null */
|
|
43
|
+
dropTargetIndex: number | null;
|
|
44
|
+
}
|
|
45
|
+
export declare function useTouchSort(options: UseTouchSortOptions): UseTouchSortReturn;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos-widgets/amis-object",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "6.10.53-beta.
|
|
4
|
+
"version": "6.10.53-beta.26",
|
|
5
5
|
"main": "dist/amis-object.cjs.js",
|
|
6
6
|
"module": "dist/amis-object.esm.js",
|
|
7
7
|
"unpkg": "dist/amis-object.umd.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
36
36
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
37
37
|
"@rollup/plugin-typescript": "^8.4.0",
|
|
38
|
-
"@steedos-widgets/amis-lib": "6.10.53-beta.
|
|
39
|
-
"@steedos-widgets/steedos-lib": "6.10.53-beta.
|
|
38
|
+
"@steedos-widgets/amis-lib": "6.10.53-beta.26",
|
|
39
|
+
"@steedos-widgets/steedos-lib": "6.10.53-beta.26",
|
|
40
40
|
"autoprefixer": "^10.4.13",
|
|
41
41
|
"cors": "^2.8.5",
|
|
42
42
|
"dotenv-flow": "^3.2.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"typescript": "^5.6.2",
|
|
65
65
|
"uglify-js": "^3.17.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "f16e9499c0779dbcbcc1e2737b1f1375f0e3e169"
|
|
68
68
|
}
|