@keenmate/svelte-treeview 1.0.0-beta.0 → 1.0.0-beta.1
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/README.md +38 -38
- package/dist/Branch.svelte +126 -132
- package/dist/Checkbox.svelte +30 -52
- package/dist/Checkbox.svelte.d.ts +0 -2
- package/dist/TreeView.svelte +65 -69
- package/dist/TreeView.svelte.d.ts +12 -12
- package/dist/constants.js +2 -6
- package/dist/helpers/tree-helper.d.ts +12 -19
- package/dist/helpers/tree-helper.js +52 -54
- package/dist/menu/ContextMenu.svelte +27 -33
- package/dist/menu/ContextMenu.svelte.d.ts +8 -18
- package/dist/menu/Menu.svelte +51 -50
- package/dist/menu/MenuDivider.svelte +11 -10
- package/dist/menu/MenuOption.svelte +50 -49
- package/dist/menu/menu.js +2 -2
- package/dist/providers/drag-drop-provider.d.ts +0 -29
- package/dist/providers/drag-drop-provider.js +186 -163
- package/dist/providers/selection-provider.d.ts +4 -6
- package/dist/providers/selection-provider.js +43 -31
- package/dist/tree-styles.sass +105 -105
- package/dist/types.d.ts +29 -8
- package/package.json +71 -71
- package/dist/helpers/property-helper.d.ts +0 -31
- package/dist/helpers/property-helper.js +0 -94
- package/dist/stores/drag-and-drop-store.d.ts +0 -13
- package/dist/stores/drag-and-drop-store.js +0 -23
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
export class PropertyHelper {
|
|
2
|
-
props;
|
|
3
|
-
constructor(props) {
|
|
4
|
-
this.props = props;
|
|
5
|
-
}
|
|
6
|
-
getVal(node, key) {
|
|
7
|
-
return node?.[key];
|
|
8
|
-
}
|
|
9
|
-
setVal(node, key, value) {
|
|
10
|
-
node[key] = value;
|
|
11
|
-
}
|
|
12
|
-
id(node) {
|
|
13
|
-
return this.getVal(node, this.props.nodeId);
|
|
14
|
-
}
|
|
15
|
-
setId(node, id) {
|
|
16
|
-
this.setVal(node, this.props.nodeId, id);
|
|
17
|
-
}
|
|
18
|
-
path(node) {
|
|
19
|
-
// root nodeF
|
|
20
|
-
if (node === null) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return this.getVal(node, this.props.nodePath);
|
|
24
|
-
}
|
|
25
|
-
setPath(node, path) {
|
|
26
|
-
this.setVal(node, this.props.nodePath, path);
|
|
27
|
-
}
|
|
28
|
-
hasChildren(node) {
|
|
29
|
-
return this.getVal(node, this.props.hasChildren) ?? false;
|
|
30
|
-
}
|
|
31
|
-
setHasChildren(node, hasChildren) {
|
|
32
|
-
this.setVal(node, this.props.hasChildren, hasChildren);
|
|
33
|
-
}
|
|
34
|
-
expanded(node) {
|
|
35
|
-
return this.getVal(node, this.props.expanded) ?? null;
|
|
36
|
-
}
|
|
37
|
-
setExpanded(node, expanded) {
|
|
38
|
-
this.setVal(node, this.props.expanded, expanded);
|
|
39
|
-
}
|
|
40
|
-
selected(node) {
|
|
41
|
-
return this.getVal(node, this.props.selected);
|
|
42
|
-
}
|
|
43
|
-
setSelected(node, selected) {
|
|
44
|
-
this.setVal(node, this.props.selected, selected);
|
|
45
|
-
}
|
|
46
|
-
useCallback(node) {
|
|
47
|
-
return this.getVal(node, this.props.useCallback) ?? false;
|
|
48
|
-
}
|
|
49
|
-
setUseCallback(node, useCallback) {
|
|
50
|
-
this.setVal(node, this.props.useCallback, useCallback);
|
|
51
|
-
}
|
|
52
|
-
priority(node) {
|
|
53
|
-
return this.getVal(node, this.props.priority) ?? 0;
|
|
54
|
-
}
|
|
55
|
-
setPriority(node, priority) {
|
|
56
|
-
this.setVal(node, this.props.priority, priority);
|
|
57
|
-
}
|
|
58
|
-
isDraggable(node) {
|
|
59
|
-
return this.getVal(node, this.props.isDraggable) ?? false;
|
|
60
|
-
}
|
|
61
|
-
setIsDraggable(node, isDraggable) {
|
|
62
|
-
this.setVal(node, this.props.isDraggable, isDraggable);
|
|
63
|
-
}
|
|
64
|
-
insertDisabled(node) {
|
|
65
|
-
if (node === null) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return this.getVal(node, this.props.insertDisabled) ?? false;
|
|
69
|
-
}
|
|
70
|
-
setInsertDisabled(node, insertDisabled) {
|
|
71
|
-
this.setVal(node, this.props.insertDisabled, insertDisabled);
|
|
72
|
-
}
|
|
73
|
-
nestDisabled(node) {
|
|
74
|
-
if (node === null) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
return this.getVal(node, this.props.nestDisabled) ?? false;
|
|
78
|
-
}
|
|
79
|
-
setNestDisabled(node, nestDisabled) {
|
|
80
|
-
this.setVal(node, this.props.nestDisabled, nestDisabled);
|
|
81
|
-
}
|
|
82
|
-
checkbox(node) {
|
|
83
|
-
return this.getVal(node, this.props.checkbox) ?? null;
|
|
84
|
-
}
|
|
85
|
-
setCheckbox(node, checkbox) {
|
|
86
|
-
this.setVal(node, this.props.checkbox, checkbox);
|
|
87
|
-
}
|
|
88
|
-
visualState(node) {
|
|
89
|
-
return this.getVal(node, this.props.visualState) ?? null;
|
|
90
|
-
}
|
|
91
|
-
setVisualState(node, visualState) {
|
|
92
|
-
this.setVal(node, this.props.visualState, visualState);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { TreeHelper } from '../helpers/tree-helper.js';
|
|
3
|
-
import { type BeforeMovedCallback, type DragEnterCallback, HighlighType } from '../types.js';
|
|
4
|
-
import { type Readable } from 'svelte/store';
|
|
5
|
-
type dragConfig = {
|
|
6
|
-
dragEnterCallback: DragEnterCallback | null;
|
|
7
|
-
beforeMovedCallback: BeforeMovedCallback | null;
|
|
8
|
-
};
|
|
9
|
-
export declare function startDrag(config: dragConfig): {
|
|
10
|
-
highligh(helper: TreeHelper, node: Node): Readable<HighlighType>;
|
|
11
|
-
isDragged(helper: TreeHelper, node: Node): Readable<boolean>;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { HighlighType } from '../types.js';
|
|
2
|
-
import { derived, writable } from 'svelte/store';
|
|
3
|
-
const storeDefaults = {
|
|
4
|
-
dragging: false,
|
|
5
|
-
x: 0,
|
|
6
|
-
y: 0
|
|
7
|
-
};
|
|
8
|
-
export function startDrag(config) {
|
|
9
|
-
const draggedNodeStore = writable(null);
|
|
10
|
-
return {
|
|
11
|
-
highligh(helper, node) {
|
|
12
|
-
// forces update when gragged nodes is changed
|
|
13
|
-
return derived([draggedNodeStore], ([store]) => {
|
|
14
|
-
return HighlighType.none;
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
isDragged(helper, node) {
|
|
18
|
-
return derived([draggedNodeStore], ([draggedNode]) => {
|
|
19
|
-
return helper.path(node) === helper.path(draggedNode);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|