reneco-hierarchized-picker 0.4.3-beta.1 → 0.4.3-beta.3

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.
@@ -18885,6 +18885,33 @@ const HierarchizedPickerComponent = class {
18885
18885
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
18886
18886
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
18887
18887
  this.mylog = console.log; // Custom log function for debug purposes
18888
+ this.getShortenedFullpath = (realFullpath) => {
18889
+ var _a, _b, _c, _d;
18890
+ let toret = realFullpath;
18891
+ try {
18892
+ const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
18893
+ const property_value = this.optionsManager.getOptions().options[property_nodeid];
18894
+ if (property_value in ["0", 0])
18895
+ return toret;
18896
+ if (isNumeric(property_value)) {
18897
+ if (this.optionsManager.getOptions().origin == 'classification') {
18898
+ const { Translations, Properties } = this.rawDataManager.getData();
18899
+ const currentLanguage = this.optionsManager.getOptions().language;
18900
+ toret = ((_b = (_a = Translations[currentLanguage]) === null || _a === void 0 ? void 0 : _a.translated_name) !== null && _b !== void 0 ? _b : Properties === null || Properties === void 0 ? void 0 : Properties.System_Name) + realFullpath.replace(((_d = (_c = Translations[currentLanguage]) === null || _c === void 0 ? void 0 : _c.translated_fullpath) !== null && _d !== void 0 ? _d : Properties === null || Properties === void 0 ? void 0 : Properties.System_Fullpath), "");
18901
+ }
18902
+ else {
18903
+ const { fullpath, fullpathTranslated, title, valueTranslated } = this.rawDataManager.getData();
18904
+ toret = (valueTranslated !== null && valueTranslated !== void 0 ? valueTranslated : title) + realFullpath.replace((fullpathTranslated !== null && fullpathTranslated !== void 0 ? fullpathTranslated : fullpath), "");
18905
+ }
18906
+ }
18907
+ else
18908
+ this.errorToLog = "Error in getFullpath : startnode is not number";
18909
+ }
18910
+ catch (error) {
18911
+ this.errorToLog = "Error in getFullpath " + error.toString();
18912
+ }
18913
+ return toret;
18914
+ };
18888
18915
  this.options = undefined;
18889
18916
  this.valueChangeCallback = undefined;
18890
18917
  this.disabled = undefined;
@@ -19335,9 +19362,11 @@ const HierarchizedPickerComponent = class {
19335
19362
  this.ignoreOptionsChanges = false;
19336
19363
  },
19337
19364
  });
19338
- Object.values(myTree.liElementsById).forEach((el) => {
19339
- el.classList.remove('treejs-node__searchmatch');
19340
- });
19365
+ if (this.searchResultData.length == 0) {
19366
+ Object.values(myTree.liElementsById).forEach((el) => {
19367
+ el.classList.remove('treejs-node__searchmatch');
19368
+ });
19369
+ }
19341
19370
  this.loadedTreeJs = myTree;
19342
19371
  this.collapseAllNodes();
19343
19372
  // TODO Make something that makes sense, this is a temporary quick fix :
@@ -19520,8 +19549,8 @@ const HierarchizedPickerComponent = class {
19520
19549
  if (!value)
19521
19550
  value = this.value;
19522
19551
  this.displayedValue = value.map(item => {
19523
- var _a;
19524
- return (_a = (this.optionsManager.getOptions().isFullpath ? item.fullpathTranslated : item.shortpathTranslated)) !== null && _a !== void 0 ? _a : `Node ${item.nodeid}`;
19552
+ var _a, _b;
19553
+ return (_b = (this.optionsManager.getOptions().isFullpath ? this.getShortenedFullpath((_a = item.fullpathTranslated) !== null && _a !== void 0 ? _a : item.fullpath) : item.shortpathTranslated)) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`;
19525
19554
  }).join(';');
19526
19555
  }
19527
19556
  // Search a value in the tree and triggers a search when necessary
@@ -19708,7 +19737,7 @@ const HierarchizedPickerComponent = class {
19708
19737
  return "No selection";
19709
19738
  }
19710
19739
  return this.value
19711
- .map(item => { var _a, _b, _c; return (_c = (_b = (_a = item.fullpath) !== null && _a !== void 0 ? _a : item.fullpathTranslated) !== null && _b !== void 0 ? _b : item.shortpathTranslated) !== null && _c !== void 0 ? _c : `Node ${item.nodeid}`; })
19740
+ .map(item => { var _a, _b; return (_b = (_a = this.getShortenedFullpath(item.fullpathTranslated)) !== null && _a !== void 0 ? _a : item.fullpath) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`; })
19712
19741
  .join('; ');
19713
19742
  }
