@sepveneto/dnde 0.7.5 → 0.8.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/{lib/App.vue.d.ts → App.vue.d.ts} +21 -0
- package/dist/{lib/Editor.vue.d.ts → Editor.vue.d.ts} +25 -1
- package/dist/agent-Dkke4idy.js +647 -0
- package/dist/agents/context.d.ts +14 -0
- package/dist/{lib/components → components}/NodePlugin.vue.d.ts +4 -1
- package/dist/composables/dragCore.d.ts +69 -0
- package/dist/composables/useNodeListDrag.d.ts +15 -0
- package/dist/editor.js +4 -69539
- package/dist/main-CGf8hRhv.js +123122 -0
- package/dist/main.d.ts +19 -0
- package/dist/{lib/props.d.ts → props.d.ts} +9 -0
- package/dist/{lib/store → store}/editor.d.ts +4 -1
- package/dist/{lib/utils.d.ts → utils.d.ts} +9 -0
- package/package.json +6 -5
- package/dist/lib/main.d.ts +0 -5
- /package/dist/{lib/assets → assets}/container.vue.d.ts +0 -0
- /package/dist/{lib/assets → assets}/leftArrow.vue.d.ts +0 -0
- /package/dist/{lib/assets → assets}/puzzle.vue.d.ts +0 -0
- /package/dist/{lib/assets → assets}/widget.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/ColorPicker.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/ConfigForm.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/ConfigItem.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/ConfigRender.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/NodeContainer.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/NodeOperate.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/NodeWrap.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/StyleNumber.vue.d.ts +0 -0
- /package/dist/{lib/layout → layout}/configPanel.vue.d.ts +0 -0
- /package/dist/{lib/layout → layout}/treePanel.item.vue.d.ts +0 -0
- /package/dist/{lib/layout → layout}/treePanel.vue.d.ts +0 -0
- /package/dist/{lib/layout → layout}/widgetsMenu.vue.d.ts +0 -0
- /package/dist/{lib/store → store}/app.d.ts +0 -0
- /package/dist/{lib/store → store}/index.d.ts +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Node } from '@sepveneto/dnde-core/class';
|
|
2
|
+
/** 拖拽逻辑作用的目标列表 */
|
|
3
|
+
export interface DragTarget {
|
|
4
|
+
/** 当前列表(响应式数组) */
|
|
5
|
+
list: Node[];
|
|
6
|
+
/** 列表所属的父节点,根列表传 rootNode */
|
|
7
|
+
parent: Node;
|
|
8
|
+
/** 用新数组替换当前列表 */
|
|
9
|
+
setList: (list: Node[]) => void;
|
|
10
|
+
}
|
|
11
|
+
/** 拖拽逻辑需要的外部能力,由编辑器 store 提供 */
|
|
12
|
+
export interface DragHost {
|
|
13
|
+
/** 跨容器拖动被撤销时,把节点还原回指定容器的指定位置 */
|
|
14
|
+
restoreToContainer: (containerId: string, index: number, node: Node) => void;
|
|
15
|
+
/** 把节点登记到目标父节点下 */
|
|
16
|
+
addNode: (node: Node, parent: Node) => void;
|
|
17
|
+
}
|
|
18
|
+
/** 只取逻辑用到的字段,便于在测试中构造 */
|
|
19
|
+
export interface DragAddEvent {
|
|
20
|
+
newIndex: number;
|
|
21
|
+
newDraggableIndex: number;
|
|
22
|
+
oldIndex: number;
|
|
23
|
+
from: {
|
|
24
|
+
dataset: {
|
|
25
|
+
id?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
to: {
|
|
29
|
+
dataset: {
|
|
30
|
+
id?: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 找出列表中第一处重复出现的 wid。
|
|
36
|
+
*
|
|
37
|
+
* vuedraggable 在同级跨列表拖动时,会在目标列表里留下源列表的重复项,
|
|
38
|
+
* 靠这个函数定位需要清理的节点。
|
|
39
|
+
*/
|
|
40
|
+
export declare function findDuplicatedWid(list: Node[]): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* 该位置是否紧邻 fixed 节点(header 之后 / footer 之前都不允许插入)。
|
|
43
|
+
*
|
|
44
|
+
* 注意:入参是 `Widget.isFixed` 归一化之后的值,即 `meta.fixed: true` 会变成 `'header'`。
|
|
45
|
+
*/
|
|
46
|
+
export declare function isFixedBoundary(list: Node[], index: number): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 计算跨列表拖动后应从后一个数组中移除的重复项下标。
|
|
49
|
+
*
|
|
50
|
+
* `originIndex` 是被拖动节点在原数组中的位置,用来判断它在新数组里是上移还是下移。
|
|
51
|
+
* 返回 -1 表示不删除(没有重复,或相邻是 fixed 边界需要保留)。
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveDuplicateRemovalIndex(current: Node[], next: Node[], wid: string, originIndex: number): number;
|
|
54
|
+
/**
|
|
55
|
+
* 处理一次「放入」:
|
|
56
|
+
* - 落点紧邻 fixed 节点时撤销这次插入;
|
|
57
|
+
* - 跨容器拖动被撤销时,把节点还原回原容器;
|
|
58
|
+
* - 否则把节点登记到目标父节点下。
|
|
59
|
+
*/
|
|
60
|
+
export declare function handleNodeAdd(target: DragTarget, evt: DragAddEvent, host: DragHost): void;
|
|
61
|
+
/**
|
|
62
|
+
* 处理列表更新:
|
|
63
|
+
* - 长度没有增加(同级重排)→ 直接整体替换;
|
|
64
|
+
* - 长度增加(跨列表拖动)→ 清理 vuedraggable 留下的重复项,
|
|
65
|
+
* 若重复项紧邻 fixed 边界则保留。
|
|
66
|
+
*
|
|
67
|
+
* `defer` 用于把清理后的写入推迟到下一个 tick(与 vuedraggable 的更新时机对齐)。
|
|
68
|
+
*/
|
|
69
|
+
export declare function handleNodeInput(target: DragTarget, val: Node[], defer: (fn: () => void) => void): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DraggableEvt } from '@/type';
|
|
2
|
+
import type { Node } from '@sepveneto/dnde-core/class';
|
|
3
|
+
import type { DragTarget } from './dragCore';
|
|
4
|
+
export type NodeListDragTarget = DragTarget;
|
|
5
|
+
/**
|
|
6
|
+
* 编辑区与大纲面板中所有可拖拽列表共用的拖拽处理。
|
|
7
|
+
*
|
|
8
|
+
* 逻辑本体在 `./dragCore`(不依赖 store / vue,便于单测),
|
|
9
|
+
* 这里只负责取 store 并接线。
|
|
10
|
+
*/
|
|
11
|
+
export declare function useNodeListDrag(target: NodeListDragTarget): {
|
|
12
|
+
onStart: (evt: DraggableEvt) => void;
|
|
13
|
+
onAdd: (evt: DraggableEvt) => void;
|
|
14
|
+
onInput: (val: Node[]) => void;
|
|
15
|
+
};
|