@rkmodules/rules 0.0.97 → 0.0.99
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.cjs.js +30 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/DataTree/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -261,6 +261,32 @@ function getBranches(tree) {
|
|
|
261
261
|
function getPaths(tree) {
|
|
262
262
|
return Object.keys(tree);
|
|
263
263
|
}
|
|
264
|
+
function getItem(tree, path, index) {
|
|
265
|
+
var branch = getBranch(tree, path);
|
|
266
|
+
if (branch) {
|
|
267
|
+
return branch[index];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function forEachBranch(tree, fn) {
|
|
271
|
+
var paths = getPaths(tree);
|
|
272
|
+
paths.forEach(function (path, i) {
|
|
273
|
+
var branch = tree[path];
|
|
274
|
+
fn(branch, path, i);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function forEachItem(tree, fn) {
|
|
278
|
+
forEachBranch(tree, function (branch, path, pathIndex) {
|
|
279
|
+
branch.forEach(function (item, i) {
|
|
280
|
+
fn(item, path, pathIndex, i);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function pushItem(tree, path, item) {
|
|
285
|
+
if (!tree[path]) {
|
|
286
|
+
tree[path] = [];
|
|
287
|
+
}
|
|
288
|
+
tree[path].push(item);
|
|
289
|
+
}
|
|
264
290
|
/**
|
|
265
291
|
* maps a tree, the tree branches are flatmapped, so if an array is returned for each item in the list, a flat list is returned
|
|
266
292
|
* @param tree
|
|
@@ -7244,5 +7270,5 @@ function DDContext(_a) {
|
|
|
7244
7270
|
return React.createElement(DndProvider, { backend: HTML5Backend }, children);
|
|
7245
7271
|
}
|
|
7246
7272
|
|
|
7247
|
-
export { DDContext, DISCARD, Engine, Flow, Lib, binaryOnTree, binaryOnTreeBranch, broadCast, expandTree, getBranch, getBranches, getPaths, getPositions, getReferences, getValue$1 as getValue, getVariable, graftTree, hasReference, interpolate, isReference, isSingleTon, isTree, mapTree, mapTreeBranch, nAryOnTree, nAryOnTreeBranch, normalizeVarDef, parseReference, primitives, sameShape, simplifyTree$1 as simplifyTree, toArray, topSort, treeSize, trimTree, uid$1 as uid, useDraggableNode, useFlow, useFunction, usePositions, useUpdatePositions, useVariable, variableStore };
|
|
7273
|
+
export { DDContext, DISCARD, Engine, Flow, Lib, binaryOnTree, binaryOnTreeBranch, broadCast, expandTree, forEachBranch, forEachItem, getBranch, getBranches, getItem, getPaths, getPositions, getReferences, getValue$1 as getValue, getVariable, graftTree, hasReference, interpolate, isReference, isSingleTon, isTree, mapTree, mapTreeBranch, nAryOnTree, nAryOnTreeBranch, normalizeVarDef, parseReference, primitives, pushItem, sameShape, simplifyTree$1 as simplifyTree, toArray, topSort, treeSize, trimTree, uid$1 as uid, useDraggableNode, useFlow, useFunction, usePositions, useUpdatePositions, useVariable, variableStore };
|
|
7248
7274
|
//# sourceMappingURL=index.esm.js.map
|