19714
19743
  render() {
@@ -195,6 +195,33 @@ export class HierarchizedPickerComponent {
195
195
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
196
196
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
197
197
  this.mylog = console.log; // Custom log function for debug purposes
198
+ this.getShortenedFullpath = (realFullpath) => {
199
+ var _a, _b, _c, _d;
200
+ let toret = realFullpath;
201
+ try {
202
+ const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
203
+ const property_value = this.optionsManager.getOptions().options[property_nodeid];
204
+ if (property_value in ["0", 0])
205
+ return toret;
206
+ if (isNumeric(property_value)) {
207
+ if (this.optionsManager.getOptions().origin == 'classification') {
208
+ const { Translations, Properties } = this.rawDataManager.getData();
209
+ const currentLanguage = this.optionsManager.getOptions().language;
210
+ toret = ((_b = (_a = Translations[currentLanguage]) === null || _a === void 0 ? void 0 : _a.translated_name) !== null && _b !== void 0 ? _b : Properties === null || Properties === void 0 ? void 0 : Properties.System_Name) + realFullpath.replace(((_d = (_c = Translations[currentLanguage]) === null || _c === void 0 ? void 0 : _c.translated_fullpath) !== null && _d !== void 0 ? _d : Properties === null || Properties === void 0 ? void 0 : Properties.System_Fullpath), "");
211
+ }
212
+ else {
213
+ const { fullpath, fullpathTranslated, title, valueTranslated } = this.rawDataManager.getData();
214
+ toret = (valueTranslated !== null && valueTranslated !== void 0 ? valueTranslated : title) + realFullpath.replace((fullpathTranslated !== null && fullpathTranslated !== void 0 ? fullpathTranslated : fullpath), "");
215
+ }
216
+ }
217
+ else
218
+ this.errorToLog = "Error in getFullpath : startnode is not number";
219
+ }
220
+ catch (error) {
221
+ this.errorToLog = "Error in getFullpath " + error.toString();
222
+ }
223
+ return toret;
224
+ };
198
225
  this.options = undefined;
199
226
  this.valueChangeCallback = undefined;
200
227
  this.disabled = undefined;
@@ -648,9 +675,11 @@ export class HierarchizedPickerComponent {
648
675
  this.ignoreOptionsChanges = false;
649
676
  },
650
677
  });
651
- Object.values(myTree.liElementsById).forEach((el) => {
652
- el.classList.remove('treejs-node__searchmatch');
653
- });
678
+ if (this.searchResultData.length == 0) {
679
+ Object.values(myTree.liElementsById).forEach((el) => {
680
+ el.classList.remove('treejs-node__searchmatch');
681
+ });
682
+ }
654
683
  this.loadedTreeJs = myTree;
655
684
  this.collapseAllNodes();
656
685
  // TODO Make something that makes sense, this is a temporary quick fix :
@@ -833,8 +862,8 @@ export class HierarchizedPickerComponent {
833
862
  if (!value)
834
863
  value = this.value;
835
864
  this.displayedValue = value.map(item => {
836
- var _a;
837
- return (_a = (this.optionsManager.getOptions().isFullpath ? item.fullpathTranslated : item.shortpathTranslated)) !== null && _a !== void 0 ? _a : `Node ${item.nodeid}`;
865
+ var _a, _b;
866
+ return (_b = (this.optionsManager.getOptions().isFullpath ? this.getShortenedFullpath((_a = item.fullpathTranslated) !== null && _a !== void 0 ? _a : item.fullpath) : item.shortpathTranslated)) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`;
838
867
  }).join(';');
839
868
  }
840
869
  // Search a value in the tree and triggers a search when necessary
@@ -1021,7 +1050,7 @@ export class HierarchizedPickerComponent {
1021
1050
  return "No selection";
1022
1051
  }
1023
1052
  return this.value
1024
- .map(item => { var _a, _b, _c; return (_c = (_b = (_a = item.fullpath) !== null && _a !== void 0 ? _a : item.fullpathTranslated) !== null && _b !== void 0 ? _b : item.shortpathTranslated) !== null && _c !== void 0 ? _c : `Node ${item.nodeid}`; })
1053
+ .map(item => { var _a, _b; return (_b = (_a = this.getShortenedFullpath(item.fullpathTranslated)) !== null && _a !== void 0 ? _a : item.fullpath) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`; })
1025
1054
  .join('; ');
1026
1055
  }
