reneco-hierarchized-picker 0.5.0 → 0.5.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/cjs/reneco-hierarchized-picker_2.cjs.entry.js +27 -24
- package/dist/collection/components/hierarchized-picker/hierarchized-picker.js +16 -18
- package/dist/collection/core/raw-data-manager.js +1 -1
- package/dist/collection/features/keyboard-navigation/keyboard-navigation.js +0 -1
- package/dist/collection/features/tree/tree-utils.js +6 -3
- package/dist/collection/utils/helpers.js +4 -1
- package/dist/custom-elements/index.js +27 -24
- package/dist/esm/reneco-hierarchized-picker_2.entry.js +27 -24
- package/dist/esm-es5/reneco-hierarchized-picker_2.entry.js +1 -1
- package/dist/reneco-hierarchized-picker/{p-9027f23a.system.entry.js → p-46ea1347.system.entry.js} +1 -1
- package/dist/reneco-hierarchized-picker/p-73168a50.system.js +1 -1
- package/dist/reneco-hierarchized-picker/{p-0e305bec.entry.js → p-c6448e95.entry.js} +1 -1
- package/dist/reneco-hierarchized-picker/reneco-hierarchized-picker.esm.js +1 -1
- package/package.json +1 -1
|
@@ -18043,7 +18043,10 @@ function replacer(key, value) {
|
|
|
18043
18043
|
}
|
|
18044
18044
|
function searchValue(obj, strict, searched) {
|
|
18045
18045
|
let toret = false;
|
|
18046
|
-
|
|
18046
|
+
function normalize(s) {
|
|
18047
|
+
return s.replace(/\u00A0/g, " ");
|
|
18048
|
+
}
|
|
18049
|
+
if (normalize(obj.text).toLowerCase().indexOf(normalize(searched).toLowerCase()) > -1) {
|
|
18047
18050
|
toret = true;
|
|
18048
18051
|
}
|
|
18049
18052
|
else if (!strict && obj.children.length > 0 && Object.keys(obj.children[0]).length != 0) {
|
|
@@ -18331,7 +18334,7 @@ class RawDataManager {
|
|
|
18331
18334
|
toAdd[childrenKey] = this.reorderItems(source[childrenKey], toAdd[childrenKey], idKey);
|
|
18332
18335
|
source[childrenKey] = ((_b = source[childrenKey]) === null || _b === void 0 ? void 0 : _b.length)
|
|
18333
18336
|
? source[childrenKey].map((child, index) => {
|
|
18334
|
-
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[
|
|
18337
|
+
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[0], idKey, childrenKey);
|
|
18335
18338
|
})
|
|
18336
18339
|
: toAdd[childrenKey];
|
|
18337
18340
|
return source;
|
|
@@ -18435,6 +18438,9 @@ function getPropertyFromNode(node, property, logerror = true) {
|
|
|
18435
18438
|
function findNodeById(tree, nodeId) {
|
|
18436
18439
|
return tree.nodesById[nodeId] || null;
|
|
18437
18440
|
}
|
|
18441
|
+
function normalizeStr(str) {
|
|
18442
|
+
return str.replace(/\u00A0/g, " ");
|
|
18443
|
+
}
|
|
18438
18444
|
// TODO Deprecated ?
|
|
18439
18445
|
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
18440
18446
|
// let toret: any[] = [];
|
|
@@ -18491,9 +18497,9 @@ function fillTreeWithObject(tree, myObject, searched, options) {
|
|
|
18491
18497
|
const objToPush = {
|
|
18492
18498
|
id: keyPropFromNode,
|
|
18493
18499
|
nodeId: keyPropFromNode,
|
|
18494
|
-
text: valueTranslatedPropFromNode,
|
|
18495
|
-
fullpath: fullpathPropFromNode,
|
|
18496
|
-
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
18500
|
+
text: normalizeStr(valueTranslatedPropFromNode),
|
|
18501
|
+
fullpath: normalizeStr(fullpathPropFromNode),
|
|
18502
|
+
fullpathTranslated: normalizeStr(fullpathTranslatedPropFromNode),
|
|
18497
18503
|
children: getPropertyFromNode(value, 'hasChildren', false) && childrenPropFromNode && childrenPropFromNode.length === 0 ? [{}] : [],
|
|
18498
18504
|
deprecated,
|
|
18499
18505
|
isDesaturated: false,
|
|
@@ -18644,7 +18650,6 @@ function setupKeyboardNavigation(component, optionsManager, navigateInTree) {
|
|
|
18644
18650
|
if (optionsManager.getOptions().mode != "tree" && !optionsManager.getOptions().multiple) {
|
|
18645
18651
|
setTimeout(() => {
|
|
18646
18652
|
component.showTree('hide');
|
|
18647
|
-
// TODO put back? >> focusMainInput(component);
|
|
18648
18653
|
}, 100);
|
|
18649
18654
|
}
|
|
18650
18655
|
}
|
|
@@ -19454,12 +19459,10 @@ const HierarchizedPickerComponent = class {
|
|
|
19454
19459
|
}
|
|
19455
19460
|
}
|
|
19456
19461
|
loadSearchDataInCurrentTree(searchID, searched) {
|
|
19457
|
-
|
|
19458
|
-
if (this.searchToDisplay > -1) {
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
19462
|
-
});
|
|
19462
|
+
const displayResults = () => {
|
|
19463
|
+
if (this.searchToDisplay > -1) {
|
|
19464
|
+
if (!searched)
|
|
19465
|
+
this.setSearchResults([]);
|
|
19463
19466
|
this.triggerTreeDisplay(this.rawDataManager.getData(), searched);
|
|
19464
19467
|
displayAutocompleteWithResults(this.rawDataManager.getData(), searched, this.optionsManager, this.editValue.bind(this), this.showTree.bind(this));
|
|
19465
19468
|
// Deploys all nodes
|
|
@@ -19475,15 +19478,21 @@ const HierarchizedPickerComponent = class {
|
|
|
19475
19478
|
});
|
|
19476
19479
|
}
|
|
19477
19480
|
};
|
|
19481
|
+
const completeLocalTree = (newtree) => {
|
|
19482
|
+
if (this.searchToDisplay > -1) { // TODO > Not working anymore after refact, prevents issues in displaying results when running multiple researchs at the same time && searchID == this.searchToDisplay) {
|
|
19483
|
+
this.rawDataManager.mergeData(newtree, this.theOptions.origin == 'classification' ? "ID" : "key");
|
|
19484
|
+
newtree.children.forEach((value, index) => {
|
|
19485
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
19486
|
+
});
|
|
19487
|
+
displayResults();
|
|
19488
|
+
}
|
|
19489
|
+
};
|
|
19478
19490
|
if (this.theOptions.source == 'webservice') {
|
|
19479
19491
|
if (this.theOptions.origin == 'classification') {
|
|
19480
19492
|
// WS Call
|
|
19481
19493
|
this.rawDataManager.getFromClassification(this.getApiSearchURL(), Object.assign({}, this.getContextualApiParams(null, searched)), document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19482
19494
|
.then((data) => {
|
|
19483
|
-
|
|
19484
|
-
if (!searched) {
|
|
19485
|
-
this.setSearchResults([]);
|
|
19486
|
-
}
|
|
19495
|
+
completeLocalTree(data);
|
|
19487
19496
|
})
|
|
19488
19497
|
.catch(err => {
|
|
19489
19498
|
this.errorToLog = err;
|
|
@@ -19499,10 +19508,7 @@ const HierarchizedPickerComponent = class {
|
|
|
19499
19508
|
deprecated: false,
|
|
19500
19509
|
}, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19501
19510
|
.then((data) => {
|
|
19502
|
-
|
|
19503
|
-
if (!searched) {
|
|
19504
|
-
this.setSearchResults([]);
|
|
19505
|
-
}
|
|
19511
|
+
completeLocalTree(data);
|
|
19506
19512
|
})
|
|
19507
19513
|
.catch(error => {
|
|
19508
19514
|
this.errorToLog = error;
|
|
@@ -19517,10 +19523,7 @@ const HierarchizedPickerComponent = class {
|
|
|
19517
19523
|
}
|
|
19518
19524
|
else {
|
|
19519
19525
|
if (this.optionsManager.getOptions().source == 'data') {
|
|
19520
|
-
displayResults(
|
|
19521
|
-
if (!searched) {
|
|
19522
|
-
this.setSearchResults([]);
|
|
19523
|
-
}
|
|
19526
|
+
displayResults();
|
|
19524
19527
|
}
|
|
19525
19528
|
else {
|
|
19526
19529
|
console.error("Unhandled picker settings for search scenario !!");
|
|
@@ -722,12 +722,10 @@ export class HierarchizedPickerComponent {
|
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
loadSearchDataInCurrentTree(searchID, searched) {
|
|
725
|
-
|
|
726
|
-
if (this.searchToDisplay > -1) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
730
|
-
});
|
|
725
|
+
const displayResults = () => {
|
|
726
|
+
if (this.searchToDisplay > -1) {
|
|
727
|
+
if (!searched)
|
|
728
|
+
this.setSearchResults([]);
|
|
731
729
|
this.triggerTreeDisplay(this.rawDataManager.getData(), searched);
|
|
732
730
|
displayAutocompleteWithResults(this.rawDataManager.getData(), searched, this.optionsManager, this.editValue.bind(this), this.showTree.bind(this));
|
|
733
731
|
// Deploys all nodes
|
|
@@ -743,15 +741,21 @@ export class HierarchizedPickerComponent {
|
|
|
743
741
|
});
|
|
744
742
|
}
|
|
745
743
|
};
|
|
744
|
+
const completeLocalTree = (newtree) => {
|
|
745
|
+
if (this.searchToDisplay > -1) { // TODO > Not working anymore after refact, prevents issues in displaying results when running multiple researchs at the same time && searchID == this.searchToDisplay) {
|
|
746
|
+
this.rawDataManager.mergeData(newtree, this.theOptions.origin == 'classification' ? "ID" : "key");
|
|
747
|
+
newtree.children.forEach((value, index) => {
|
|
748
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
749
|
+
});
|
|
750
|
+
displayResults();
|
|
751
|
+
}
|
|
752
|
+
};
|
|
746
753
|
if (this.theOptions.source == 'webservice') {
|
|
747
754
|
if (this.theOptions.origin == 'classification') {
|
|
748
755
|
// WS Call
|
|
749
756
|
this.rawDataManager.getFromClassification(this.getApiSearchURL(), Object.assign({}, this.getContextualApiParams(null, searched)), document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
750
757
|
.then((data) => {
|
|
751
|
-
|
|
752
|
-
if (!searched) {
|
|
753
|
-
this.setSearchResults([]);
|
|
754
|
-
}
|
|
758
|
+
completeLocalTree(data);
|
|
755
759
|
})
|
|
756
760
|
.catch(err => {
|
|
757
761
|
this.errorToLog = err;
|
|
@@ -767,10 +771,7 @@ export class HierarchizedPickerComponent {
|
|
|
767
771
|
deprecated: false,
|
|
768
772
|
}, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
769
773
|
.then((data) => {
|
|
770
|
-
|
|
771
|
-
if (!searched) {
|
|
772
|
-
this.setSearchResults([]);
|
|
773
|
-
}
|
|
774
|
+
completeLocalTree(data);
|
|
774
775
|
})
|
|
775
776
|
.catch(error => {
|
|
776
777
|
this.errorToLog = error;
|
|
@@ -785,10 +786,7 @@ export class HierarchizedPickerComponent {
|
|
|
785
786
|
}
|
|
786
787
|
else {
|
|
787
788
|
if (this.optionsManager.getOptions().source == 'data') {
|
|
788
|
-
displayResults(
|
|
789
|
-
if (!searched) {
|
|
790
|
-
this.setSearchResults([]);
|
|
791
|
-
}
|
|
789
|
+
displayResults();
|
|
792
790
|
}
|
|
793
791
|
else {
|
|
794
792
|
console.error("Unhandled picker settings for search scenario !!");
|
|
@@ -182,7 +182,7 @@ export class RawDataManager {
|
|
|
182
182
|
toAdd[childrenKey] = this.reorderItems(source[childrenKey], toAdd[childrenKey], idKey);
|
|
183
183
|
source[childrenKey] = ((_b = source[childrenKey]) === null || _b === void 0 ? void 0 : _b.length)
|
|
184
184
|
? source[childrenKey].map((child, index) => {
|
|
185
|
-
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[
|
|
185
|
+
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[0], idKey, childrenKey);
|
|
186
186
|
})
|
|
187
187
|
: toAdd[childrenKey];
|
|
188
188
|
return source;
|
|
@@ -50,7 +50,6 @@ export function setupKeyboardNavigation(component, optionsManager, navigateInTre
|
|
|
50
50
|
if (optionsManager.getOptions().mode != "tree" && !optionsManager.getOptions().multiple) {
|
|
51
51
|
setTimeout(() => {
|
|
52
52
|
component.showTree('hide');
|
|
53
|
-
// TODO put back? >> focusMainInput(component);
|
|
54
53
|
}, 100);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -23,6 +23,9 @@ export function getPropertyFromNode(node, property, logerror = true) {
|
|
|
23
23
|
export function findNodeById(tree, nodeId) {
|
|
24
24
|
return tree.nodesById[nodeId] || null;
|
|
25
25
|
}
|
|
26
|
+
function normalizeStr(str) {
|
|
27
|
+
return str.replace(/\u00A0/g, " ");
|
|
28
|
+
}
|
|
26
29
|
// TODO Deprecated ?
|
|
27
30
|
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
28
31
|
// let toret: any[] = [];
|
|
@@ -79,9 +82,9 @@ export function fillTreeWithObject(tree, myObject, searched, options) {
|
|
|
79
82
|
const objToPush = {
|
|
80
83
|
id: keyPropFromNode,
|
|
81
84
|
nodeId: keyPropFromNode,
|
|
82
|
-
text: valueTranslatedPropFromNode,
|
|
83
|
-
fullpath: fullpathPropFromNode,
|
|
84
|
-
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
85
|
+
text: normalizeStr(valueTranslatedPropFromNode),
|
|
86
|
+
fullpath: normalizeStr(fullpathPropFromNode),
|
|
87
|
+
fullpathTranslated: normalizeStr(fullpathTranslatedPropFromNode),
|
|
85
88
|
children: getPropertyFromNode(value, 'hasChildren', false) && childrenPropFromNode && childrenPropFromNode.length === 0 ? [{}] : [],
|
|
86
89
|
deprecated,
|
|
87
90
|
isDesaturated: false,
|
|
@@ -17,7 +17,10 @@ export function replacer(key, value) {
|
|
|
17
17
|
}
|
|
18
18
|
export function searchValue(obj, strict, searched) {
|
|
19
19
|
let toret = false;
|
|
20
|
-
|
|
20
|
+
function normalize(s) {
|
|
21
|
+
return s.replace(/\u00A0/g, " ");
|
|
22
|
+
}
|
|
23
|
+
if (normalize(obj.text).toLowerCase().indexOf(normalize(searched).toLowerCase()) > -1) {
|
|
21
24
|
toret = true;
|
|
22
25
|
}
|
|
23
26
|
else if (!strict && obj.children.length > 0 && Object.keys(obj.children[0]).length != 0) {
|
|
@@ -18040,7 +18040,10 @@ function replacer(key, value) {
|
|
|
18040
18040
|
}
|
|
18041
18041
|
function searchValue(obj, strict, searched) {
|
|
18042
18042
|
let toret = false;
|
|
18043
|
-
|
|
18043
|
+
function normalize(s) {
|
|
18044
|
+
return s.replace(/\u00A0/g, " ");
|
|
18045
|
+
}
|
|
18046
|
+
if (normalize(obj.text).toLowerCase().indexOf(normalize(searched).toLowerCase()) > -1) {
|
|
18044
18047
|
toret = true;
|
|
18045
18048
|
}
|
|
18046
18049
|
else if (!strict && obj.children.length > 0 && Object.keys(obj.children[0]).length != 0) {
|
|
@@ -18328,7 +18331,7 @@ class RawDataManager {
|
|
|
18328
18331
|
toAdd[childrenKey] = this.reorderItems(source[childrenKey], toAdd[childrenKey], idKey);
|
|
18329
18332
|
source[childrenKey] = ((_b = source[childrenKey]) === null || _b === void 0 ? void 0 : _b.length)
|
|
18330
18333
|
? source[childrenKey].map((child, index) => {
|
|
18331
|
-
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[
|
|
18334
|
+
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[0], idKey, childrenKey);
|
|
18332
18335
|
})
|
|
18333
18336
|
: toAdd[childrenKey];
|
|
18334
18337
|
return source;
|
|
@@ -18432,6 +18435,9 @@ function getPropertyFromNode(node, property, logerror = true) {
|
|
|
18432
18435
|
function findNodeById(tree, nodeId) {
|
|
18433
18436
|
return tree.nodesById[nodeId] || null;
|
|
18434
18437
|
}
|
|
18438
|
+
function normalizeStr(str) {
|
|
18439
|
+
return str.replace(/\u00A0/g, " ");
|
|
18440
|
+
}
|
|
18435
18441
|
// TODO Deprecated ?
|
|
18436
18442
|
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
18437
18443
|
// let toret: any[] = [];
|
|
@@ -18488,9 +18494,9 @@ function fillTreeWithObject(tree, myObject, searched, options) {
|
|
|
18488
18494
|
const objToPush = {
|
|
18489
18495
|
id: keyPropFromNode,
|
|
18490
18496
|
nodeId: keyPropFromNode,
|
|
18491
|
-
text: valueTranslatedPropFromNode,
|
|
18492
|
-
fullpath: fullpathPropFromNode,
|
|
18493
|
-
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
18497
|
+
text: normalizeStr(valueTranslatedPropFromNode),
|
|
18498
|
+
fullpath: normalizeStr(fullpathPropFromNode),
|
|
18499
|
+
fullpathTranslated: normalizeStr(fullpathTranslatedPropFromNode),
|
|
18494
18500
|
children: getPropertyFromNode(value, 'hasChildren', false) && childrenPropFromNode && childrenPropFromNode.length === 0 ? [{}] : [],
|
|
18495
18501
|
deprecated,
|
|
18496
18502
|
isDesaturated: false,
|
|
@@ -18641,7 +18647,6 @@ function setupKeyboardNavigation(component, optionsManager, navigateInTree) {
|
|
|
18641
18647
|
if (optionsManager.getOptions().mode != "tree" && !optionsManager.getOptions().multiple) {
|
|
18642
18648
|
setTimeout(() => {
|
|
18643
18649
|
component.showTree('hide');
|
|
18644
|
-
// TODO put back? >> focusMainInput(component);
|
|
18645
18650
|
}, 100);
|
|
18646
18651
|
}
|
|
18647
18652
|
}
|
|
@@ -19452,12 +19457,10 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19452
19457
|
}
|
|
19453
19458
|
}
|
|
19454
19459
|
loadSearchDataInCurrentTree(searchID, searched) {
|
|
19455
|
-
|
|
19456
|
-
if (this.searchToDisplay > -1) {
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
19460
|
-
});
|
|
19460
|
+
const displayResults = () => {
|
|
19461
|
+
if (this.searchToDisplay > -1) {
|
|
19462
|
+
if (!searched)
|
|
19463
|
+
this.setSearchResults([]);
|
|
19461
19464
|
this.triggerTreeDisplay(this.rawDataManager.getData(), searched);
|
|
19462
19465
|
displayAutocompleteWithResults(this.rawDataManager.getData(), searched, this.optionsManager, this.editValue.bind(this), this.showTree.bind(this));
|
|
19463
19466
|
// Deploys all nodes
|
|
@@ -19473,15 +19476,21 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19473
19476
|
});
|
|
19474
19477
|
}
|
|
19475
19478
|
};
|
|
19479
|
+
const completeLocalTree = (newtree) => {
|
|
19480
|
+
if (this.searchToDisplay > -1) { // TODO > Not working anymore after refact, prevents issues in displaying results when running multiple researchs at the same time && searchID == this.searchToDisplay) {
|
|
19481
|
+
this.rawDataManager.mergeData(newtree, this.theOptions.origin == 'classification' ? "ID" : "key");
|
|
19482
|
+
newtree.children.forEach((value, index) => {
|
|
19483
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
19484
|
+
});
|
|
19485
|
+
displayResults();
|
|
19486
|
+
}
|
|
19487
|
+
};
|
|
19476
19488
|
if (this.theOptions.source == 'webservice') {
|
|
19477
19489
|
if (this.theOptions.origin == 'classification') {
|
|
19478
19490
|
// WS Call
|
|
19479
19491
|
this.rawDataManager.getFromClassification(this.getApiSearchURL(), Object.assign({}, this.getContextualApiParams(null, searched)), document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19480
19492
|
.then((data) => {
|
|
19481
|
-
|
|
19482
|
-
if (!searched) {
|
|
19483
|
-
this.setSearchResults([]);
|
|
19484
|
-
}
|
|
19493
|
+
completeLocalTree(data);
|
|
19485
19494
|
})
|
|
19486
19495
|
.catch(err => {
|
|
19487
19496
|
this.errorToLog = err;
|
|
@@ -19497,10 +19506,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19497
19506
|
deprecated: false,
|
|
19498
19507
|
}, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19499
19508
|
.then((data) => {
|
|
19500
|
-
|
|
19501
|
-
if (!searched) {
|
|
19502
|
-
this.setSearchResults([]);
|
|
19503
|
-
}
|
|
19509
|
+
completeLocalTree(data);
|
|
19504
19510
|
})
|
|
19505
19511
|
.catch(error => {
|
|
19506
19512
|
this.errorToLog = error;
|
|
@@ -19515,10 +19521,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19515
19521
|
}
|
|
19516
19522
|
else {
|
|
19517
19523
|
if (this.optionsManager.getOptions().source == 'data') {
|
|
19518
|
-
displayResults(
|
|
19519
|
-
if (!searched) {
|
|
19520
|
-
this.setSearchResults([]);
|
|
19521
|
-
}
|
|
19524
|
+
displayResults();
|
|
19522
19525
|
}
|
|
19523
19526
|
else {
|
|
19524
19527
|
console.error("Unhandled picker settings for search scenario !!");
|
|
@@ -18039,7 +18039,10 @@ function replacer(key, value) {
|
|
|
18039
18039
|
}
|
|
18040
18040
|
function searchValue(obj, strict, searched) {
|
|
18041
18041
|
let toret = false;
|
|
18042
|
-
|
|
18042
|
+
function normalize(s) {
|
|
18043
|
+
return s.replace(/\u00A0/g, " ");
|
|
18044
|
+
}
|
|
18045
|
+
if (normalize(obj.text).toLowerCase().indexOf(normalize(searched).toLowerCase()) > -1) {
|
|
18043
18046
|
toret = true;
|
|
18044
18047
|
}
|
|
18045
18048
|
else if (!strict && obj.children.length > 0 && Object.keys(obj.children[0]).length != 0) {
|
|
@@ -18327,7 +18330,7 @@ class RawDataManager {
|
|
|
18327
18330
|
toAdd[childrenKey] = this.reorderItems(source[childrenKey], toAdd[childrenKey], idKey);
|
|
18328
18331
|
source[childrenKey] = ((_b = source[childrenKey]) === null || _b === void 0 ? void 0 : _b.length)
|
|
18329
18332
|
? source[childrenKey].map((child, index) => {
|
|
18330
|
-
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[
|
|
18333
|
+
return this.genericMerge(child, toAdd[childrenKey].filter(item => item.key == child.key)[0], idKey, childrenKey);
|
|
18331
18334
|
})
|
|
18332
18335
|
: toAdd[childrenKey];
|
|
18333
18336
|
return source;
|
|
@@ -18431,6 +18434,9 @@ function getPropertyFromNode(node, property, logerror = true) {
|
|
|
18431
18434
|
function findNodeById(tree, nodeId) {
|
|
18432
18435
|
return tree.nodesById[nodeId] || null;
|
|
18433
18436
|
}
|
|
18437
|
+
function normalizeStr(str) {
|
|
18438
|
+
return str.replace(/\u00A0/g, " ");
|
|
18439
|
+
}
|
|
18434
18440
|
// TODO Deprecated ?
|
|
18435
18441
|
// export function getNodesFromSearch(data: any, searched: string): any[] {
|
|
18436
18442
|
// let toret: any[] = [];
|
|
@@ -18487,9 +18493,9 @@ function fillTreeWithObject(tree, myObject, searched, options) {
|
|
|
18487
18493
|
const objToPush = {
|
|
18488
18494
|
id: keyPropFromNode,
|
|
18489
18495
|
nodeId: keyPropFromNode,
|
|
18490
|
-
text: valueTranslatedPropFromNode,
|
|
18491
|
-
fullpath: fullpathPropFromNode,
|
|
18492
|
-
fullpathTranslated: fullpathTranslatedPropFromNode,
|
|
18496
|
+
text: normalizeStr(valueTranslatedPropFromNode),
|
|
18497
|
+
fullpath: normalizeStr(fullpathPropFromNode),
|
|
18498
|
+
fullpathTranslated: normalizeStr(fullpathTranslatedPropFromNode),
|
|
18493
18499
|
children: getPropertyFromNode(value, 'hasChildren', false) && childrenPropFromNode && childrenPropFromNode.length === 0 ? [{}] : [],
|
|
18494
18500
|
deprecated,
|
|
18495
18501
|
isDesaturated: false,
|
|
@@ -18640,7 +18646,6 @@ function setupKeyboardNavigation(component, optionsManager, navigateInTree) {
|
|
|
18640
18646
|
if (optionsManager.getOptions().mode != "tree" && !optionsManager.getOptions().multiple) {
|
|
18641
18647
|
setTimeout(() => {
|
|
18642
18648
|
component.showTree('hide');
|
|
18643
|
-
// TODO put back? >> focusMainInput(component);
|
|
18644
18649
|
}, 100);
|
|
18645
18650
|
}
|
|
18646
18651
|
}
|
|
@@ -19450,12 +19455,10 @@ const HierarchizedPickerComponent = class {
|
|
|
19450
19455
|
}
|
|
19451
19456
|
}
|
|
19452
19457
|
loadSearchDataInCurrentTree(searchID, searched) {
|
|
19453
|
-
|
|
19454
|
-
if (this.searchToDisplay > -1) {
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
19458
|
-
});
|
|
19458
|
+
const displayResults = () => {
|
|
19459
|
+
if (this.searchToDisplay > -1) {
|
|
19460
|
+
if (!searched)
|
|
19461
|
+
this.setSearchResults([]);
|
|
19459
19462
|
this.triggerTreeDisplay(this.rawDataManager.getData(), searched);
|
|
19460
19463
|
displayAutocompleteWithResults(this.rawDataManager.getData(), searched, this.optionsManager, this.editValue.bind(this), this.showTree.bind(this));
|
|
19461
19464
|
// Deploys all nodes
|
|
@@ -19471,15 +19474,21 @@ const HierarchizedPickerComponent = class {
|
|
|
19471
19474
|
});
|
|
19472
19475
|
}
|
|
19473
19476
|
};
|
|
19477
|
+
const completeLocalTree = (newtree) => {
|
|
19478
|
+
if (this.searchToDisplay > -1) { // TODO > Not working anymore after refact, prevents issues in displaying results when running multiple researchs at the same time && searchID == this.searchToDisplay) {
|
|
19479
|
+
this.rawDataManager.mergeData(newtree, this.theOptions.origin == 'classification' ? "ID" : "key");
|
|
19480
|
+
newtree.children.forEach((value, index) => {
|
|
19481
|
+
completeCurrentTreeWithTree(this.loadedTreeJs, value, this.optionsManager.getOptions());
|
|
19482
|
+
});
|
|
19483
|
+
displayResults();
|
|
19484
|
+
}
|
|
19485
|
+
};
|
|
19474
19486
|
if (this.theOptions.source == 'webservice') {
|
|
19475
19487
|
if (this.theOptions.origin == 'classification') {
|
|
19476
19488
|
// WS Call
|
|
19477
19489
|
this.rawDataManager.getFromClassification(this.getApiSearchURL(), Object.assign({}, this.getContextualApiParams(null, searched)), document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19478
19490
|
.then((data) => {
|
|
19479
|
-
|
|
19480
|
-
if (!searched) {
|
|
19481
|
-
this.setSearchResults([]);
|
|
19482
|
-
}
|
|
19491
|
+
completeLocalTree(data);
|
|
19483
19492
|
})
|
|
19484
19493
|
.catch(err => {
|
|
19485
19494
|
this.errorToLog = err;
|
|
@@ -19495,10 +19504,7 @@ const HierarchizedPickerComponent = class {
|
|
|
19495
19504
|
deprecated: false,
|
|
19496
19505
|
}, document.querySelector("#hierarchized-picker-" + this.componentID + " .loader"))
|
|
19497
19506
|
.then((data) => {
|
|
19498
|
-
|
|
19499
|
-
if (!searched) {
|
|
19500
|
-
this.setSearchResults([]);
|
|
19501
|
-
}
|
|
19507
|
+
completeLocalTree(data);
|
|
19502
19508
|
})
|
|
19503
19509
|
.catch(error => {
|
|
19504
19510
|
this.errorToLog = error;
|
|
@@ -19513,10 +19519,7 @@ const HierarchizedPickerComponent = class {
|
|
|
19513
19519
|
}
|
|
19514
19520
|
else {
|
|
19515
19521
|
if (this.optionsManager.getOptions().source == 'data') {
|
|
19516
|
-
displayResults(
|
|
19517
|
-
if (!searched) {
|
|
19518
|
-
this.setSearchResults([]);
|
|
19519
|
-
}
|
|
19522
|
+
displayResults();
|
|
19520
19523
|
}
|
|
19521
19524
|
else {
|
|
19522
19525
|
console.error("Unhandled picker settings for search scenario !!");
|