@skaldapp/flat-json-tree 2.3.0 → 2.3.2
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 -0
- package/dist/index.js +10 -2
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ 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) => 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>;
|
|
13
20
|
kvNodes: import("vue").ComputedRef<{
|
|
14
21
|
[k: string]: unObject;
|
|
15
22
|
}>;
|
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]: {
|
|
@@ -110,6 +118,6 @@ export default (tree, { branch: keyBranch = "branch", children: keyChildren = "c
|
|
|
110
118
|
return {
|
|
111
119
|
kvNodes,
|
|
112
120
|
nodes,
|
|
113
|
-
...Object.fromEntries(
|
|
121
|
+
...Object.fromEntries(actionNames.map((key) => [key, (pId) => run(pId, key)])),
|
|
114
122
|
};
|
|
115
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.3.
|
|
4
|
+
"version": "2.3.2",
|
|
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",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"prettier": "@skaldapp/configs/prettierrc",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"random-word-slugs": "^0.1.7",
|
|
48
|
-
"vue": "^3.5.
|
|
48
|
+
"vue": "^3.5.39"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@skaldapp/configs": "^1.4.
|
|
52
|
-
"eslint": "^10.
|
|
51
|
+
"@skaldapp/configs": "^1.4.5",
|
|
52
|
+
"eslint": "^10.6.0"
|
|
53
53
|
}
|
|
54
54
|
}
|