1027
1056
  render() {
@@ -18883,6 +18883,33 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18883
18883
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
18884
18884
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
18885
18885
  this.mylog = console.log; // Custom log function for debug purposes
18886
+ this.getShortenedFullpath = (realFullpath) => {
18887
+ var _a, _b, _c, _d;
18888
+ let toret = realFullpath;
18889
+ try {
18890
+ const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
18891
+ const property_value = this.optionsManager.getOptions().options[property_nodeid];
18892
+ if (property_value in ["0", 0])
18893
+ return toret;
18894
+ if (isNumeric(property_value)) {
18895
+ if (this.optionsManager.getOptions().origin == 'classification') {
18896
+ const { Translations, Properties } = this.rawDataManager.getData();
18897
+ const currentLanguage = this.optionsManager.getOptions().language;
18898
+ toret = ((_b = (_a = Translations[currentLanguage]) === null || _a === void 0 ? void 0 : _a.translated_name) !== null && _b !== void 0 ? _b : Properties === null || Properties === void 0 ? void 0 : Properties.System_Name) + realFullpath.replace(((_d = (_c = Translations[currentLanguage]) === null || _c === void 0 ? void 0 : _c.translated_fullpath) !== null && _d !== void 0 ? _d : Properties === null || Properties === void 0 ? void 0 : Properties.System_Fullpath), "");
18899
+ }
18900
+ else {
18901
+ const { fullpath, fullpathTranslated, title, valueTranslated } = this.rawDataManager.getData();
18902
+ toret = (valueTranslated !== null && valueTranslated !== void 0 ? valueTranslated : title) + realFullpath.replace((fullpathTranslated !== null && fullpathTranslated !== void 0 ? fullpathTranslated : fullpath), "");
18903
+ }
18904
+ }
18905
+ else
18906
+ this.errorToLog = "Error in getFullpath : startnode is not number";
18907
+ }
18908
+ catch (error) {
18909
+ this.errorToLog = "Error in getFullpath " + error.toString();
18910
+ }
18911
+ return toret;
18912
+ };
18886
18913
  this.options = undefined;
18887
18914
  this.valueChangeCallback = undefined;
18888
18915
  this.disabled = undefined;
@@ -19333,9 +19360,11 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19333
19360
  this.ignoreOptionsChanges = false;
19334
19361
  },
19335
19362
  });
19336
- Object.values(myTree.liElementsById).forEach((el) => {
19337
- el.classList.remove('treejs-node__searchmatch');
19338
- });
19363
+ if (this.searchResultData.length == 0) {
19364
+ Object.values(myTree.liElementsById).forEach((el) => {
19365
+ el.classList.remove('treejs-node__searchmatch');
19366
+ });
19367
+ }
19339
19368
  this.loadedTreeJs = myTree;
19340
19369
  this.collapseAllNodes();
19341
19370
  // TODO Make something that makes sense, this is a temporary quick fix :
@@ -19518,8 +19547,8 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19518
19547
  if (!value)
19519
19548
  value = this.value;
19520
19549
  this.displayedValue = value.map(item => {
19521
- var _a;
19522
- return (_a = (this.optionsManager.getOptions().isFullpath ? item.fullpathTranslated : item.shortpathTranslated)) !== null && _a !== void 0 ? _a : `Node ${item.nodeid}`;
19550
+ var _a, _b;
19551
+ return (_b = (this.optionsManager.getOptions().isFullpath ? this.getShortenedFullpath((_a = item.fullpathTranslated) !== null && _a !== void 0 ? _a : item.fullpath) : item.shortpathTranslated)) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`;
19523
19552
  }).join(';');
19524
19553
  }
19525
19554
  // Search a value in the tree and triggers a search when necessary
@@ -19706,7 +19735,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19706
19735
  return "No selection";
19707
19736
  }
19708
19737
  return this.value
19709
- .map(item => { var _a, _b, _c; return (_c = (_b = (_a = item.fullpath) !== null && _a !== void 0 ? _a : item.fullpathTranslated) !== null && _b !== void 0 ? _b : item.shortpathTranslated) !== null && _c !== void 0 ? _c : `Node ${item.nodeid}`; })
19738
+ .map(item => { var _a, _b; return (_b = (_a = this.getShortenedFullpath(item.fullpathTranslated)) !== null && _a !== void 0 ? _a : item.fullpath) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`; })
19710
19739
  .join('; ');
19711
19740
  }
