reneco-hierarchized-picker 0.5.7 → 0.5.8
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 +25 -23
- package/dist/collection/components/hierarchized-picker/hierarchized-picker.js +24 -1
- package/dist/collection/components/treejs/index.js +1 -1
- package/dist/collection/features/tree/tree-utils.js +0 -21
- package/dist/custom-elements/index.js +25 -23
- package/dist/esm/reneco-hierarchized-picker_2.entry.js +25 -23
- package/dist/esm-es5/reneco-hierarchized-picker_2.entry.js +1 -1
- package/dist/reneco-hierarchized-picker/p-34d3b39a.system.entry.js +3 -0
- package/dist/reneco-hierarchized-picker/p-637ac220.entry.js +1 -0
- package/dist/reneco-hierarchized-picker/p-73168a50.system.js +1 -1
- package/dist/reneco-hierarchized-picker/reneco-hierarchized-picker.esm.js +1 -1
- package/package.json +1 -1
- package/dist/reneco-hierarchized-picker/p-209116db.entry.js +0 -1
- package/dist/reneco-hierarchized-picker/p-4e04f314.system.entry.js +0 -3
|
@@ -627,7 +627,7 @@ Tree.parseTreeData = function (data) {
|
|
|
627
627
|
values.push(node.id);
|
|
628
628
|
if (node.disabled)
|
|
629
629
|
disables.push(node.id);
|
|
630
|
-
if (parent)
|
|
630
|
+
if (parent && Object.keys(node).length > 0)
|
|
631
631
|
node.parent = parent;
|
|
632
632
|
if (node.children && node.children.length) {
|
|
633
633
|
walkTree(node.children, node);
|
|
@@ -18442,27 +18442,6 @@ function findNodeById(tree, nodeId) {
|
|
|
18442
18442
|
function normalizeStr(str) {
|
|
18443
18443
|
return str.replace(/\u00A0/g, " ");
|
|
18444
18444
|
}
|
|
18445
|
-
// TODO Deprecated ?
|
|
18446
|
-
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
18447
|
-
// let toret: any[] = [];
|
|
18448
|
-
// if (data && data.children) {
|
|
18449
|
-
// data.children.forEach(value => {
|
|
18450
|
-
// if (value && value.valueTranslated) {
|
|
18451
|
-
// if (value.valueTranslated.toLowerCase().includes(searched.toLowerCase())) {
|
|
18452
|
-
// toret.push({
|
|
18453
|
-
// id: value.key,
|
|
18454
|
-
// fullpath: value.fullpath,
|
|
18455
|
-
// fullpathTranslated: value.fullpathTranslated,
|
|
18456
|
-
// text: value.valueTranslated,
|
|
18457
|
-
// deprecated: value.deprecated,
|
|
18458
|
-
// });
|
|
18459
|
-
// }
|
|
18460
|
-
// toret = toret.concat(getNodesFromSearch(value, searched));
|
|
18461
|
-
// }
|
|
18462
|
-
// });
|
|
18463
|
-
// }
|
|
18464
|
-
// return toret;
|
|
18465
|
-
// }
|
|
18466
18445
|
/**
|
|
18467
18446
|
* Fills the tree with nodes based on the provided object.
|
|
18468
18447
|
*/
|
|
@@ -19705,16 +19684,39 @@ const HierarchizedPickerComponent = class {
|
|
|
19705
19684
|
}
|
|
19706
19685
|
}
|
|
19707
19686
|
async scrollToNodeWithId(targetNodeId, displayChildren = false, refreshPicker = false) {
|
|
19687
|
+
var _a;
|
|
19708
19688
|
if (refreshPicker)
|
|
19709
19689
|
await this.refreshPicker();
|
|
19710
19690
|
const targetNode = this.loadedTreeJs.liElementsById[targetNodeId];
|
|
19691
|
+
const children = ((_a = this.loadedTreeJs.nodesById[targetNodeId]) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
19692
|
+
const hasNoRealChildren = children.length === 0 || (children.length === 1 && Object.keys(children[0]).length === 0);
|
|
19711
19693
|
if (refreshPicker || !targetNode) {
|
|
19712
19694
|
const contextualApiParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { Reach: [targetNodeId] }), null, true);
|
|
19713
19695
|
const contextualApiURL = this.getContextualApiURL(true, Object.assign(Object.assign({}, this.theOptions), { options: contextualApiParams }));
|
|
19714
19696
|
this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19715
19697
|
.then(data => {
|
|
19716
19698
|
completeCurrentTreeWithTree(this.loadedTreeJs, data, this.theOptions);
|
|
19717
|
-
|
|
19699
|
+
if (displayChildren && hasNoRealChildren) {
|
|
19700
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
19701
|
+
const childURL = this.getContextualApiURL();
|
|
19702
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19703
|
+
.then(childData => {
|
|
19704
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
19705
|
+
this.scrollToNode(targetNodeId, false);
|
|
19706
|
+
});
|
|
19707
|
+
}
|
|
19708
|
+
else {
|
|
19709
|
+
this.scrollToNode(targetNodeId, displayChildren);
|
|
19710
|
+
}
|
|
19711
|
+
});
|
|
19712
|
+
}
|
|
19713
|
+
else if (hasNoRealChildren && displayChildren) {
|
|
19714
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
19715
|
+
const childURL = this.getContextualApiURL();
|
|
19716
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19717
|
+
.then(childData => {
|
|
19718
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
19719
|
+
this.scrollToNode(targetNodeId, false);
|
|
19718
19720
|
});
|
|
19719
19721
|
}
|
|
19720
19722
|
else {
|
|
@@ -963,16 +963,39 @@ export class HierarchizedPickerComponent {
|
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
965
|
async scrollToNodeWithId(targetNodeId, displayChildren = false, refreshPicker = false) {
|
|
966
|
+
var _a;
|
|
966
967
|
if (refreshPicker)
|
|
967
968
|
await this.refreshPicker();
|
|
968
969
|
const targetNode = this.loadedTreeJs.liElementsById[targetNodeId];
|
|
970
|
+
const children = ((_a = this.loadedTreeJs.nodesById[targetNodeId]) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
971
|
+
const hasNoRealChildren = children.length === 0 || (children.length === 1 && Object.keys(children[0]).length === 0);
|
|
969
972
|
if (refreshPicker || !targetNode) {
|
|
970
973
|
const contextualApiParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { Reach: [targetNodeId] }), null, true);
|
|
971
974
|
const contextualApiURL = this.getContextualApiURL(true, Object.assign(Object.assign({}, this.theOptions), { options: contextualApiParams }));
|
|
972
975
|
this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
973
976
|
.then(data => {
|
|
974
977
|
completeCurrentTreeWithTree(this.loadedTreeJs, data, this.theOptions);
|
|
975
|
-
|
|
978
|
+
if (displayChildren && hasNoRealChildren) {
|
|
979
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
980
|
+
const childURL = this.getContextualApiURL();
|
|
981
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
982
|
+
.then(childData => {
|
|
983
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
984
|
+
this.scrollToNode(targetNodeId, false);
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
else {
|
|
988
|
+
this.scrollToNode(targetNodeId, displayChildren);
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
else if (hasNoRealChildren && displayChildren) {
|
|
993
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
994
|
+
const childURL = this.getContextualApiURL();
|
|
995
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
996
|
+
.then(childData => {
|
|
997
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
998
|
+
this.scrollToNode(targetNodeId, false);
|
|
976
999
|
});
|
|
977
1000
|
}
|
|
978
1001
|
else {
|
|
@@ -483,7 +483,7 @@ Tree.parseTreeData = function (data) {
|
|
|
483
483
|
values.push(node.id);
|
|
484
484
|
if (node.disabled)
|
|
485
485
|
disables.push(node.id);
|
|
486
|
-
if (parent)
|
|
486
|
+
if (parent && Object.keys(node).length > 0)
|
|
487
487
|
node.parent = parent;
|
|
488
488
|
if (node.children && node.children.length) {
|
|
489
489
|
walkTree(node.children, node);
|
|
@@ -25,27 +25,6 @@ export function findNodeById(tree, nodeId) {
|
|
|
25
25
|
function normalizeStr(str) {
|
|
26
26
|
return str.replace(/\u00A0/g, " ");
|
|
27
27
|
}
|
|
28
|
-
// TODO Deprecated ?
|
|
29
|
-
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
30
|
-
// let toret: any[] = [];
|
|
31
|
-
// if (data && data.children) {
|
|
32
|
-
// data.children.forEach(value => {
|
|
33
|
-
// if (value && value.valueTranslated) {
|
|
34
|
-
// if (value.valueTranslated.toLowerCase().includes(searched.toLowerCase())) {
|
|
35
|
-
// toret.push({
|
|
36
|
-
// id: value.key,
|
|
37
|
-
// fullpath: value.fullpath,
|
|
38
|
-
// fullpathTranslated: value.fullpathTranslated,
|
|
39
|
-
// text: value.valueTranslated,
|
|
40
|
-
// deprecated: value.deprecated,
|
|
41
|
-
// });
|
|
42
|
-
// }
|
|
43
|
-
// toret = toret.concat(getNodesFromSearch(value, searched));
|
|
44
|
-
// }
|
|
45
|
-
// });
|
|
46
|
-
// }
|
|
47
|
-
// return toret;
|
|
48
|
-
// }
|
|
49
28
|
/**
|
|
50
29
|
* Fills the tree with nodes based on the provided object.
|
|
51
30
|
*/
|
|
@@ -624,7 +624,7 @@ Tree.parseTreeData = function (data) {
|
|
|
624
624
|
values.push(node.id);
|
|
625
625
|
if (node.disabled)
|
|
626
626
|
disables.push(node.id);
|
|
627
|
-
if (parent)
|
|
627
|
+
if (parent && Object.keys(node).length > 0)
|
|
628
628
|
node.parent = parent;
|
|
629
629
|
if (node.children && node.children.length) {
|
|
630
630
|
walkTree(node.children, node);
|
|
@@ -18439,27 +18439,6 @@ function findNodeById(tree, nodeId) {
|
|
|
18439
18439
|
function normalizeStr(str) {
|
|
18440
18440
|
return str.replace(/\u00A0/g, " ");
|
|
18441
18441
|
}
|
|
18442
|
-
// TODO Deprecated ?
|
|
18443
|
-
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
18444
|
-
// let toret: any[] = [];
|
|
18445
|
-
// if (data && data.children) {
|
|
18446
|
-
// data.children.forEach(value => {
|
|
18447
|
-
// if (value && value.valueTranslated) {
|
|
18448
|
-
// if (value.valueTranslated.toLowerCase().includes(searched.toLowerCase())) {
|
|
18449
|
-
// toret.push({
|
|
18450
|
-
// id: value.key,
|
|
18451
|
-
// fullpath: value.fullpath,
|
|
18452
|
-
// fullpathTranslated: value.fullpathTranslated,
|
|
18453
|
-
// text: value.valueTranslated,
|
|
18454
|
-
// deprecated: value.deprecated,
|
|
18455
|
-
// });
|
|
18456
|
-
// }
|
|
18457
|
-
// toret = toret.concat(getNodesFromSearch(value, searched));
|
|
18458
|
-
// }
|
|
18459
|
-
// });
|
|
18460
|
-
// }
|
|
18461
|
-
// return toret;
|
|
18462
|
-
// }
|
|
18463
18442
|
/**
|
|
18464
18443
|
* Fills the tree with nodes based on the provided object.
|
|
18465
18444
|
*/
|
|
@@ -19703,16 +19682,39 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19703
19682
|
}
|
|
19704
19683
|
}
|
|
19705
19684
|
async scrollToNodeWithId(targetNodeId, displayChildren = false, refreshPicker = false) {
|
|
19685
|
+
var _a;
|
|
19706
19686
|
if (refreshPicker)
|
|
19707
19687
|
await this.refreshPicker();
|
|
19708
19688
|
const targetNode = this.loadedTreeJs.liElementsById[targetNodeId];
|
|
19689
|
+
const children = ((_a = this.loadedTreeJs.nodesById[targetNodeId]) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
19690
|
+
const hasNoRealChildren = children.length === 0 || (children.length === 1 && Object.keys(children[0]).length === 0);
|
|
19709
19691
|
if (refreshPicker || !targetNode) {
|
|
19710
19692
|
const contextualApiParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { Reach: [targetNodeId] }), null, true);
|
|
19711
19693
|
const contextualApiURL = this.getContextualApiURL(true, Object.assign(Object.assign({}, this.theOptions), { options: contextualApiParams }));
|
|
19712
19694
|
this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19713
19695
|
.then(data => {
|
|
19714
19696
|
completeCurrentTreeWithTree(this.loadedTreeJs, data, this.theOptions);
|
|
19715
|
-
|
|
19697
|
+
if (displayChildren && hasNoRealChildren) {
|
|
19698
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
19699
|
+
const childURL = this.getContextualApiURL();
|
|
19700
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19701
|
+
.then(childData => {
|
|
19702
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
19703
|
+
this.scrollToNode(targetNodeId, false);
|
|
19704
|
+
});
|
|
19705
|
+
}
|
|
19706
|
+
else {
|
|
19707
|
+
this.scrollToNode(targetNodeId, displayChildren);
|
|
19708
|
+
}
|
|
19709
|
+
});
|
|
19710
|
+
}
|
|
19711
|
+
else if (hasNoRealChildren && displayChildren) {
|
|
19712
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
19713
|
+
const childURL = this.getContextualApiURL();
|
|
19714
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19715
|
+
.then(childData => {
|
|
19716
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
19717
|
+
this.scrollToNode(targetNodeId, false);
|
|
19716
19718
|
});
|
|
19717
19719
|
}
|
|
19718
19720
|
else {
|
|
@@ -623,7 +623,7 @@ Tree.parseTreeData = function (data) {
|
|
|
623
623
|
values.push(node.id);
|
|
624
624
|
if (node.disabled)
|
|
625
625
|
disables.push(node.id);
|
|
626
|
-
if (parent)
|
|
626
|
+
if (parent && Object.keys(node).length > 0)
|
|
627
627
|
node.parent = parent;
|
|
628
628
|
if (node.children && node.children.length) {
|
|
629
629
|
walkTree(node.children, node);
|
|
@@ -18438,27 +18438,6 @@ function findNodeById(tree, nodeId) {
|
|
|
18438
18438
|
function normalizeStr(str) {
|
|
18439
18439
|
return str.replace(/\u00A0/g, " ");
|
|
18440
18440
|
}
|
|
18441
|
-
// TODO Deprecated ?
|
|
18442
|
-
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
18443
|
-
// let toret: any[] = [];
|
|
18444
|
-
// if (data && data.children) {
|
|
18445
|
-
// data.children.forEach(value => {
|
|
18446
|
-
// if (value && value.valueTranslated) {
|
|
18447
|
-
// if (value.valueTranslated.toLowerCase().includes(searched.toLowerCase())) {
|
|
18448
|
-
// toret.push({
|
|
18449
|
-
// id: value.key,
|
|
18450
|
-
// fullpath: value.fullpath,
|
|
18451
|
-
// fullpathTranslated: value.fullpathTranslated,
|
|
18452
|
-
// text: value.valueTranslated,
|
|
18453
|
-
// deprecated: value.deprecated,
|
|
18454
|
-
// });
|
|
18455
|
-
// }
|
|
18456
|
-
// toret = toret.concat(getNodesFromSearch(value, searched));
|
|
18457
|
-
// }
|
|
18458
|
-
// });
|
|
18459
|
-
// }
|
|
18460
|
-
// return toret;
|
|
18461
|
-
// }
|
|
18462
18441
|
/**
|
|
18463
18442
|
* Fills the tree with nodes based on the provided object.
|
|
18464
18443
|
*/
|
|
@@ -19701,16 +19680,39 @@ const HierarchizedPickerComponent = class {
|
|
|
19701
19680
|
}
|
|
19702
19681
|
}
|
|
19703
19682
|
async scrollToNodeWithId(targetNodeId, displayChildren = false, refreshPicker = false) {
|
|
19683
|
+
var _a;
|
|
19704
19684
|
if (refreshPicker)
|
|
19705
19685
|
await this.refreshPicker();
|
|
19706
19686
|
const targetNode = this.loadedTreeJs.liElementsById[targetNodeId];
|
|
19687
|
+
const children = ((_a = this.loadedTreeJs.nodesById[targetNodeId]) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
19688
|
+
const hasNoRealChildren = children.length === 0 || (children.length === 1 && Object.keys(children[0]).length === 0);
|
|
19707
19689
|
if (refreshPicker || !targetNode) {
|
|
19708
19690
|
const contextualApiParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { Reach: [targetNodeId] }), null, true);
|
|
19709
19691
|
const contextualApiURL = this.getContextualApiURL(true, Object.assign(Object.assign({}, this.theOptions), { options: contextualApiParams }));
|
|
19710
19692
|
this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19711
19693
|
.then(data => {
|
|
19712
19694
|
completeCurrentTreeWithTree(this.loadedTreeJs, data, this.theOptions);
|
|
19713
|
-
|
|
19695
|
+
if (displayChildren && hasNoRealChildren) {
|
|
19696
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
19697
|
+
const childURL = this.getContextualApiURL();
|
|
19698
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19699
|
+
.then(childData => {
|
|
19700
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
19701
|
+
this.scrollToNode(targetNodeId, false);
|
|
19702
|
+
});
|
|
19703
|
+
}
|
|
19704
|
+
else {
|
|
19705
|
+
this.scrollToNode(targetNodeId, displayChildren);
|
|
19706
|
+
}
|
|
19707
|
+
});
|
|
19708
|
+
}
|
|
19709
|
+
else if (hasNoRealChildren && displayChildren) {
|
|
19710
|
+
const childParams = this.getContextualApiParams(Object.assign(Object.assign({}, this.theOptions.options), { startNode: targetNodeId }));
|
|
19711
|
+
const childURL = this.getContextualApiURL();
|
|
19712
|
+
this.rawDataManager.getFromClassification(childURL, childParams, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19713
|
+
.then(childData => {
|
|
19714
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, childData, this.theOptions);
|
|
19715
|
+
this.scrollToNode(targetNodeId, false);
|
|
19714
19716
|
});
|
|
19715
19717
|
}
|
|
19716
19718
|
else {
|