tpmkms_4wp 9.1.1-beta.8 → 9.1.1-beta.9
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/common/helpers/menus.js +132 -0
- package/package.json +3 -2
@@ -0,0 +1,132 @@
|
|
1
|
+
const calculateLefts = (defs) => {
|
2
|
+
const lefts = {}
|
3
|
+
calculateLeftsHelper(defs, lefts)
|
4
|
+
return lefts
|
5
|
+
}
|
6
|
+
|
7
|
+
const calculateLeftsHelper = (defs, lefts) => {
|
8
|
+
if (Array.isArray(defs)) {
|
9
|
+
let previous
|
10
|
+
for (const def of defs) {
|
11
|
+
if (previous) {
|
12
|
+
lefts[def.key] = previous.key
|
13
|
+
previous = def
|
14
|
+
} else {
|
15
|
+
previous = def
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
return lefts
|
20
|
+
}
|
21
|
+
|
22
|
+
const calculateRights = (defs) => {
|
23
|
+
const rights = {}
|
24
|
+
calculateRightsHelper(defs, rights)
|
25
|
+
return rights
|
26
|
+
}
|
27
|
+
|
28
|
+
const calculateRightsHelper = (defs, rights) => {
|
29
|
+
if (Array.isArray(defs)) {
|
30
|
+
let previous
|
31
|
+
for (const def of defs) {
|
32
|
+
if (previous) {
|
33
|
+
rights[previous.key] = def.key
|
34
|
+
previous = def
|
35
|
+
} else {
|
36
|
+
previous = def
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return rights
|
41
|
+
}
|
42
|
+
|
43
|
+
const calculateDowns = (defs) => {
|
44
|
+
const downs = {}
|
45
|
+
calculateDownsHelper(defs, downs)
|
46
|
+
return downs
|
47
|
+
}
|
48
|
+
|
49
|
+
const calculateDownsHelper = (defs, downs) => {
|
50
|
+
if (Array.isArray(defs)) {
|
51
|
+
for (const def of defs) {
|
52
|
+
calculateDownsHelper(def, downs)
|
53
|
+
}
|
54
|
+
} else if (defs.children) {
|
55
|
+
if (defs.children.length > 0) {
|
56
|
+
downs[defs.key] = defs.children[0].key
|
57
|
+
}
|
58
|
+
|
59
|
+
let previous
|
60
|
+
for (const child of defs.children) {
|
61
|
+
if (child.divider) {
|
62
|
+
continue
|
63
|
+
}
|
64
|
+
if (previous) {
|
65
|
+
downs[previous.key] = child.key
|
66
|
+
previous = child
|
67
|
+
} else {
|
68
|
+
previous = child
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return downs
|
73
|
+
}
|
74
|
+
|
75
|
+
const calculateUps = (defs) => {
|
76
|
+
const ups = {}
|
77
|
+
calculateUpsHelper(defs, ups)
|
78
|
+
return ups
|
79
|
+
}
|
80
|
+
|
81
|
+
const calculateUpsHelper = (defs, ups) => {
|
82
|
+
if (Array.isArray(defs)) {
|
83
|
+
for (const def of defs) {
|
84
|
+
calculateUpsHelper(def, ups)
|
85
|
+
}
|
86
|
+
} else if (defs.children) {
|
87
|
+
let previous
|
88
|
+
for (const child of defs.children) {
|
89
|
+
if (child.divider) {
|
90
|
+
continue
|
91
|
+
}
|
92
|
+
if (previous) {
|
93
|
+
ups[child.key] = previous.key
|
94
|
+
previous = child
|
95
|
+
} else {
|
96
|
+
previous = child
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
return ups
|
101
|
+
}
|
102
|
+
|
103
|
+
const calculateParents = (defs) => {
|
104
|
+
const parents = {}
|
105
|
+
calculateParentsHelper(defs, parents)
|
106
|
+
return parents
|
107
|
+
}
|
108
|
+
|
109
|
+
const calculateParentsHelper = (defs, parents) => {
|
110
|
+
if (Array.isArray(defs)) {
|
111
|
+
for (const def of defs) {
|
112
|
+
parents[def.key] = def.key
|
113
|
+
calculateParentsHelper(def, parents)
|
114
|
+
}
|
115
|
+
} else if (defs.children) {
|
116
|
+
for (const child of defs.children) {
|
117
|
+
if (child.divider) {
|
118
|
+
continue
|
119
|
+
}
|
120
|
+
parents[child.key] = defs.key
|
121
|
+
}
|
122
|
+
}
|
123
|
+
return parents
|
124
|
+
}
|
125
|
+
|
126
|
+
module.exports = {
|
127
|
+
calculateRights,
|
128
|
+
calculateLefts,
|
129
|
+
calculateDowns,
|
130
|
+
calculateUps,
|
131
|
+
calculateParents,
|
132
|
+
}
|
package/package.json
CHANGED
@@ -206,6 +206,7 @@
|
|
206
206
|
"common/helpers/dialogues.js",
|
207
207
|
"common/helpers/formulas.js",
|
208
208
|
"common/helpers/frankenhash.js",
|
209
|
+
"common/helpers/menus.js",
|
209
210
|
"common/helpers/meta.js",
|
210
211
|
"common/helpers/ordering.js",
|
211
212
|
"common/helpers/properties.js",
|
@@ -324,8 +325,8 @@
|
|
324
325
|
"scriptjs": "^2.5.9",
|
325
326
|
"table": "^6.7.1",
|
326
327
|
"uuid": "^9.0.0",
|
327
|
-
"theprogrammablemind_4wp": "9.1.1-beta.
|
328
|
+
"theprogrammablemind_4wp": "9.1.1-beta.9"
|
328
329
|
},
|
329
|
-
"version": "9.1.1-beta.
|
330
|
+
"version": "9.1.1-beta.9",
|
330
331
|
"license": "UNLICENSED"
|
331
332
|
}
|