19712
19741
  render() {
@@ -18881,6 +18881,33 @@ const HierarchizedPickerComponent = class {
18881
18881
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
18882
18882
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
18883
18883
  this.mylog = console.log; // Custom log function for debug purposes
18884
+ this.getShortenedFullpath = (realFullpath) => {
18885
+ var _a, _b, _c, _d;
18886
+ let toret = realFullpath;
18887
+ try {
18888
+ const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
18889
+ const property_value = this.optionsManager.getOptions().options[property_nodeid];
18890
+ if (property_value in ["0", 0])
18891
+ return toret;
18892
+ if (isNumeric(property_value)) {
18893
+ if (this.optionsManager.getOptions().origin == 'classification') {
18894
+ const { Translations, Properties } = this.rawDataManager.getData();
18895
+ const currentLanguage = this.optionsManager.getOptions().language;
18896
+ toret = ((_b = (_a = Translations[currentLanguage]) === null || _a === void 0 ? void 0 : _a.translated_name) !== null && _b !== void 0 ? _b : Properties === null || Properties === void 0 ? void 0 : Properties.System_Name) + realFullpath.replace(((_d = (_c = Translations[currentLanguage]) === null || _c === void 0 ? void 0 : _c.translated_fullpath) !== null && _d !== void 0 ? _d : Properties === null || Properties === void 0 ? void 0 : Properties.System_Fullpath), "");
18897
+ }
18898
+ else {
18899
+ const { fullpath, fullpathTranslated, title, valueTranslated } = this.rawDataManager.getData();
18900
+ toret = (valueTranslated !== null && valueTranslated !== void 0 ? valueTranslated : title) + realFullpath.replace((fullpathTranslated !== null && fullpathTranslated !== void 0 ? fullpathTranslated : fullpath), "");
18901
+ }
18902
+ }
18903
+ else
18904
+ this.errorToLog = "Error in getFullpath : startnode is not number";
18905
+ }
18906
+ catch (error) {
18907
+ this.errorToLog = "Error in getFullpath " + error.toString();
18908
+ }
18909
+ return toret;
18910
+ };
18884
18911
  this.options = undefined;
18885
18912
  this.valueChangeCallback = undefined;
18886
18913
  this.disabled = undefined;
@@ -19331,9 +19358,11 @@ const HierarchizedPickerComponent = class {
19331
19358
  this.ignoreOptionsChanges = false;
19332
19359
  },
19333
19360
  });
19334
- Object.values(myTree.liElementsById).forEach((el) => {
19335
- el.classList.remove('treejs-node__searchmatch');
19336
- });
19361
+ if (this.searchResultData.length == 0) {
19362
+ Object.values(myTree.liElementsById).forEach((el) => {
19363
+ el.classList.remove('treejs-node__searchmatch');
19364
+ });
19365
+ }
19337
19366
  this.loadedTreeJs = myTree;
19338
19367
  this.collapseAllNodes();
19339
19368
  // TODO Make something that makes sense, this is a temporary quick fix :
@@ -19516,8 +19545,8 @@ const HierarchizedPickerComponent = class {
19516
19545
  if (!value)
19517
19546
  value = this.value;
19518
19547
  this.displayedValue = value.map(item => {
19519
- var _a;
19520
- return (_a = (this.optionsManager.getOptions().isFullpath ? item.fullpathTranslated : item.shortpathTranslated)) !== null && _a !== void 0 ? _a : `Node ${item.nodeid}`;
19548
+ var _a, _b;
19549
+ return (_b = (this.optionsManager.getOptions().isFullpath ? this.getShortenedFullpath((_a = item.fullpathTranslated) !== null && _a !== void 0 ? _a : item.fullpath) : item.shortpathTranslated)) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`;
19521
19550
  }).join(';');
19522
19551
  }
19523
19552
  // Search a value in the tree and triggers a search when necessary
@@ -19704,7 +19733,7 @@ const HierarchizedPickerComponent = class {
19704
19733
  return "No selection";
19705
19734
  }
19706
19735
  return this.value
19707
- .map(item => { var _a, _b, _c; return (_c = (_b = (_a = item.fullpath) !== null && _a !== void 0 ? _a : item.fullpathTranslated) !== null && _b !== void 0 ? _b : item.shortpathTranslated) !== null && _c !== void 0 ? _c : `Node ${item.nodeid}`; })
19736
+ .map(item => { var _a, _b; return (_b = (_a = this.getShortenedFullpath(item.fullpathTranslated)) !== null && _a !== void 0 ? _a : item.fullpath) !== null && _b !== void 0 ? _b : `Node ${item.nodeid}`; })
19708
19737
  .join('; ');
19709
19738
  }
19710
19739
  render() {