reneco-hierarchized-picker 0.4.0-beta.5 → 0.4.0-beta.7

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.
@@ -18068,31 +18068,27 @@ class RawDataManager {
18068
18068
  }
18069
18069
  // Fetch data from classification
18070
18070
  async getFromClassification(endpoint, options, loader) {
18071
- const urlParams = new URLSearchParams(options);
18072
- //------------
18073
18071
  let pathSegment = '';
18074
- let keyToRemove = '';
18075
- for (const [key, value] of urlParams.entries()) {
18072
+ const queryParams = [];
18073
+ for (const key in options) {
18074
+ if (!options.hasOwnProperty(key))
18075
+ continue;
18076
+ const value = options[key];
18076
18077
  const lowerKey = key.toLowerCase();
18077
- if (lowerKey === 'startnode' || lowerKey === 'startnodeid') {
18078
- pathSegment = value;
18079
- keyToRemove = key;
18080
- break;
18078
+ if ((lowerKey === 'startnode' || lowerKey === 'startnodeid') && !pathSegment) {
18079
+ pathSegment = encodeURIComponent(value);
18080
+ continue; // Skip adding this to the query string
18081
18081
  }
18082
+ // Add other keys to query string
18083
+ queryParams.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
18082
18084
  }
18083
- if (keyToRemove) {
18084
- urlParams.delete(keyToRemove);
18085
- }
18086
- //------------
18085
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
18087
18086
  const newUrl = pathSegment
18088
- ? `${endpoint}/${pathSegment}?${urlParams.toString()}`
18089
- : `${endpoint}/?${urlParams.toString()}`;
18087
+ ? `${endpoint}/${pathSegment}/${queryString}`
18088
+ : `${endpoint}/${queryString}`;
18090
18089
  await this.makeRequest('GET', newUrl, null, loader).then((data) => {
18091
18090
  this.loadData(data);
18092
18091
  });
18093
- // await this.makeRequest('GET', `${endpoint}/?${urlParams.toString()}`, null, loader).then((data) => {
18094
- // this.loadData(data);
18095
- // });
18096
18092
  return;
18097
18093
  }
18098
18094
  // Fetch data from a generic source
@@ -19341,7 +19337,21 @@ const HierarchizedPickerComponent = class {
19341
19337
  if (this.optionsManager.getOptions().source == 'webservice') {
19342
19338
  if (this.optionsManager.getOptions().origin == 'classification') {
19343
19339
  console.log("FLAG 02", this.optionsManager.getOptions());
19344
- this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader);
19340
+ this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader).then((data) => {
19341
+ this.rawData = data;
19342
+ if (init) {
19343
+ this.formatDefaultValue();
19344
+ this.showSelectedNodes();
19345
+ }
19346
+ })
19347
+ .catch(error => {
19348
+ try {
19349
+ this.errorToLog = 'getDataFromSource 3 classification rejected:' + JSON.stringify(error, replacer, 2);
19350
+ }
19351
+ catch (_a) {
19352
+ console.error('getDataFromSource 4 classification rejected:', JSON.stringify(error, replacer, 2));
19353
+ }
19354
+ });
19345
19355
  }
19346
19356
  else {
19347
19357
  this.rawDataManager.getFromSource(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader)
@@ -19354,10 +19364,10 @@ const HierarchizedPickerComponent = class {
19354
19364
  })
19355
19365
  .catch(error => {
19356
19366
  try {
19357
- this.errorToLog = 'getDataFromSource 3 rejected:' + JSON.stringify(error, replacer, 2);
19367
+ this.errorToLog = 'getDataFromSource 3 legacy rejected:' + JSON.stringify(error, replacer, 2);
19358
19368
  }
19359
19369
  catch (_a) {
19360
- console.error('getDataFromSource 4 rejected:', JSON.stringify(error, replacer, 2));
19370
+ console.error('getDataFromSource 4 legacy rejected:', JSON.stringify(error, replacer, 2));
19361
19371
  }
19362
19372
  });
19363
19373
  }
@@ -819,7 +819,21 @@ export class HierarchizedPickerComponent {
819
819
  if (this.optionsManager.getOptions().source == 'webservice') {
820
820
  if (this.optionsManager.getOptions().origin == 'classification') {
821
821
  console.log("FLAG 02", this.optionsManager.getOptions());
822
- this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader);
822
+ this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader).then((data) => {
823
+ this.rawData = data;
824
+ if (init) {
825
+ this.formatDefaultValue();
826
+ this.showSelectedNodes();
827
+ }
828
+ })
829
+ .catch(error => {
830
+ try {
831
+ this.errorToLog = 'getDataFromSource 3 classification rejected:' + JSON.stringify(error, replacer, 2);
832
+ }
833
+ catch (_a) {
834
+ console.error('getDataFromSource 4 classification rejected:', JSON.stringify(error, replacer, 2));
835
+ }
836
+ });
823
837
  }
824
838
  else {
825
839
  this.rawDataManager.getFromSource(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader)
@@ -832,10 +846,10 @@ export class HierarchizedPickerComponent {
832
846
  })
833
847
  .catch(error => {
834
848
  try {
835
- this.errorToLog = 'getDataFromSource 3 rejected:' + JSON.stringify(error, replacer, 2);
849
+ this.errorToLog = 'getDataFromSource 3 legacy rejected:' + JSON.stringify(error, replacer, 2);
836
850
  }
837
851
  catch (_a) {
838
- console.error('getDataFromSource 4 rejected:', JSON.stringify(error, replacer, 2));
852
+ console.error('getDataFromSource 4 legacy rejected:', JSON.stringify(error, replacer, 2));
839
853
  }
840
854
  });
841
855
  }
