@skaldapp/flat-json-tree 2.2.70 → 2.3.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/dist/index.d.ts +7 -7
- package/dist/index.js +10 -8
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,16 +10,16 @@ declare const _default: (tree: MaybeRef<unObject[]>, { branch: keyBranch, childr
|
|
|
10
10
|
prev?: string | undefined;
|
|
11
11
|
siblings?: string | undefined;
|
|
12
12
|
}) => {
|
|
13
|
-
add: (pId: string) => string | undefined
|
|
14
|
-
addChild: (pId: string) => string | undefined
|
|
15
|
-
down: (pId: string) => string | undefined
|
|
13
|
+
add: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
|
|
14
|
+
addChild: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
|
|
15
|
+
down: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
|
|
16
|
+
left: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
|
|
17
|
+
remove: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
|
|
18
|
+
right: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
|
|
19
|
+
up: (pId: string) => ReturnType<(pId: string, action: string) => string | undefined>;
|
|
16
20
|
kvNodes: import("vue").ComputedRef<{
|
|
17
21
|
[k: string]: unObject;
|
|
18
22
|
}>;
|
|
19
|
-
left: (pId: string) => string | undefined;
|
|
20
23
|
nodes: import("vue").ComputedRef<unObject[]>;
|
|
21
|
-
remove: (pId: string) => string | undefined;
|
|
22
|
-
right: (pId: string) => string | undefined;
|
|
23
|
-
up: (pId: string) => string | undefined;
|
|
24
24
|
};
|
|
25
25
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { generateSlug } from "random-word-slugs";
|
|
2
2
|
import { computed, toRef } from "vue";
|
|
3
|
-
const
|
|
3
|
+
const actionNames = [
|
|
4
|
+
"add",
|
|
5
|
+
"addChild",
|
|
6
|
+
"down",
|
|
7
|
+
"left",
|
|
8
|
+
"remove",
|
|
9
|
+
"right",
|
|
10
|
+
"up",
|
|
11
|
+
], configurable = true, getItems = (siblings, parent) => [...siblings].reverse().map((node) => ({ node, parent, siblings }));
|
|
4
12
|
export default (tree, { branch: keyBranch = "branch", children: keyChildren = "children", id: keyId = "id", index: keyIndex = "index", next: keyNext = "next", parent: keyParent = "parent", prev: keyPrev = "prev", siblings: keySiblings = "siblings", } = {}) => {
|
|
5
13
|
const properties = {
|
|
6
14
|
[keyBranch]: {
|
|
@@ -108,14 +116,8 @@ export default (tree, { branch: keyBranch = "branch", children: keyChildren = "c
|
|
|
108
116
|
return undefined;
|
|
109
117
|
};
|
|
110
118
|
return {
|
|
111
|
-
add: (pId) => run(pId, "add"),
|
|
112
|
-
addChild: (pId) => run(pId, "addChild"),
|
|
113
|
-
down: (pId) => run(pId, "down"),
|
|
114
119
|
kvNodes,
|
|
115
|
-
left: (pId) => run(pId, "left"),
|
|
116
120
|
nodes,
|
|
117
|
-
|
|
118
|
-
right: (pId) => run(pId, "right"),
|
|
119
|
-
up: (pId) => run(pId, "up"),
|
|
121
|
+
...Object.fromEntries(actionNames.map((key) => [key, (pId) => run(pId, key)])),
|
|
120
122
|
};
|
|
121
123
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package",
|
|
3
3
|
"name": "@skaldapp/flat-json-tree",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"description": "A Vue 3 composable that transforms JSON tree objects into flat arrays for easy manipulation with standard array operations while maintaining tree structure through computed properties",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vue",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vue": "^3.5.35"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@skaldapp/configs": "^1.4.
|
|
51
|
+
"@skaldapp/configs": "^1.4.3",
|
|
52
52
|
"eslint": "^10.4.1"
|
|
53
53
|
}
|
|
54
54
|
}
|