reneco-hierarchized-picker 0.4.3-beta.18 → 0.4.3-beta.19
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/cjs/reneco-hierarchized-picker_2.cjs.entry.js +24 -3
- package/dist/collection/components/hierarchized-picker/hierarchized-picker.js +22 -0
- package/dist/collection/features/tree/tree-utils.js +2 -3
- package/dist/custom-elements/index.js +24 -3
- package/dist/esm/reneco-hierarchized-picker_2.entry.js +24 -3
- package/dist/esm-es5/reneco-hierarchized-picker_2.entry.js +1 -1
- package/dist/reneco-hierarchized-picker/{p-0b7769a1.entry.js → p-711d3319.entry.js} +1 -1
- package/dist/reneco-hierarchized-picker/p-73168a50.system.js +1 -1
- package/dist/reneco-hierarchized-picker/{p-8c379f58.system.entry.js → p-c45cf4da.system.entry.js} +1 -1
- package/dist/reneco-hierarchized-picker/reneco-hierarchized-picker.esm.js +1 -1
- package/dist/types/features/tree/tree-utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -18461,7 +18461,7 @@ function findNodeById(tree, nodeId) {
|
|
|
18461
18461
|
/**
|
|
18462
18462
|
* Fills the tree with nodes based on the provided object.
|
|
18463
18463
|
*/
|
|
18464
|
-
function fillTreeWithObject(tree, myObject, searched, options
|
|
18464
|
+
function fillTreeWithObject(tree, myObject, searched, options) {
|
|
18465
18465
|
const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
|
|
18466
18466
|
if (myObject && myObject.length) {
|
|
18467
18467
|
myObject.forEach(value => {
|
|
@@ -18493,7 +18493,6 @@ function fillTreeWithObject(tree, myObject, searched, options, depth = 0) {
|
|
|
18493
18493
|
const objToPush = {
|
|
18494
18494
|
id: keyPropFromNode,
|
|
18495
18495
|
nodeId: keyPropFromNode,
|
|
18496
|
-
depth,
|
|
18497
18496
|
text: valueTranslatedPropFromNode,
|
|
18498
18497
|
fullpath: fullpathPropFromNode,
|
|
18499
18498
|
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
@@ -18502,7 +18501,7 @@ function fillTreeWithObject(tree, myObject, searched, options, depth = 0) {
|
|
|
18502
18501
|
isDesaturated: false,
|
|
18503
18502
|
searchMatch: false,
|
|
18504
18503
|
};
|
|
18505
|
-
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options
|
|
18504
|
+
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options);
|
|
18506
18505
|
let pushMe = false;
|
|
18507
18506
|
if (searched) {
|
|
18508
18507
|
const matched = searchValue(objToPush, false, searched);
|
|
@@ -19528,6 +19527,28 @@ const HierarchizedPickerComponent = class {
|
|
|
19528
19527
|
document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-checkbox').forEach((item) => (item.style.display = (this.theOptions.multiple ? 'inline-block' : 'none')));
|
|
19529
19528
|
}
|
|
19530
19529
|
onItemContextMenuItemClick(e) {
|
|
19530
|
+
if (e.target && e.target.id) {
|
|
19531
|
+
function getDirectParentAndDepth(nodesById, targetId) {
|
|
19532
|
+
// Find the direct parent
|
|
19533
|
+
const parent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === targetId); }) || null;
|
|
19534
|
+
if (!nodesById[targetId])
|
|
19535
|
+
return null; // target not found
|
|
19536
|
+
// Depth is 0 for root nodes, 1 for children of root, etc.
|
|
19537
|
+
let depth = 0;
|
|
19538
|
+
let current = targetId;
|
|
19539
|
+
while (true) {
|
|
19540
|
+
const directParent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === current); });
|
|
19541
|
+
if (!directParent)
|
|
19542
|
+
break;
|
|
19543
|
+
depth++;
|
|
19544
|
+
current = directParent.id;
|
|
19545
|
+
}
|
|
19546
|
+
return { parent, depth };
|
|
19547
|
+
}
|
|
19548
|
+
const result = getDirectParentAndDepth(this.loadedTreeJs.nodesById, e.target.id);
|
|
19549
|
+
e.target.depth = result.depth;
|
|
19550
|
+
e.target.parentId = result.parent.id;
|
|
19551
|
+
}
|
|
19531
19552
|
this.itemContextMenuItemClick.emit(e);
|
|
19532
19553
|
}
|
|
19533
19554
|
setNodeAsSelected(id, treeToUpdate, userClick) {
|
|
@@ -789,6 +789,28 @@ export class HierarchizedPickerComponent {
|
|
|
789
789
|
document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-checkbox').forEach((item) => (item.style.display = (this.theOptions.multiple ? 'inline-block' : 'none')));
|
|
790
790
|
}
|
|
791
791
|
onItemContextMenuItemClick(e) {
|
|
792
|
+
if (e.target && e.target.id) {
|
|
793
|
+
function getDirectParentAndDepth(nodesById, targetId) {
|
|
794
|
+
// Find the direct parent
|
|
795
|
+
const parent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === targetId); }) || null;
|
|
796
|
+
if (!nodesById[targetId])
|
|
797
|
+
return null; // target not found
|
|
798
|
+
// Depth is 0 for root nodes, 1 for children of root, etc.
|
|
799
|
+
let depth = 0;
|
|
800
|
+
let current = targetId;
|
|
801
|
+
while (true) {
|
|
802
|
+
const directParent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === current); });
|
|
803
|
+
if (!directParent)
|
|
804
|
+
break;
|
|
805
|
+
depth++;
|
|
806
|
+
current = directParent.id;
|
|
807
|
+
}
|
|
808
|
+
return { parent, depth };
|
|
809
|
+
}
|
|
810
|
+
const result = getDirectParentAndDepth(this.loadedTreeJs.nodesById, e.target.id);
|
|
811
|
+
e.target.depth = result.depth;
|
|
812
|
+
e.target.parentId = result.parent.id;
|
|
813
|
+
}
|
|
792
814
|
this.itemContextMenuItemClick.emit(e);
|
|
793
815
|
}
|
|
794
816
|
setNodeAsSelected(id, treeToUpdate, userClick) {
|
|
@@ -47,7 +47,7 @@ export function findNodeById(tree, nodeId) {
|
|
|
47
47
|
/**
|
|
48
48
|
* Fills the tree with nodes based on the provided object.
|
|
49
49
|
*/
|
|
50
|
-
export function fillTreeWithObject(tree, myObject, searched, options
|
|
50
|
+
export function fillTreeWithObject(tree, myObject, searched, options) {
|
|
51
51
|
const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
|
|
52
52
|
if (myObject && myObject.length) {
|
|
53
53
|
myObject.forEach(value => {
|
|
@@ -79,7 +79,6 @@ export function fillTreeWithObject(tree, myObject, searched, options, depth = 0)
|
|
|
79
79
|
const objToPush = {
|
|
80
80
|
id: keyPropFromNode,
|
|
81
81
|
nodeId: keyPropFromNode,
|
|
82
|
-
depth,
|
|
83
82
|
text: valueTranslatedPropFromNode,
|
|
84
83
|
fullpath: fullpathPropFromNode,
|
|
85
84
|
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
@@ -88,7 +87,7 @@ export function fillTreeWithObject(tree, myObject, searched, options, depth = 0)
|
|
|
88
87
|
isDesaturated: false,
|
|
89
88
|
searchMatch: false,
|
|
90
89
|
};
|
|
91
|
-
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options
|
|
90
|
+
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options);
|
|
92
91
|
let pushMe = false;
|
|
93
92
|
if (searched) {
|
|
94
93
|
const matched = searchValue(objToPush, false, searched);
|
|
@@ -18458,7 +18458,7 @@ function findNodeById(tree, nodeId) {
|
|
|
18458
18458
|
/**
|
|
18459
18459
|
* Fills the tree with nodes based on the provided object.
|
|
18460
18460
|
*/
|
|
18461
|
-
function fillTreeWithObject(tree, myObject, searched, options
|
|
18461
|
+
function fillTreeWithObject(tree, myObject, searched, options) {
|
|
18462
18462
|
const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
|
|
18463
18463
|
if (myObject && myObject.length) {
|
|
18464
18464
|
myObject.forEach(value => {
|
|
@@ -18490,7 +18490,6 @@ function fillTreeWithObject(tree, myObject, searched, options, depth = 0) {
|
|
|
18490
18490
|
const objToPush = {
|
|
18491
18491
|
id: keyPropFromNode,
|
|
18492
18492
|
nodeId: keyPropFromNode,
|
|
18493
|
-
depth,
|
|
18494
18493
|
text: valueTranslatedPropFromNode,
|
|
18495
18494
|
fullpath: fullpathPropFromNode,
|
|
18496
18495
|
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
@@ -18499,7 +18498,7 @@ function fillTreeWithObject(tree, myObject, searched, options, depth = 0) {
|
|
|
18499
18498
|
isDesaturated: false,
|
|
18500
18499
|
searchMatch: false,
|
|
18501
18500
|
};
|
|
18502
|
-
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options
|
|
18501
|
+
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options);
|
|
18503
18502
|
let pushMe = false;
|
|
18504
18503
|
if (searched) {
|
|
18505
18504
|
const matched = searchValue(objToPush, false, searched);
|
|
@@ -19526,6 +19525,28 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19526
19525
|
document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-checkbox').forEach((item) => (item.style.display = (this.theOptions.multiple ? 'inline-block' : 'none')));
|
|
19527
19526
|
}
|
|
19528
19527
|
onItemContextMenuItemClick(e) {
|
|
19528
|
+
if (e.target && e.target.id) {
|
|
19529
|
+
function getDirectParentAndDepth(nodesById, targetId) {
|
|
19530
|
+
// Find the direct parent
|
|
19531
|
+
const parent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === targetId); }) || null;
|
|
19532
|
+
if (!nodesById[targetId])
|
|
19533
|
+
return null; // target not found
|
|
19534
|
+
// Depth is 0 for root nodes, 1 for children of root, etc.
|
|
19535
|
+
let depth = 0;
|
|
19536
|
+
let current = targetId;
|
|
19537
|
+
while (true) {
|
|
19538
|
+
const directParent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === current); });
|
|
19539
|
+
if (!directParent)
|
|
19540
|
+
break;
|
|
19541
|
+
depth++;
|
|
19542
|
+
current = directParent.id;
|
|
19543
|
+
}
|
|
19544
|
+
return { parent, depth };
|
|
19545
|
+
}
|
|
19546
|
+
const result = getDirectParentAndDepth(this.loadedTreeJs.nodesById, e.target.id);
|
|
19547
|
+
e.target.depth = result.depth;
|
|
19548
|
+
e.target.parentId = result.parent.id;
|
|
19549
|
+
}
|
|
19529
19550
|
this.itemContextMenuItemClick.emit(e);
|
|
19530
19551
|
}
|
|
19531
19552
|
setNodeAsSelected(id, treeToUpdate, userClick) {
|
|
@@ -18457,7 +18457,7 @@ function findNodeById(tree, nodeId) {
|
|
|
18457
18457
|
/**
|
|
18458
18458
|
* Fills the tree with nodes based on the provided object.
|
|
18459
18459
|
*/
|
|
18460
|
-
function fillTreeWithObject(tree, myObject, searched, options
|
|
18460
|
+
function fillTreeWithObject(tree, myObject, searched, options) {
|
|
18461
18461
|
const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
|
|
18462
18462
|
if (myObject && myObject.length) {
|
|
18463
18463
|
myObject.forEach(value => {
|
|
@@ -18489,7 +18489,6 @@ function fillTreeWithObject(tree, myObject, searched, options, depth = 0) {
|
|
|
18489
18489
|
const objToPush = {
|
|
18490
18490
|
id: keyPropFromNode,
|
|
18491
18491
|
nodeId: keyPropFromNode,
|
|
18492
|
-
depth,
|
|
18493
18492
|
text: valueTranslatedPropFromNode,
|
|
18494
18493
|
fullpath: fullpathPropFromNode,
|
|
18495
18494
|
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
@@ -18498,7 +18497,7 @@ function fillTreeWithObject(tree, myObject, searched, options, depth = 0) {
|
|
|
18498
18497
|
isDesaturated: false,
|
|
18499
18498
|
searchMatch: false,
|
|
18500
18499
|
};
|
|
18501
|
-
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options
|
|
18500
|
+
const childTree = fillTreeWithObject(objToPush.children, childrenPropFromNode, searched, options);
|
|
18502
18501
|
let pushMe = false;
|
|
18503
18502
|
if (searched) {
|
|
18504
18503
|
const matched = searchValue(objToPush, false, searched);
|
|
@@ -19524,6 +19523,28 @@ const HierarchizedPickerComponent = class {
|
|
|
19524
19523
|
document.querySelectorAll('#tree-area-' + this.componentID + ' .treejs-checkbox').forEach((item) => (item.style.display = (this.theOptions.multiple ? 'inline-block' : 'none')));
|
|
19525
19524
|
}
|
|
19526
19525
|
onItemContextMenuItemClick(e) {
|
|
19526
|
+
if (e.target && e.target.id) {
|
|
19527
|
+
function getDirectParentAndDepth(nodesById, targetId) {
|
|
19528
|
+
// Find the direct parent
|
|
19529
|
+
const parent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === targetId); }) || null;
|
|
19530
|
+
if (!nodesById[targetId])
|
|
19531
|
+
return null; // target not found
|
|
19532
|
+
// Depth is 0 for root nodes, 1 for children of root, etc.
|
|
19533
|
+
let depth = 0;
|
|
19534
|
+
let current = targetId;
|
|
19535
|
+
while (true) {
|
|
19536
|
+
const directParent = Object.values(nodesById).find(node => { var _a; return (_a = node.children) === null || _a === void 0 ? void 0 : _a.some(child => child.id === current); });
|
|
19537
|
+
if (!directParent)
|
|
19538
|
+
break;
|
|
19539
|
+
depth++;
|
|
19540
|
+
current = directParent.id;
|
|
19541
|
+
}
|
|
19542
|
+
return { parent, depth };
|
|
19543
|
+
}
|
|
19544
|
+
const result = getDirectParentAndDepth(this.loadedTreeJs.nodesById, e.target.id);
|
|
19545
|
+
e.target.depth = result.depth;
|
|
19546
|
+
e.target.parentId = result.parent.id;
|
|
19547
|
+
}
|
|
19527
19548
|
this.itemContextMenuItemClick.emit(e);
|
|
19528
19549
|
}
|
|
19529
19550
|
setNodeAsSelected(id, treeToUpdate, userClick) {
|