reneco-hierarchized-picker 0.4.2 → 0.4.3-beta.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.
@@ -312,10 +312,10 @@ Tree.prototype.bindEvent = function (ele) {
312
312
  return;
313
313
  const { target } = e;
314
314
  if (target.nodeName === 'SPAN' && (target.classList.contains('treejs-checkbox') || target.classList.contains('treejs-label'))) {
315
- this.onItemClick(target.parentNode.nodeId);
315
+ this.onItemClick(target.parentNode.nodeId, e.button == 2);
316
316
  }
317
317
  else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
318
- this.onItemClick(target.nodeId);
318
+ this.onItemClick(target.nodeId, e.button == 2);
319
319
  }
320
320
  else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
321
321
  this.onSwitcherClick(target);
@@ -365,13 +365,16 @@ Tree.prototype.bindEvent = function (ele) {
365
365
  }
366
366
  }, false);
367
367
  };
368
- Tree.prototype.onItemClick = function (id) {
368
+ Tree.prototype.onItemClick = async function (id, rightclick = false) {
369
369
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
370
370
  if (this.options.parentApi.isDisabled && this.options.parentApi.optionsManager.getOptions().mode != "tree")
371
371
  return;
372
- if (!this.options.parentApi.theOptions.multiple)
373
- this.emptyNodesCheckStatus();
374
- this.options.parentApi.setNodeAsSelected(id, this, true);
372
+ const pickerValue = await this.options.parentApi.getValue();
373
+ if (!rightclick || !pickerValue || pickerValue.nodeid != id) {
374
+ if (!this.options.parentApi.theOptions.multiple)
375
+ this.emptyNodesCheckStatus();
376
+ this.options.parentApi.setNodeAsSelected(id, this, true);
377
+ }
375
378
  };
376
379
  Tree.prototype.unCheckElement = function (id) {
377
380
  this.setValue(id);
@@ -17901,7 +17904,6 @@ function isInstanceOfIConf(object) {
17901
17904
  toret = false;
17902
17905
  errorToLog = "options.url value '" + object.url + "' doesn't meet interface IConf requirements, is wrongly formated or doesn't match option.source value";
17903
17906
  }
17904
- //TODO allow Function along with string
17905
17907
  if (!((object.source != 'webservice' && !object.token) ||
17906
17908
  (object.source == 'webservice' && object.token && (typeof object.token == 'string' || typeof object.token == 'function')))) {
17907
17909
  toret = false;
@@ -18778,7 +18780,7 @@ const HierarchizedPickerComponent = class {
18778
18780
  // this.rawData = null;
18779
18781
  // }
18780
18782
  // this.ready = false;
18781
- //NOTE: This could work in a synchronous environment =>
18783
+ //NOTE: This could work in a synchronous environment =>
18782
18784
  // reloadCurrentValues() {
18783
18785
  // let savedValues = this.value;
18784
18786
  // this.value = [];
@@ -18787,6 +18789,10 @@ const HierarchizedPickerComponent = class {
18787
18789
  // });
18788
18790
  // ---------------------------------------
18789
18791
  // this.theOptions = newValue;
18792
+ if (oldValue && JSON.stringify(newValue.options) == JSON.stringify(oldValue.options)) {
18793
+ this.ready = true;
18794
+ return;
18795
+ }
18790
18796
  if (typeof newValue == 'string')
18791
18797
  newValue = JSON.parse(newValue);
18792
18798
  if (typeof oldValue == 'string')
@@ -18879,6 +18885,33 @@ const HierarchizedPickerComponent = class {
18879
18885
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
18880
18886
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
18881
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
+ };
18882
18915
  this.options = undefined;
18883
18916
  this.valueChangeCallback = undefined;
18884
18917
  this.disabled = undefined;
@@ -19142,9 +19175,9 @@ const HierarchizedPickerComponent = class {
19142
19175
  }
19143
19176
  }
19144
19177
  // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
19145
- getContextualApiURL() {
19178
+ getContextualApiURL(init = false) {
19146
19179
  const { options, url } = this.optionsManager.getOptions();
19147
- if (options.Reach) {
19180
+ if (init && options.Reach) {
19148
19181
  // Use a base URL for relative paths
19149
19182
  const base = window.location.origin; // fallback for relative URLs
19150
19183
  const parsedUrl = new URL(url, base);
@@ -19153,16 +19186,17 @@ const HierarchizedPickerComponent = class {
19153
19186
  if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
19154
19187
  dynamicType = pathSegments[pathSegments.length - 1];
19155
19188
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
19156
- this.optionsManager.dropReach();
19157
19189
  return `${parsedUrl.origin}${newPathname}`;
19158
19190
  }
19159
19191
  return url;
19160
19192
  }
19161
- getContextualApiParams(options = null, search = null) {
19193
+ getContextualApiParams(options = null, search = null, init = false) {
19162
19194
  if (!options)
19163
19195
  options = this.optionsManager.getOptions().options;
19164
19196
  let optionsToReturn = Object.assign({}, options);
19165
- if (options.Reach) {
19197
+ if (!init)
19198
+ delete optionsToReturn.Reach;
19199
+ if (optionsToReturn.Reach) {
19166
19200
  delete optionsToReturn.Reach;
19167
19201
  if ("startNode" in optionsToReturn) {
19168
19202
  optionsToReturn.startingnode = optionsToReturn.startNode;
@@ -19513,8 +19547,8 @@ const HierarchizedPickerComponent = class {
19513
19547
  if (!value)
19514
19548
  value = this.value;
19515
19549
  this.displayedValue = value.map(item => {
19516
- var _a;
19517
- 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}`;
19518
19552
  }).join(';');
19519
19553
  }
19520
19554
  // Search a value in the tree and triggers a search when necessary
@@ -19575,8 +19609,8 @@ const HierarchizedPickerComponent = class {
19575
19609
  loadDataForTree(init, loader) {
19576
19610
  if (this.optionsManager.getOptions().source == 'webservice') {
19577
19611
  if (this.optionsManager.getOptions().origin == 'classification') {
19578
- const contextualApiParams = this.getContextualApiParams();
19579
- const contextualApiURL = this.getContextualApiURL();
19612
+ const contextualApiParams = this.getContextualApiParams(null, null, true);
19613
+ const contextualApiURL = this.getContextualApiURL(true);
19580
19614
  this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, loader).then((data) => {
19581
19615
  this.rawData = data;
19582
19616
  if (init) {
@@ -19701,7 +19735,7 @@ const HierarchizedPickerComponent = class {
19701
19735
  return "No selection";
19702
19736
  }
19703
19737
  return this.value
19704
- .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}`; })
19705
19739
  .join('; ');
19706
19740
  }
19707
19741
  render() {
@@ -95,7 +95,7 @@ export class HierarchizedPickerComponent {
95
95
  // this.rawData = null;
96
96
  // }
97
97
  // this.ready = false;
98
- //NOTE: This could work in a synchronous environment =>
98
+ //NOTE: This could work in a synchronous environment =>
99
99
  // reloadCurrentValues() {
100
100
  // let savedValues = this.value;
101
101
  // this.value = [];
@@ -104,6 +104,10 @@ export class HierarchizedPickerComponent {
104
104
  // });
105
105
  // ---------------------------------------
106
106
  // this.theOptions = newValue;
107
+ if (oldValue && JSON.stringify(newValue.options) == JSON.stringify(oldValue.options)) {
108
+ this.ready = true;
109
+ return;
110
+ }
107
111
  if (typeof newValue == 'string')
108
112
  newValue = JSON.parse(newValue);
109
113
  if (typeof oldValue == 'string')
@@ -191,6 +195,33 @@ export class HierarchizedPickerComponent {
191
195
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
192
196
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
193
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
+ };
194
225
  this.options = undefined;
195
226
  this.valueChangeCallback = undefined;
196
227
  this.disabled = undefined;
@@ -457,9 +488,9 @@ export class HierarchizedPickerComponent {
457
488
  }
458
489
  }
459
490
  // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
460
- getContextualApiURL() {
491
+ getContextualApiURL(init = false) {
461
492
  const { options, url } = this.optionsManager.getOptions();
462
- if (options.Reach) {
493
+ if (init && options.Reach) {
463
494
  // Use a base URL for relative paths
464
495
  const base = window.location.origin; // fallback for relative URLs
465
496
  const parsedUrl = new URL(url, base);
@@ -468,16 +499,17 @@ export class HierarchizedPickerComponent {
468
499
  if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
469
500
  dynamicType = pathSegments[pathSegments.length - 1];
470
501
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
471
- this.optionsManager.dropReach();
472
502
  return `${parsedUrl.origin}${newPathname}`;
473
503
  }
474
504
  return url;
475
505
  }
476
- getContextualApiParams(options = null, search = null) {
506
+ getContextualApiParams(options = null, search = null, init = false) {
477
507
  if (!options)
478
508
  options = this.optionsManager.getOptions().options;
479
509
  let optionsToReturn = Object.assign({}, options);
480
- if (options.Reach) {
510
+ if (!init)
511
+ delete optionsToReturn.Reach;
512
+ if (optionsToReturn.Reach) {
481
513
  delete optionsToReturn.Reach;
482
514
  if ("startNode" in optionsToReturn) {
483
515
  optionsToReturn.startingnode = optionsToReturn.startNode;
@@ -828,8 +860,8 @@ export class HierarchizedPickerComponent {
828
860
  if (!value)
829
861
  value = this.value;
830
862
  this.displayedValue = value.map(item => {
831
- var _a;
832
- return (_a = (this.optionsManager.getOptions().isFullpath ? item.fullpathTranslated : item.shortpathTranslated)) !== null && _a !== void 0 ? _a : `Node ${item.nodeid}`;
863
+ var _a, _b;
864
+ 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}`;
833
865
  }).join(';');
834
866
  }
835
867
  // Search a value in the tree and triggers a search when necessary
@@ -890,8 +922,8 @@ export class HierarchizedPickerComponent {
890
922
  loadDataForTree(init, loader) {
891
923
  if (this.optionsManager.getOptions().source == 'webservice') {
892
924
  if (this.optionsManager.getOptions().origin == 'classification') {
893
- const contextualApiParams = this.getContextualApiParams();
894
- const contextualApiURL = this.getContextualApiURL();
925
+ const contextualApiParams = this.getContextualApiParams(null, null, true);
926
+ const contextualApiURL = this.getContextualApiURL(true);
895
927
  this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, loader).then((data) => {
896
928
  this.rawData = data;
897
929
  if (init) {
@@ -1016,7 +1048,7 @@ export class HierarchizedPickerComponent {
1016
1048
  return "No selection";
1017
1049
  }
1018
1050
  return this.value
1019
- .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}`; })
1051
+ .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}`; })
1020
1052
  .join('; ');
1021
1053
  }
1022
1054
  render() {
@@ -180,10 +180,10 @@ Tree.prototype.bindEvent = function (ele) {
180
180
  return;
181
181
  const { target } = e;
182
182
  if (target.nodeName === 'SPAN' && (target.classList.contains('treejs-checkbox') || target.classList.contains('treejs-label'))) {
183
- this.onItemClick(target.parentNode.nodeId);
183
+ this.onItemClick(target.parentNode.nodeId, e.button == 2);
184
184
  }
185
185
  else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
186
- this.onItemClick(target.nodeId);
186
+ this.onItemClick(target.nodeId, e.button == 2);
187
187
  }
188
188
  else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
189
189
  this.onSwitcherClick(target);
@@ -233,13 +233,16 @@ Tree.prototype.bindEvent = function (ele) {
233
233
  }
234
234
  }, false);
235
235
  };
236
- Tree.prototype.onItemClick = function (id) {
236
+ Tree.prototype.onItemClick = async function (id, rightclick = false) {
237
237
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
238
238
  if (this.options.parentApi.isDisabled && this.options.parentApi.optionsManager.getOptions().mode != "tree")
239
239
  return;
240
- if (!this.options.parentApi.theOptions.multiple)
241
- this.emptyNodesCheckStatus();
242
- this.options.parentApi.setNodeAsSelected(id, this, true);
240
+ const pickerValue = await this.options.parentApi.getValue();
241
+ if (!rightclick || !pickerValue || pickerValue.nodeid != id) {
242
+ if (!this.options.parentApi.theOptions.multiple)
243
+ this.emptyNodesCheckStatus();
244
+ this.options.parentApi.setNodeAsSelected(id, this, true);
245
+ }
243
246
  };
244
247
  Tree.prototype.unCheckElement = function (id) {
245
248
  this.setValue(id);
@@ -11,7 +11,6 @@ export function isInstanceOfIConf(object) {
11
11
  toret = false;
12
12
  errorToLog = "options.url value '" + object.url + "' doesn't meet interface IConf requirements, is wrongly formated or doesn't match option.source value";
13
13
  }
14
- //TODO allow Function along with string
15
14
  if (!((object.source != 'webservice' && !object.token) ||
16
15
  (object.source == 'webservice' && object.token && (typeof object.token == 'string' || typeof object.token == 'function')))) {
17
16
  toret = false;
@@ -309,10 +309,10 @@ Tree.prototype.bindEvent = function (ele) {
309
309
  return;
310
310
  const { target } = e;
311
311
  if (target.nodeName === 'SPAN' && (target.classList.contains('treejs-checkbox') || target.classList.contains('treejs-label'))) {
312
- this.onItemClick(target.parentNode.nodeId);
312
+ this.onItemClick(target.parentNode.nodeId, e.button == 2);
313
313
  }
314
314
  else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
315
- this.onItemClick(target.nodeId);
315
+ this.onItemClick(target.nodeId, e.button == 2);
316
316
  }
317
317
  else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
318
318
  this.onSwitcherClick(target);
@@ -362,13 +362,16 @@ Tree.prototype.bindEvent = function (ele) {
362
362
  }
363
363
  }, false);
364
364
  };
365
- Tree.prototype.onItemClick = function (id) {
365
+ Tree.prototype.onItemClick = async function (id, rightclick = false) {
366
366
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
367
367
  if (this.options.parentApi.isDisabled && this.options.parentApi.optionsManager.getOptions().mode != "tree")
368
368
  return;
369
- if (!this.options.parentApi.theOptions.multiple)
370
- this.emptyNodesCheckStatus();
371
- this.options.parentApi.setNodeAsSelected(id, this, true);
369
+ const pickerValue = await this.options.parentApi.getValue();
370
+ if (!rightclick || !pickerValue || pickerValue.nodeid != id) {
371
+ if (!this.options.parentApi.theOptions.multiple)
372
+ this.emptyNodesCheckStatus();
373
+ this.options.parentApi.setNodeAsSelected(id, this, true);
374
+ }
372
375
  };
373
376
  Tree.prototype.unCheckElement = function (id) {
374
377
  this.setValue(id);
@@ -17898,7 +17901,6 @@ function isInstanceOfIConf(object) {
17898
17901
  toret = false;
17899
17902
  errorToLog = "options.url value '" + object.url + "' doesn't meet interface IConf requirements, is wrongly formated or doesn't match option.source value";
17900
17903
  }
17901
- //TODO allow Function along with string
17902
17904
  if (!((object.source != 'webservice' && !object.token) ||
17903
17905
  (object.source == 'webservice' && object.token && (typeof object.token == 'string' || typeof object.token == 'function')))) {
17904
17906
  toret = false;
@@ -18775,7 +18777,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18775
18777
  // this.rawData = null;
18776
18778
  // }
18777
18779
  // this.ready = false;
18778
- //NOTE: This could work in a synchronous environment =>
18780
+ //NOTE: This could work in a synchronous environment =>
18779
18781
  // reloadCurrentValues() {
18780
18782
  // let savedValues = this.value;
18781
18783
  // this.value = [];
@@ -18784,6 +18786,10 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18784
18786
  // });
18785
18787
  // ---------------------------------------
18786
18788
  // this.theOptions = newValue;
18789
+ if (oldValue && JSON.stringify(newValue.options) == JSON.stringify(oldValue.options)) {
18790
+ this.ready = true;
18791
+ return;
18792
+ }
18787
18793
  if (typeof newValue == 'string')
18788
18794
  newValue = JSON.parse(newValue);
18789
18795
  if (typeof oldValue == 'string')
@@ -18877,6 +18883,33 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18877
18883
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
18878
18884
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
18879
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
+ };
18880
18913
  this.options = undefined;
18881
18914
  this.valueChangeCallback = undefined;
18882
18915
  this.disabled = undefined;
@@ -19140,9 +19173,9 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19140
19173
  }
19141
19174
  }
19142
19175
  // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
19143
- getContextualApiURL() {
19176
+ getContextualApiURL(init = false) {
19144
19177
  const { options, url } = this.optionsManager.getOptions();
19145
- if (options.Reach) {
19178
+ if (init && options.Reach) {
19146
19179
  // Use a base URL for relative paths
19147
19180
  const base = window.location.origin; // fallback for relative URLs
19148
19181
  const parsedUrl = new URL(url, base);
@@ -19151,16 +19184,17 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19151
19184
  if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
19152
19185
  dynamicType = pathSegments[pathSegments.length - 1];
19153
19186
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
19154
- this.optionsManager.dropReach();
19155
19187
  return `${parsedUrl.origin}${newPathname}`;
19156
19188
  }
19157
19189
  return url;
19158
19190
  }
19159
- getContextualApiParams(options = null, search = null) {
19191
+ getContextualApiParams(options = null, search = null, init = false) {
19160
19192
  if (!options)
19161
19193
  options = this.optionsManager.getOptions().options;
19162
19194
  let optionsToReturn = Object.assign({}, options);
19163
- if (options.Reach) {
19195
+ if (!init)
19196
+ delete optionsToReturn.Reach;
19197
+ if (optionsToReturn.Reach) {
19164
19198
  delete optionsToReturn.Reach;
19165
19199
  if ("startNode" in optionsToReturn) {
19166
19200
  optionsToReturn.startingnode = optionsToReturn.startNode;
@@ -19511,8 +19545,8 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19511
19545
  if (!value)
19512
19546
  value = this.value;
19513
19547
  this.displayedValue = value.map(item => {
19514
- var _a;
19515
- 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}`;
19516
19550
  }).join(';');
19517
19551
  }
19518
19552
  // Search a value in the tree and triggers a search when necessary
@@ -19573,8 +19607,8 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19573
19607
  loadDataForTree(init, loader) {
19574
19608
  if (this.optionsManager.getOptions().source == 'webservice') {
19575
19609
  if (this.optionsManager.getOptions().origin == 'classification') {
19576
- const contextualApiParams = this.getContextualApiParams();
19577
- const contextualApiURL = this.getContextualApiURL();
19610
+ const contextualApiParams = this.getContextualApiParams(null, null, true);
19611
+ const contextualApiURL = this.getContextualApiURL(true);
19578
19612
  this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, loader).then((data) => {
19579
19613
  this.rawData = data;
19580
19614
  if (init) {
@@ -19699,7 +19733,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19699
19733
  return "No selection";
19700
19734
  }
19701
19735
  return this.value
19702
- .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}`; })
19703
19737
  .join('; ');
19704
19738
  }
19705
19739
  render() {
@@ -308,10 +308,10 @@ Tree.prototype.bindEvent = function (ele) {
308
308
  return;
309
309
  const { target } = e;
310
310
  if (target.nodeName === 'SPAN' && (target.classList.contains('treejs-checkbox') || target.classList.contains('treejs-label'))) {
311
- this.onItemClick(target.parentNode.nodeId);
311
+ this.onItemClick(target.parentNode.nodeId, e.button == 2);
312
312
  }
313
313
  else if (target.nodeName === 'LI' && target.classList.contains('treejs-node')) {
314
- this.onItemClick(target.nodeId);
314
+ this.onItemClick(target.nodeId, e.button == 2);
315
315
  }
316
316
  else if (target.nodeName === 'SPAN' && target.classList.contains('treejs-switcher')) {
317
317
  this.onSwitcherClick(target);
@@ -361,13 +361,16 @@ Tree.prototype.bindEvent = function (ele) {
361
361
  }
362
362
  }, false);
363
363
  };
364
- Tree.prototype.onItemClick = function (id) {
364
+ Tree.prototype.onItemClick = async function (id, rightclick = false) {
365
365
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
366
366
  if (this.options.parentApi.isDisabled && this.options.parentApi.optionsManager.getOptions().mode != "tree")
367
367
  return;
368
- if (!this.options.parentApi.theOptions.multiple)
369
- this.emptyNodesCheckStatus();
370
- this.options.parentApi.setNodeAsSelected(id, this, true);
368
+ const pickerValue = await this.options.parentApi.getValue();
369
+ if (!rightclick || !pickerValue || pickerValue.nodeid != id) {
370
+ if (!this.options.parentApi.theOptions.multiple)
371
+ this.emptyNodesCheckStatus();
372
+ this.options.parentApi.setNodeAsSelected(id, this, true);
373
+ }
371
374
  };
372
375
  Tree.prototype.unCheckElement = function (id) {
373
376
  this.setValue(id);
@@ -17897,7 +17900,6 @@ function isInstanceOfIConf(object) {
17897
17900
  toret = false;
17898
17901
  errorToLog = "options.url value '" + object.url + "' doesn't meet interface IConf requirements, is wrongly formated or doesn't match option.source value";
17899
17902
  }
17900
- //TODO allow Function along with string
17901
17903
  if (!((object.source != 'webservice' && !object.token) ||
17902
17904
  (object.source == 'webservice' && object.token && (typeof object.token == 'string' || typeof object.token == 'function')))) {
17903
17905
  toret = false;
@@ -18774,7 +18776,7 @@ const HierarchizedPickerComponent = class {
18774
18776
  // this.rawData = null;
18775
18777
  // }
18776
18778
  // this.ready = false;
18777
- //NOTE: This could work in a synchronous environment =>
18779
+ //NOTE: This could work in a synchronous environment =>
18778
18780
  // reloadCurrentValues() {
18779
18781
  // let savedValues = this.value;
18780
18782
  // this.value = [];
@@ -18783,6 +18785,10 @@ const HierarchizedPickerComponent = class {
18783
18785
  // });
18784
18786
  // ---------------------------------------
18785
18787
  // this.theOptions = newValue;
18788
+ if (oldValue && JSON.stringify(newValue.options) == JSON.stringify(oldValue.options)) {
18789
+ this.ready = true;
18790
+ return;
18791
+ }
18786
18792
  if (typeof newValue == 'string')
18787
18793
  newValue = JSON.parse(newValue);
18788
18794
  if (typeof oldValue == 'string')
@@ -18875,6 +18881,33 @@ const HierarchizedPickerComponent = class {
18875
18881
  this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
18876
18882
  this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
18877
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
+ };
18878
18911
  this.options = undefined;
18879
18912
  this.valueChangeCallback = undefined;
18880
18913
  this.disabled = undefined;
@@ -19138,9 +19171,9 @@ const HierarchizedPickerComponent = class {
19138
19171
  }
19139
19172
  }
19140
19173
  // TODO > Celine would rather like the context (thesaurus or position) to be extracted another way
19141
- getContextualApiURL() {
19174
+ getContextualApiURL(init = false) {
19142
19175
  const { options, url } = this.optionsManager.getOptions();
19143
- if (options.Reach) {
19176
+ if (init && options.Reach) {
19144
19177
  // Use a base URL for relative paths
19145
19178
  const base = window.location.origin; // fallback for relative URLs
19146
19179
  const parsedUrl = new URL(url, base);
@@ -19149,16 +19182,17 @@ const HierarchizedPickerComponent = class {
19149
19182
  if (['thesaurus', 'position'].indexOf(dynamicType) == -1)
19150
19183
  dynamicType = pathSegments[pathSegments.length - 1];
19151
19184
  const newPathname = `/api/v1/classification/reach/${dynamicType}/${options.Reach}`;
19152
- this.optionsManager.dropReach();
19153
19185
  return `${parsedUrl.origin}${newPathname}`;
19154
19186
  }
19155
19187
  return url;
19156
19188
  }
19157
- getContextualApiParams(options = null, search = null) {
19189
+ getContextualApiParams(options = null, search = null, init = false) {
19158
19190
  if (!options)
19159
19191
  options = this.optionsManager.getOptions().options;
19160
19192
  let optionsToReturn = Object.assign({}, options);
19161
- if (options.Reach) {
19193
+ if (!init)
19194
+ delete optionsToReturn.Reach;
19195
+ if (optionsToReturn.Reach) {
19162
19196
  delete optionsToReturn.Reach;
19163
19197
  if ("startNode" in optionsToReturn) {
19164
19198
  optionsToReturn.startingnode = optionsToReturn.startNode;
@@ -19509,8 +19543,8 @@ const HierarchizedPickerComponent = class {
19509
19543
  if (!value)
19510
19544
  value = this.value;
19511
19545
  this.displayedValue = value.map(item => {
19512
- var _a;
19513
- return (_a = (this.optionsManager.getOptions().isFullpath ? item.fullpathTranslated : item.shortpathTranslated)) !== null && _a !== void 0 ? _a : `Node ${item.nodeid}`;
19546
+ var _a, _b;
19547
+ 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}`;
19514
19548
  }).join(';');
19515
19549
  }
19516
19550
  // Search a value in the tree and triggers a search when necessary
@@ -19571,8 +19605,8 @@ const HierarchizedPickerComponent = class {
19571
19605
  loadDataForTree(init, loader) {
19572
19606
  if (this.optionsManager.getOptions().source == 'webservice') {
19573
19607
  if (this.optionsManager.getOptions().origin == 'classification') {
19574
- const contextualApiParams = this.getContextualApiParams();
19575
- const contextualApiURL = this.getContextualApiURL();
19608
+ const contextualApiParams = this.getContextualApiParams(null, null, true);
19609
+ const contextualApiURL = this.getContextualApiURL(true);
19576
19610
  this.rawDataManager.getFromClassification(contextualApiURL, contextualApiParams, loader).then((data) => {
19577
19611
  this.rawData = data;
19578
19612
  if (init) {
@@ -19697,7 +19731,7 @@ const HierarchizedPickerComponent = class {
19697
19731
  return "No selection";
19698
19732
  }
19699
19733
  return this.value
19700
- .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}`; })
19734
+ .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}`; })
19701
19735
  .join('; ');
19702
19736
  }
19703
19737
  render() {