reneco-hierarchized-picker 0.4.3-beta.23 → 0.4.3-beta.24

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.
@@ -19055,15 +19055,36 @@ const HierarchizedPickerComponent = class {
19055
19055
  };
19056
19056
  this.getShortenedFullpath = (realFullpath) => {
19057
19057
  var _a, _b, _c, _d;
19058
+ if (!realFullpath)
19059
+ return realFullpath;
19060
+ //TODO if one day we want shortenedfulpaths from data loading :
19061
+ // const rdmdata = (this.optionsManager.getOptions().source == "webservice" ? this.rawDataManager.getData() : this.rawDataManager.getData().data ?? null);
19062
+ //TODO but for now we're doing :
19063
+ if (this.optionsManager.getOptions().source !== "webservice")
19064
+ return realFullpath;
19058
19065
  let toret = realFullpath;
19059
19066
  const rdmdata = this.rawDataManager.getData();
19060
19067
  if (rdmdata) {
19061
19068
  try {
19062
- const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
19063
- const property_value = this.optionsManager.getOptions().options[property_nodeid];
19064
- if (property_value in ["0", 0])
19069
+ const propertyName_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
19070
+ let propertyValue_nodeid = 0;
19071
+ switch (this.optionsManager.getOptions().source) {
19072
+ case "file":
19073
+ //TODO maybe someday ... someday far !
19074
+ return realFullpath;
19075
+ case "data":
19076
+ //TODO maybe someday ... someday far !
19077
+ if (this.optionsManager.getOptions().origin == 'classification')
19078
+ return realFullpath;
19079
+ propertyValue_nodeid = this.theOptions.data.key;
19080
+ break;
19081
+ case "webservice":
19082
+ propertyValue_nodeid = this.optionsManager.getOptions().options[propertyName_nodeid];
19083
+ break;
19084
+ }
19085
+ if (["0", 0].includes(propertyValue_nodeid))
19065
19086
  return toret;
19066
- if (isNumeric(property_value)) {
19087
+ if (isNumeric(propertyValue_nodeid)) {
19067
19088
  if (this.optionsManager.getOptions().origin == 'classification') {
19068
19089
  const { Translations, Properties } = rdmdata;
19069
19090
  const currentLanguage = this.optionsManager.getOptions().language;
@@ -19075,10 +19096,10 @@ const HierarchizedPickerComponent = class {
19075
19096
  }
19076
19097
  }
19077
19098
  else
19078
- this.errorToLog = "Error in getFullpath : startnode is not number";
19099
+ this.errorToLog = "Error in getShortenedFullpath : startnode is not number";
19079
19100
  }
19080
19101
  catch (error) {
19081
- this.errorToLog = "Error in getFullpath " + error.toString();
19102
+ this.errorToLog = "Error in getShortenedFullpath " + error.toString();
19082
19103
  }
19083
19104
  }
19084
19105
  return toret;
@@ -19193,21 +19214,48 @@ const HierarchizedPickerComponent = class {
19193
19214
  }
19194
19215
  await Promise.all(this.optionsManager.getOptions().defaultValue.map(async (element) => {
19195
19216
  if (this.optionsManager.getOptions().defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
19196
- if (this.optionsManager.getOptions().source !== 'webservice') {
19197
- let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
19217
+ if (!defaultFromFullpaths) {
19218
+ defaultFromFullpaths = [];
19219
+ }
19220
+ let errormsg = '';
19221
+ switch (this.optionsManager.getOptions().source) {
19222
+ case 'file':
19223
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for now!';
19224
+ break;
19225
+ case 'data':
19226
+ if (this.theOptions.origin == 'classification') {
19227
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for the classification context for now!';
19228
+ break;
19229
+ }
19230
+ const searchIdInData = function (treeData) {
19231
+ if (treeData.data.fullpath === element) {
19232
+ return treeData.key;
19233
+ }
19234
+ if (treeData.children && treeData.children.length > 0) {
19235
+ for (const childTree of treeData.children) {
19236
+ const foundId = searchIdInData(childTree);
19237
+ if (foundId) {
19238
+ return foundId;
19239
+ }
19240
+ }
19241
+ }
19242
+ return null;
19243
+ };
19244
+ const foundId = searchIdInData(this.theOptions.data);
19245
+ if (foundId)
19246
+ defaultFromFullpaths.push(foundId);
19247
+ break;
19248
+ case 'webservice':
19249
+ const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
19250
+ if (valtopush) {
19251
+ defaultFromFullpaths.push(valtopush);
19252
+ }
19253
+ break;
19254
+ }
19255
+ if (errormsg.length > 0) {
19198
19256
  this.displayPickerError(errormsg);
19199
19257
  this.errorToLog = errormsg;
19200
19258
  autoAssignReach = false;
19201
- return;
19202
- }
19203
- else {
19204
- if (!defaultFromFullpaths) {
19205
- defaultFromFullpaths = [];
19206
- }
19207
- const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
19208
- if (valtopush) {
19209
- defaultFromFullpaths.push(valtopush);
19210
- }
19211
19259
  }
19212
19260
  }
19213
19261
  }));
@@ -320,15 +320,36 @@ export class HierarchizedPickerComponent {
320
320
  };
321
321
  this.getShortenedFullpath = (realFullpath) => {
322
322
  var _a, _b, _c, _d;
323
+ if (!realFullpath)
324
+ return realFullpath;
325
+ //TODO if one day we want shortenedfulpaths from data loading :
326
+ // const rdmdata = (this.optionsManager.getOptions().source == "webservice" ? this.rawDataManager.getData() : this.rawDataManager.getData().data ?? null);
327
+ //TODO but for now we're doing :
328
+ if (this.optionsManager.getOptions().source !== "webservice")
329
+ return realFullpath;
323
330
  let toret = realFullpath;
324
331
  const rdmdata = this.rawDataManager.getData();
325
332
  if (rdmdata) {
326
333
  try {
327
- const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
328
- const property_value = this.optionsManager.getOptions().options[property_nodeid];
329
- if (property_value in ["0", 0])
334
+ const propertyName_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
335
+ let propertyValue_nodeid = 0;
336
+ switch (this.optionsManager.getOptions().source) {
337
+ case "file":
338
+ //TODO maybe someday ... someday far !
339
+ return realFullpath;
340
+ case "data":
341
+ //TODO maybe someday ... someday far !
342
+ if (this.optionsManager.getOptions().origin == 'classification')
343
+ return realFullpath;
344
+ propertyValue_nodeid = this.theOptions.data.key;
345
+ break;
346
+ case "webservice":
347
+ propertyValue_nodeid = this.optionsManager.getOptions().options[propertyName_nodeid];
348
+ break;
349
+ }
350
+ if (["0", 0].includes(propertyValue_nodeid))
330
351
  return toret;
331
- if (isNumeric(property_value)) {
352
+ if (isNumeric(propertyValue_nodeid)) {
332
353
  if (this.optionsManager.getOptions().origin == 'classification') {
333
354
  const { Translations, Properties } = rdmdata;
334
355
  const currentLanguage = this.optionsManager.getOptions().language;
@@ -340,10 +361,10 @@ export class HierarchizedPickerComponent {
340
361
  }
341
362
  }
342
363
  else
343
- this.errorToLog = "Error in getFullpath : startnode is not number";
364
+ this.errorToLog = "Error in getShortenedFullpath : startnode is not number";
344
365
  }
345
366
  catch (error) {
346
- this.errorToLog = "Error in getFullpath " + error.toString();
367
+ this.errorToLog = "Error in getShortenedFullpath " + error.toString();
347
368
  }
348
369
  }
349
370
  return toret;
@@ -458,21 +479,48 @@ export class HierarchizedPickerComponent {
458
479
  }
459
480
  await Promise.all(this.optionsManager.getOptions().defaultValue.map(async (element) => {
460
481
  if (this.optionsManager.getOptions().defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
461
- if (this.optionsManager.getOptions().source !== 'webservice') {
462
- let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
482
+ if (!defaultFromFullpaths) {
483
+ defaultFromFullpaths = [];
484
+ }
485
+ let errormsg = '';
486
+ switch (this.optionsManager.getOptions().source) {
487
+ case 'file':
488
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for now!';
489
+ break;
490
+ case 'data':
491
+ if (this.theOptions.origin == 'classification') {
492
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for the classification context for now!';
493
+ break;
494
+ }
495
+ const searchIdInData = function (treeData) {
496
+ if (treeData.data.fullpath === element) {
497
+ return treeData.key;
498
+ }
499
+ if (treeData.children && treeData.children.length > 0) {
500
+ for (const childTree of treeData.children) {
501
+ const foundId = searchIdInData(childTree);
502
+ if (foundId) {
503
+ return foundId;
504
+ }
505
+ }
506
+ }
507
+ return null;
508
+ };
509
+ const foundId = searchIdInData(this.theOptions.data);
510
+ if (foundId)
511
+ defaultFromFullpaths.push(foundId);
512
+ break;
513
+ case 'webservice':
514
+ const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
515
+ if (valtopush) {
516
+ defaultFromFullpaths.push(valtopush);
517
+ }
518
+ break;
519
+ }
520
+ if (errormsg.length > 0) {
463
521
  this.displayPickerError(errormsg);
464
522
  this.errorToLog = errormsg;
465
523
  autoAssignReach = false;
466
- return;
467
- }
468
- else {
469
- if (!defaultFromFullpaths) {
470
- defaultFromFullpaths = [];
471
- }
472
- const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
473
- if (valtopush) {
474
- defaultFromFullpaths.push(valtopush);
475
- }
476
524
  }
477
525
  }
478
526
  }));
@@ -19053,15 +19053,36 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19053
19053
  };
19054
19054
  this.getShortenedFullpath = (realFullpath) => {
19055
19055
  var _a, _b, _c, _d;
19056
+ if (!realFullpath)
19057
+ return realFullpath;
19058
+ //TODO if one day we want shortenedfulpaths from data loading :
19059
+ // const rdmdata = (this.optionsManager.getOptions().source == "webservice" ? this.rawDataManager.getData() : this.rawDataManager.getData().data ?? null);
19060
+ //TODO but for now we're doing :
19061
+ if (this.optionsManager.getOptions().source !== "webservice")
19062
+ return realFullpath;
19056
19063
  let toret = realFullpath;
19057
19064
  const rdmdata = this.rawDataManager.getData();
19058
19065
  if (rdmdata) {
19059
19066
  try {
19060
- const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
19061
- const property_value = this.optionsManager.getOptions().options[property_nodeid];
19062
- if (property_value in ["0", 0])
19067
+ const propertyName_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
19068
+ let propertyValue_nodeid = 0;
19069
+ switch (this.optionsManager.getOptions().source) {
19070
+ case "file":
19071
+ //TODO maybe someday ... someday far !
19072
+ return realFullpath;
19073
+ case "data":
19074
+ //TODO maybe someday ... someday far !
19075
+ if (this.optionsManager.getOptions().origin == 'classification')
19076
+ return realFullpath;
19077
+ propertyValue_nodeid = this.theOptions.data.key;
19078
+ break;
19079
+ case "webservice":
19080
+ propertyValue_nodeid = this.optionsManager.getOptions().options[propertyName_nodeid];
19081
+ break;
19082
+ }
19083
+ if (["0", 0].includes(propertyValue_nodeid))
19063
19084
  return toret;
19064
- if (isNumeric(property_value)) {
19085
+ if (isNumeric(propertyValue_nodeid)) {
19065
19086
  if (this.optionsManager.getOptions().origin == 'classification') {
19066
19087
  const { Translations, Properties } = rdmdata;
19067
19088
  const currentLanguage = this.optionsManager.getOptions().language;
@@ -19073,10 +19094,10 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19073
19094
  }
19074
19095
  }
19075
19096
  else
19076
- this.errorToLog = "Error in getFullpath : startnode is not number";
19097
+ this.errorToLog = "Error in getShortenedFullpath : startnode is not number";
19077
19098
  }
19078
19099
  catch (error) {
19079
- this.errorToLog = "Error in getFullpath " + error.toString();
19100
+ this.errorToLog = "Error in getShortenedFullpath " + error.toString();
19080
19101
  }
19081
19102
  }
19082
19103
  return toret;
@@ -19191,21 +19212,48 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19191
19212
  }
19192
19213
  await Promise.all(this.optionsManager.getOptions().defaultValue.map(async (element) => {
19193
19214
  if (this.optionsManager.getOptions().defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
19194
- if (this.optionsManager.getOptions().source !== 'webservice') {
19195
- let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
19215
+ if (!defaultFromFullpaths) {
19216
+ defaultFromFullpaths = [];
19217
+ }
19218
+ let errormsg = '';
19219
+ switch (this.optionsManager.getOptions().source) {
19220
+ case 'file':
19221
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for now!';
19222
+ break;
19223
+ case 'data':
19224
+ if (this.theOptions.origin == 'classification') {
19225
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for the classification context for now!';
19226
+ break;
19227
+ }
19228
+ const searchIdInData = function (treeData) {
19229
+ if (treeData.data.fullpath === element) {
19230
+ return treeData.key;
19231
+ }
19232
+ if (treeData.children && treeData.children.length > 0) {
19233
+ for (const childTree of treeData.children) {
19234
+ const foundId = searchIdInData(childTree);
19235
+ if (foundId) {
19236
+ return foundId;
19237
+ }
19238
+ }
19239
+ }
19240
+ return null;
19241
+ };
19242
+ const foundId = searchIdInData(this.theOptions.data);
19243
+ if (foundId)
19244
+ defaultFromFullpaths.push(foundId);
19245
+ break;
19246
+ case 'webservice':
19247
+ const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
19248
+ if (valtopush) {
19249
+ defaultFromFullpaths.push(valtopush);
19250
+ }
19251
+ break;
19252
+ }
19253
+ if (errormsg.length > 0) {
19196
19254
  this.displayPickerError(errormsg);
19197
19255
  this.errorToLog = errormsg;
19198
19256
  autoAssignReach = false;
19199
- return;
19200
- }
19201
- else {
19202
- if (!defaultFromFullpaths) {
19203
- defaultFromFullpaths = [];
19204
- }
19205
- const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
19206
- if (valtopush) {
19207
- defaultFromFullpaths.push(valtopush);
19208
- }
19209
19257
  }
19210
19258
  }
19211
19259
  }));
@@ -19051,15 +19051,36 @@ const HierarchizedPickerComponent = class {
19051
19051
  };
19052
19052
  this.getShortenedFullpath = (realFullpath) => {
19053
19053
  var _a, _b, _c, _d;
19054
+ if (!realFullpath)
19055
+ return realFullpath;
19056
+ //TODO if one day we want shortenedfulpaths from data loading :
19057
+ // const rdmdata = (this.optionsManager.getOptions().source == "webservice" ? this.rawDataManager.getData() : this.rawDataManager.getData().data ?? null);
19058
+ //TODO but for now we're doing :
19059
+ if (this.optionsManager.getOptions().source !== "webservice")
19060
+ return realFullpath;
19054
19061
  let toret = realFullpath;
19055
19062
  const rdmdata = this.rawDataManager.getData();
19056
19063
  if (rdmdata) {
19057
19064
  try {
19058
- const property_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
19059
- const property_value = this.optionsManager.getOptions().options[property_nodeid];
19060
- if (property_value in ["0", 0])
19065
+ const propertyName_nodeid = (this.optionsManager.getOptions().origin == 'classification' ? "startNode" : "StartNodeID");
19066
+ let propertyValue_nodeid = 0;
19067
+ switch (this.optionsManager.getOptions().source) {
19068
+ case "file":
19069
+ //TODO maybe someday ... someday far !
19070
+ return realFullpath;
19071
+ case "data":
19072
+ //TODO maybe someday ... someday far !
19073
+ if (this.optionsManager.getOptions().origin == 'classification')
19074
+ return realFullpath;
19075
+ propertyValue_nodeid = this.theOptions.data.key;
19076
+ break;
19077
+ case "webservice":
19078
+ propertyValue_nodeid = this.optionsManager.getOptions().options[propertyName_nodeid];
19079
+ break;
19080
+ }
19081
+ if (["0", 0].includes(propertyValue_nodeid))
19061
19082
  return toret;
19062
- if (isNumeric(property_value)) {
19083
+ if (isNumeric(propertyValue_nodeid)) {
19063
19084
  if (this.optionsManager.getOptions().origin == 'classification') {
19064
19085
  const { Translations, Properties } = rdmdata;
19065
19086
  const currentLanguage = this.optionsManager.getOptions().language;
@@ -19071,10 +19092,10 @@ const HierarchizedPickerComponent = class {
19071
19092
  }
19072
19093
  }
19073
19094
  else
19074
- this.errorToLog = "Error in getFullpath : startnode is not number";
19095
+ this.errorToLog = "Error in getShortenedFullpath : startnode is not number";
19075
19096
  }
19076
19097
  catch (error) {
19077
- this.errorToLog = "Error in getFullpath " + error.toString();
19098
+ this.errorToLog = "Error in getShortenedFullpath " + error.toString();
19078
19099
  }
19079
19100
  }
19080
19101
  return toret;
@@ -19189,21 +19210,48 @@ const HierarchizedPickerComponent = class {
19189
19210
  }
19190
19211
  await Promise.all(this.optionsManager.getOptions().defaultValue.map(async (element) => {
19191
19212
  if (this.optionsManager.getOptions().defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
19192
- if (this.optionsManager.getOptions().source !== 'webservice') {
19193
- let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
19213
+ if (!defaultFromFullpaths) {
19214
+ defaultFromFullpaths = [];
19215
+ }
19216
+ let errormsg = '';
19217
+ switch (this.optionsManager.getOptions().source) {
19218
+ case 'file':
19219
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for now!';
19220
+ break;
19221
+ case 'data':
19222
+ if (this.theOptions.origin == 'classification') {
19223
+ errormsg = 'The loading of nodes based on fullpath is not available on file mode for the classification context for now!';
19224
+ break;
19225
+ }
19226
+ const searchIdInData = function (treeData) {
19227
+ if (treeData.data.fullpath === element) {
19228
+ return treeData.key;
19229
+ }
19230
+ if (treeData.children && treeData.children.length > 0) {
19231
+ for (const childTree of treeData.children) {
19232
+ const foundId = searchIdInData(childTree);
19233
+ if (foundId) {
19234
+ return foundId;
19235
+ }
19236
+ }
19237
+ }
19238
+ return null;
19239
+ };
19240
+ const foundId = searchIdInData(this.theOptions.data);
19241
+ if (foundId)
19242
+ defaultFromFullpaths.push(foundId);
19243
+ break;
19244
+ case 'webservice':
19245
+ const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
19246
+ if (valtopush) {
19247
+ defaultFromFullpaths.push(valtopush);
19248
+ }
19249
+ break;
19250
+ }
19251
+ if (errormsg.length > 0) {
19194
19252
  this.displayPickerError(errormsg);
19195
19253
  this.errorToLog = errormsg;
19196
19254
  autoAssignReach = false;
19197
- return;
19198
- }
19199
- else {
19200
- if (!defaultFromFullpaths) {
19201
- defaultFromFullpaths = [];
19202
- }
19203
- const valtopush = await this.rawDataManager.fetchNodeIdFromFullpath(element, this.optionsManager.getOptions()).catch(err => { this.displayPickerError(err); });
19204
- if (valtopush) {
19205
- defaultFromFullpaths.push(valtopush);
19206
- }
19207
19255
  }
19208
19256
  }
19209
19257
  }));