@@ -42,31 +42,27 @@ export class RawDataManager {
42
42
  }
43
43
  // Fetch data from classification
44
44
  async getFromClassification(endpoint, options, loader) {
45
- const urlParams = new URLSearchParams(options);
46
- //------------
47
45
  let pathSegment = '';
48
- let keyToRemove = '';
49
- for (const [key, value] of urlParams.entries()) {
46
+ const queryParams = [];
47
+ for (const key in options) {
48
+ if (!options.hasOwnProperty(key))
49
+ continue;
50
+ const value = options[key];
50
51
  const lowerKey = key.toLowerCase();
51
- if (lowerKey === 'startnode' || lowerKey === 'startnodeid') {
52
- pathSegment = value;
53
- keyToRemove = key;
54
- break;
52
+ if ((lowerKey === 'startnode' || lowerKey === 'startnodeid') && !pathSegment) {
53
+ pathSegment = encodeURIComponent(value);
54
+ continue; // Skip adding this to the query string
55
55
  }
56
+ // Add other keys to query string
57
+ queryParams.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
56
58
  }
57
- if (keyToRemove) {
58
- urlParams.delete(keyToRemove);
59
- }
60
- //------------
59
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
61
60
  const newUrl = pathSegment
62
- ? `${endpoint}/${pathSegment}?${urlParams.toString()}`
63
- : `${endpoint}/?${urlParams.toString()}`;
61
+ ? `${endpoint}/${pathSegment}/${queryString}`
62
+ : `${endpoint}/${queryString}`;
64
63
  await this.makeRequest('GET', newUrl, null, loader).then((data) => {
65
64
  this.loadData(data);
66
65
  });
67
- // await this.makeRequest('GET', `${endpoint}/?${urlParams.toString()}`, null, loader).then((data) => {
68
- // this.loadData(data);
69
- // });
70
66
  return;
71
67
  }
72
68
  // Fetch data from a generic source
@@ -18065,31 +18065,27 @@ class RawDataManager {
18065
18065
  }
18066
18066
  // Fetch data from classification
18067
18067
  async getFromClassification(endpoint, options, loader) {
18068
- const urlParams = new URLSearchParams(options);
18069
- //------------
18070
18068
  let pathSegment = '';
18071
- let keyToRemove = '';
18072
- for (const [key, value] of urlParams.entries()) {
18069
+ const queryParams = [];
18070
+ for (const key in options) {
18071
+ if (!options.hasOwnProperty(key))
18072
+ continue;
18073
+ const value = options[key];
18073
18074
  const lowerKey = key.toLowerCase();
18074
- if (lowerKey === 'startnode' || lowerKey === 'startnodeid') {
18075
- pathSegment = value;
18076
- keyToRemove = key;
18077
- break;
18075
+ if ((lowerKey === 'startnode' || lowerKey === 'startnodeid') && !pathSegment) {
18076
+ pathSegment = encodeURIComponent(value);
18077
+ continue; // Skip adding this to the query string
18078
18078
  }
18079
+ // Add other keys to query string
18080
+ queryParams.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
18079
18081
  }
18080
- if (keyToRemove) {
18081
- urlParams.delete(keyToRemove);
18082
- }
18083
- //------------
18082
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
18084
18083
  const newUrl = pathSegment
18085
- ? `${endpoint}/${pathSegment}?${urlParams.toString()}`
18086
- : `${endpoint}/?${urlParams.toString()}`;
18084
+ ? `${endpoint}/${pathSegment}/${queryString}`
18085
+ : `${endpoint}/${queryString}`;
18087
18086
  await this.makeRequest('GET', newUrl, null, loader).then((data) => {
18088
18087
  this.loadData(data);
18089
18088
  });
18090
- // await this.makeRequest('GET', `${endpoint}/?${urlParams.toString()}`, null, loader).then((data) => {
18091
- // this.loadData(data);
18092
- // });
18093
18089
  return;
18094
18090
  }
18095
18091
  // Fetch data from a generic source
@@ -19339,7 +19335,21 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19339
19335
  if (this.optionsManager.getOptions().source == 'webservice') {
19340
19336
  if (this.optionsManager.getOptions().origin == 'classification') {
19341
19337
  console.log("FLAG 02", this.optionsManager.getOptions());
19342
- this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader);
19338
+ this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader).then((data) => {
19339
+ this.rawData = data;
19340
+ if (init) {
19341
+ this.formatDefaultValue();
19342
+ this.showSelectedNodes();
19343
+ }
19344
+ })
19345
+ .catch(error => {
19346
+ try {
19347
+ this.errorToLog = 'getDataFromSource 3 classification rejected:' + JSON.stringify(error, replacer, 2);
19348
+ }
19349
+ catch (_a) {
19350
+ console.error('getDataFromSource 4 classification rejected:', JSON.stringify(error, replacer, 2));
19351
+ }
19352
+ });
19343
19353
  }
19344
19354
  else {
19345
19355
  this.rawDataManager.getFromSource(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader)
@@ -19352,10 +19362,10 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19352
19362
  })
19353
19363
  .catch(error => {
19354
19364
  try {
19355
- this.errorToLog = 'getDataFromSource 3 rejected:' + JSON.stringify(error, replacer, 2);
19365
+ this.errorToLog = 'getDataFromSource 3 legacy rejected:' + JSON.stringify(error, replacer, 2);
19356
19366
  }
19357
19367
  catch (_a) {
19358
- console.error('getDataFromSource 4 rejected:', JSON.stringify(error, replacer, 2));
19368
+ console.error('getDataFromSource 4 legacy rejected:', JSON.stringify(error, replacer, 2));
19359
19369
  }
19360
19370
  });
19361
19371
  }
@@ -18064,31 +18064,27 @@ class RawDataManager {
18064
18064
  }
18065
18065
  // Fetch data from classification
18066
18066
  async getFromClassification(endpoint, options, loader) {
18067
- const urlParams = new URLSearchParams(options);
18068
- //------------
18069
18067
  let pathSegment = '';
18070
- let keyToRemove = '';
18071
- for (const [key, value] of urlParams.entries()) {
18068
+ const queryParams = [];
18069
+ for (const key in options) {
18070
+ if (!options.hasOwnProperty(key))
18071
+ continue;
18072
+ const value = options[key];
18072
18073
  const lowerKey = key.toLowerCase();
18073
- if (lowerKey === 'startnode' || lowerKey === 'startnodeid') {
18074
- pathSegment = value;
18075
- keyToRemove = key;
18076
- break;
18074
+ if ((lowerKey === 'startnode' || lowerKey === 'startnodeid') && !pathSegment) {
18075
+ pathSegment = encodeURIComponent(value);
18076
+ continue; // Skip adding this to the query string
18077
18077
  }
18078
+ // Add other keys to query string
18079
+ queryParams.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
18078
18080
  }
18079
- if (keyToRemove) {
18080
- urlParams.delete(keyToRemove);
18081
- }
18082
- //------------
18081
+ const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
18083
18082
  const newUrl = pathSegment
18084
- ? `${endpoint}/${pathSegment}?${urlParams.toString()}`
18085
- : `${endpoint}/?${urlParams.toString()}`;
18083
+ ? `${endpoint}/${pathSegment}/${queryString}`
18084
+ : `${endpoint}/${queryString}`;
18086
18085
  await this.makeRequest('GET', newUrl, null, loader).then((data) => {
18087
18086
  this.loadData(data);
18088
18087
  });
18089
- // await this.makeRequest('GET', `${endpoint}/?${urlParams.toString()}`, null, loader).then((data) => {
18090
- // this.loadData(data);
18091
- // });
18092
18088
  return;
18093
18089
  }
18094
18090
  // Fetch data from a generic source
@@ -19337,7 +19333,21 @@ const HierarchizedPickerComponent = class {
19337
19333
  if (this.optionsManager.getOptions().source == 'webservice') {
19338
19334
  if (this.optionsManager.getOptions().origin == 'classification') {
19339
19335
  console.log("FLAG 02", this.optionsManager.getOptions());
19340
- this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader);
19336
+ this.rawDataManager.getFromClassification(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader).then((data) => {
19337
+ this.rawData = data;
19338
+ if (init) {
19339
+ this.formatDefaultValue();
19340
+ this.showSelectedNodes();
19341
+ }
19342
+ })
19343
+ .catch(error => {
19344
+ try {
19345
+ this.errorToLog = 'getDataFromSource 3 classification rejected:' + JSON.stringify(error, replacer, 2);
19346
+ }
19347
+ catch (_a) {
19348
+ console.error('getDataFromSource 4 classification rejected:', JSON.stringify(error, replacer, 2));
19349
+ }
19350
+ });
19341
19351
  }
19342
19352
  else {
19343
19353
  this.rawDataManager.getFromSource(this.optionsManager.getOptions().url, this.optionsManager.getOptions().options, loader)
@@ -19350,10 +19360,10 @@ const HierarchizedPickerComponent = class {
19350
19360
  })
19351
19361
  .catch(error => {
19352
19362
  try {
19353
- this.errorToLog = 'getDataFromSource 3 rejected:' + JSON.stringify(error, replacer, 2);
19363
+ this.errorToLog = 'getDataFromSource 3 legacy rejected:' + JSON.stringify(error, replacer, 2);
19354
19364
  }
19355
19365
  catch (_a) {
19356
- console.error('getDataFromSource 4 rejected:', JSON.stringify(error, replacer, 2));
19366
+ console.error('getDataFromSource 4 legacy rejected:', JSON.stringify(error, replacer, 2));
19357
19367
  }
19358
19368
  });
19359
19369
  }