reneco-hierarchized-picker 0.2.5 → 0.2.6-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.
@@ -17862,27 +17862,55 @@ const HierarchizedPickerComponent = class {
17862
17862
  });
17863
17863
  }
17864
17864
  async setNewOption(newValue, oldValue = null) {
17865
- this.canload = true;
17865
+ // --------------------------------------- DEPRECATED ?
17866
+ // this.canload = true;
17867
+ // this.theOptions = newValue;
17868
+ // if (this.theOptions.source != "file") {
17869
+ // this.rawData = null;
17870
+ // }
17871
+ // this.ready = false;
17872
+ //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
17873
+ // ---------------------------------------
17866
17874
  this.theOptions = newValue;
17867
- if (this.theOptions.source != "file") {
17875
+ if (((oldValue && (newValue.origin != oldValue.origin
17876
+ || newValue.options.StartNodeID != oldValue.options.StartNodeID)) || !oldValue)
17877
+ && this.theOptions.source != "file") {
17868
17878
  this.rawData = null;
17869
17879
  }
17870
17880
  this.ready = false;
17871
- await this.loadHierarchizedPicker();
17872
- this.displayWhenLoaded();
17873
- //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
17881
+ this.canload = this.isInstanceOfIConf(this.theOptions);
17882
+ if (!this.canload) {
17883
+ this.displayPickerError('Error(s) in the picker configuration!');
17884
+ return;
17885
+ }
17886
+ if (oldValue && JSON.stringify(newValue.options) != JSON.stringify(oldValue.options)) {
17887
+ this.value = [];
17888
+ }
17889
+ if (newValue && newValue.loading == "display") {
17890
+ if ((oldValue && this.isChangeInOptions(newValue, oldValue)) || !oldValue) {
17891
+ await this.loadHierarchizedPicker();
17892
+ this.displayWhenLoaded();
17893
+ }
17894
+ else {
17895
+ this.ready = true;
17896
+ }
17897
+ }
17874
17898
  }
17875
17899
  setNewOptions(newoptions) {
17876
- this.setOptions(JSON.parse(newoptions));
17900
+ if (typeof newoptions == 'string')
17901
+ newoptions = JSON.parse(newoptions);
17902
+ this.setOptions(newoptions);
17877
17903
  }
17878
17904
  setNewFilter(newfilter) {
17879
17905
  this.filterTree(newfilter);
17880
17906
  }
17881
- optionsChange(newValue) {
17907
+ optionsChange(newValue, oldValue) {
17882
17908
  if (!this.theOptions || !this.ready || this.ignoreOptionsChanges) {
17883
17909
  return;
17884
17910
  }
17885
- this.setNewOption(newValue);
17911
+ if (typeof newValue == 'string')
17912
+ newValue = JSON.parse(newValue);
17913
+ this.setNewOption(newValue, oldValue);
17886
17914
  }
17887
17915
  isChangeInOptions(newV, oldV) {
17888
17916
  const isEqual = lodash.isEqual(newV, oldV);
@@ -17985,6 +18013,10 @@ const HierarchizedPickerComponent = class {
17985
18013
  toret = false;
17986
18014
  this.errorToLog = "options.isFullpath value '" + object.isFullpath + "' doesn't meet interface IConf requirements";
17987
18015
  }
18016
+ if (!((!object.defaultValueIsFullpath && typeof object.defaultValueIsFullpath != "boolean") || typeof object.defaultValueIsFullpath == 'boolean')) {
18017
+ toret = false;
18018
+ this.errorToLog = "options.defaultValueIsFullpath value '" + object.defaultValueIsFullpath + "' doesn't meet interface IConf requirements";
18019
+ }
17988
18020
  if (!((!object.showAutocomplete && typeof object.showAutocomplete != 'boolean') || typeof object.showAutocomplete == 'boolean')) {
17989
18021
  toret = false;
17990
18022
  this.errorToLog = "options.showAutocomplete value '" + object.showAutocomplete + "' doesn't meet interface IConf requirements";
@@ -18039,7 +18071,7 @@ const HierarchizedPickerComponent = class {
18039
18071
  return;
18040
18072
  }
18041
18073
  await Promise.all(this.theOptions.defaultValue.map(async (element) => {
18042
- if (!(typeof element == 'number') && !strIsNumeric(element)) {
18074
+ if (this.theOptions.defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
18043
18075
  if (this.theOptions.source !== "webservice") {
18044
18076
  let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
18045
18077
  this.displayPickerError(errormsg);
@@ -18095,6 +18127,8 @@ const HierarchizedPickerComponent = class {
18095
18127
  this.theOptions.displayRootNode = false;
18096
18128
  if (!this.theOptions.dragAndDropEnabled)
18097
18129
  this.theOptions.dragAndDropEnabled = false;
18130
+ if (!this.theOptions.defaultValueIsFullpath)
18131
+ this.theOptions.defaultValueIsFullpath = false;
18098
18132
  if (!this.theOptions.errorsInInput && this.theOptions.errorsInInput !== false)
18099
18133
  this.theOptions.errorsInInput = true;
18100
18134
  }
@@ -82,27 +82,55 @@ export class HierarchizedPickerComponent {
82
82
  });
83
83
  }
84
84
  async setNewOption(newValue, oldValue = null) {
85
- this.canload = true;
85
+ // --------------------------------------- DEPRECATED ?
86
+ // this.canload = true;
87
+ // this.theOptions = newValue;
88
+ // if (this.theOptions.source != "file") {
89
+ // this.rawData = null;
90
+ // }
91
+ // this.ready = false;
92
+ //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
93
+ // ---------------------------------------
86
94
  this.theOptions = newValue;
87
- if (this.theOptions.source != "file") {
95
+ if (((oldValue && (newValue.origin != oldValue.origin
96
+ || newValue.options.StartNodeID != oldValue.options.StartNodeID)) || !oldValue)
97
+ && this.theOptions.source != "file") {
88
98
  this.rawData = null;
89
99
  }
90
100
  this.ready = false;
91
- await this.loadHierarchizedPicker();
92
- this.displayWhenLoaded();
93
- //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
101
+ this.canload = this.isInstanceOfIConf(this.theOptions);
102
+ if (!this.canload) {
103
+ this.displayPickerError('Error(s) in the picker configuration!');
104
+ return;
105
+ }
106
+ if (oldValue && JSON.stringify(newValue.options) != JSON.stringify(oldValue.options)) {
107
+ this.value = [];
108
+ }
109
+ if (newValue && newValue.loading == "display") {
110
+ if ((oldValue && this.isChangeInOptions(newValue, oldValue)) || !oldValue) {
111
+ await this.loadHierarchizedPicker();
112
+ this.displayWhenLoaded();
113
+ }
114
+ else {
115
+ this.ready = true;
116
+ }
117
+ }
94
118
  }
95
119
  setNewOptions(newoptions) {
96
- this.setOptions(JSON.parse(newoptions));
120
+ if (typeof newoptions == 'string')
121
+ newoptions = JSON.parse(newoptions);
122
+ this.setOptions(newoptions);
97
123
  }
98
124
  setNewFilter(newfilter) {
99
125
  this.filterTree(newfilter);
100
126
  }
101
- optionsChange(newValue) {
127
+ optionsChange(newValue, oldValue) {
102
128
  if (!this.theOptions || !this.ready || this.ignoreOptionsChanges) {
103
129
  return;
104
130
  }
105
- this.setNewOption(newValue);
131
+ if (typeof newValue == 'string')
132
+ newValue = JSON.parse(newValue);
133
+ this.setNewOption(newValue, oldValue);
106
134
  }
107
135
  isChangeInOptions(newV, oldV) {
108
136
  const isEqual = _.isEqual(newV, oldV);
@@ -205,6 +233,10 @@ export class HierarchizedPickerComponent {
205
233
  toret = false;
206
234
  this.errorToLog = "options.isFullpath value '" + object.isFullpath + "' doesn't meet interface IConf requirements";
207
235
  }
236
+ if (!((!object.defaultValueIsFullpath && typeof object.defaultValueIsFullpath != "boolean") || typeof object.defaultValueIsFullpath == 'boolean')) {
237
+ toret = false;
238
+ this.errorToLog = "options.defaultValueIsFullpath value '" + object.defaultValueIsFullpath + "' doesn't meet interface IConf requirements";
239
+ }
208
240
  if (!((!object.showAutocomplete && typeof object.showAutocomplete != 'boolean') || typeof object.showAutocomplete == 'boolean')) {
209
241
  toret = false;
210
242
  this.errorToLog = "options.showAutocomplete value '" + object.showAutocomplete + "' doesn't meet interface IConf requirements";
@@ -259,7 +291,7 @@ export class HierarchizedPickerComponent {
259
291
  return;
260
292
  }
261
293
  await Promise.all(this.theOptions.defaultValue.map(async (element) => {
262
- if (!(typeof element == 'number') && !strIsNumeric(element)) {
294
+ if (this.theOptions.defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
263
295
  if (this.theOptions.source !== "webservice") {
264
296
  let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
265
297
  this.displayPickerError(errormsg);
@@ -315,6 +347,8 @@ export class HierarchizedPickerComponent {
315
347
  this.theOptions.displayRootNode = false;
316
348
  if (!this.theOptions.dragAndDropEnabled)
317
349
  this.theOptions.dragAndDropEnabled = false;
350
+ if (!this.theOptions.defaultValueIsFullpath)
351
+ this.theOptions.defaultValueIsFullpath = false;
318
352
  if (!this.theOptions.errorsInInput && this.theOptions.errorsInInput !== false)
319
353
  this.theOptions.errorsInInput = true;
320
354
  }
@@ -17860,27 +17860,55 @@ const HierarchizedPickerComponent = class extends HTMLElement {
17860
17860
  });
17861
17861
  }
17862
17862
  async setNewOption(newValue, oldValue = null) {
17863
- this.canload = true;
17863
+ // --------------------------------------- DEPRECATED ?
17864
+ // this.canload = true;
17865
+ // this.theOptions = newValue;
17866
+ // if (this.theOptions.source != "file") {
17867
+ // this.rawData = null;
17868
+ // }
17869
+ // this.ready = false;
17870
+ //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
17871
+ // ---------------------------------------
17864
17872
  this.theOptions = newValue;
17865
- if (this.theOptions.source != "file") {
17873
+ if (((oldValue && (newValue.origin != oldValue.origin
17874
+ || newValue.options.StartNodeID != oldValue.options.StartNodeID)) || !oldValue)
17875
+ && this.theOptions.source != "file") {
17866
17876
  this.rawData = null;
17867
17877
  }
17868
17878
  this.ready = false;
17869
- await this.loadHierarchizedPicker();
17870
- this.displayWhenLoaded();
17871
- //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
17879
+ this.canload = this.isInstanceOfIConf(this.theOptions);
17880
+ if (!this.canload) {
17881
+ this.displayPickerError('Error(s) in the picker configuration!');
17882
+ return;
17883
+ }
17884
+ if (oldValue && JSON.stringify(newValue.options) != JSON.stringify(oldValue.options)) {
17885
+ this.value = [];
17886
+ }
17887
+ if (newValue && newValue.loading == "display") {
17888
+ if ((oldValue && this.isChangeInOptions(newValue, oldValue)) || !oldValue) {
17889
+ await this.loadHierarchizedPicker();
17890
+ this.displayWhenLoaded();
17891
+ }
17892
+ else {
17893
+ this.ready = true;
17894
+ }
17895
+ }
17872
17896
  }
17873
17897
  setNewOptions(newoptions) {
17874
- this.setOptions(JSON.parse(newoptions));
17898
+ if (typeof newoptions == 'string')
17899
+ newoptions = JSON.parse(newoptions);
17900
+ this.setOptions(newoptions);
17875
17901
  }
17876
17902
  setNewFilter(newfilter) {
17877
17903
  this.filterTree(newfilter);
17878
17904
  }
17879
- optionsChange(newValue) {
17905
+ optionsChange(newValue, oldValue) {
17880
17906
  if (!this.theOptions || !this.ready || this.ignoreOptionsChanges) {
17881
17907
  return;
17882
17908
  }
17883
- this.setNewOption(newValue);
17909
+ if (typeof newValue == 'string')
17910
+ newValue = JSON.parse(newValue);
17911
+ this.setNewOption(newValue, oldValue);
17884
17912
  }
17885
17913
  isChangeInOptions(newV, oldV) {
17886
17914
  const isEqual = lodash.isEqual(newV, oldV);
@@ -17983,6 +18011,10 @@ const HierarchizedPickerComponent = class extends HTMLElement {
17983
18011
  toret = false;
17984
18012
  this.errorToLog = "options.isFullpath value '" + object.isFullpath + "' doesn't meet interface IConf requirements";
17985
18013
  }
18014
+ if (!((!object.defaultValueIsFullpath && typeof object.defaultValueIsFullpath != "boolean") || typeof object.defaultValueIsFullpath == 'boolean')) {
18015
+ toret = false;
18016
+ this.errorToLog = "options.defaultValueIsFullpath value '" + object.defaultValueIsFullpath + "' doesn't meet interface IConf requirements";
18017
+ }
17986
18018
  if (!((!object.showAutocomplete && typeof object.showAutocomplete != 'boolean') || typeof object.showAutocomplete == 'boolean')) {
17987
18019
  toret = false;
17988
18020
  this.errorToLog = "options.showAutocomplete value '" + object.showAutocomplete + "' doesn't meet interface IConf requirements";
@@ -18037,7 +18069,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18037
18069
  return;
18038
18070
  }
18039
18071
  await Promise.all(this.theOptions.defaultValue.map(async (element) => {
18040
- if (!(typeof element == 'number') && !strIsNumeric(element)) {
18072
+ if (this.theOptions.defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
18041
18073
  if (this.theOptions.source !== "webservice") {
18042
18074
  let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
18043
18075
  this.displayPickerError(errormsg);
@@ -18093,6 +18125,8 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18093
18125
  this.theOptions.displayRootNode = false;
18094
18126
  if (!this.theOptions.dragAndDropEnabled)
18095
18127
  this.theOptions.dragAndDropEnabled = false;
18128
+ if (!this.theOptions.defaultValueIsFullpath)
18129
+ this.theOptions.defaultValueIsFullpath = false;
18096
18130
  if (!this.theOptions.errorsInInput && this.theOptions.errorsInInput !== false)
18097
18131
  this.theOptions.errorsInInput = true;
18098
18132
  }
@@ -17858,27 +17858,55 @@ const HierarchizedPickerComponent = class {
17858
17858
  });
17859
17859
  }
17860
17860
  async setNewOption(newValue, oldValue = null) {
17861
- this.canload = true;
17861
+ // --------------------------------------- DEPRECATED ?
17862
+ // this.canload = true;
17863
+ // this.theOptions = newValue;
17864
+ // if (this.theOptions.source != "file") {
17865
+ // this.rawData = null;
17866
+ // }
17867
+ // this.ready = false;
17868
+ //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
17869
+ // ---------------------------------------
17862
17870
  this.theOptions = newValue;
17863
- if (this.theOptions.source != "file") {
17871
+ if (((oldValue && (newValue.origin != oldValue.origin
17872
+ || newValue.options.StartNodeID != oldValue.options.StartNodeID)) || !oldValue)
17873
+ && this.theOptions.source != "file") {
17864
17874
  this.rawData = null;
17865
17875
  }
17866
17876
  this.ready = false;
17867
- await this.loadHierarchizedPicker();
17868
- this.displayWhenLoaded();
17869
- //NOTE: This could work in a synchronous environment => this.reloadCurrentValues();
17877
+ this.canload = this.isInstanceOfIConf(this.theOptions);
17878
+ if (!this.canload) {
17879
+ this.displayPickerError('Error(s) in the picker configuration!');
17880
+ return;
17881
+ }
17882
+ if (oldValue && JSON.stringify(newValue.options) != JSON.stringify(oldValue.options)) {
17883
+ this.value = [];
17884
+ }
17885
+ if (newValue && newValue.loading == "display") {
17886
+ if ((oldValue && this.isChangeInOptions(newValue, oldValue)) || !oldValue) {
17887
+ await this.loadHierarchizedPicker();
17888
+ this.displayWhenLoaded();
17889
+ }
17890
+ else {
17891
+ this.ready = true;
17892
+ }
17893
+ }
17870
17894
  }
17871
17895
  setNewOptions(newoptions) {
17872
- this.setOptions(JSON.parse(newoptions));
17896
+ if (typeof newoptions == 'string')
17897
+ newoptions = JSON.parse(newoptions);
17898
+ this.setOptions(newoptions);
17873
17899
  }
17874
17900
  setNewFilter(newfilter) {
17875
17901
  this.filterTree(newfilter);
17876
17902
  }
17877
- optionsChange(newValue) {
17903
+ optionsChange(newValue, oldValue) {
17878
17904
  if (!this.theOptions || !this.ready || this.ignoreOptionsChanges) {
17879
17905
  return;
17880
17906
  }
17881
- this.setNewOption(newValue);
17907
+ if (typeof newValue == 'string')
17908
+ newValue = JSON.parse(newValue);
17909
+ this.setNewOption(newValue, oldValue);
17882
17910
  }
17883
17911
  isChangeInOptions(newV, oldV) {
17884
17912
  const isEqual = lodash.isEqual(newV, oldV);
@@ -17981,6 +18009,10 @@ const HierarchizedPickerComponent = class {
17981
18009
  toret = false;
17982
18010
  this.errorToLog = "options.isFullpath value '" + object.isFullpath + "' doesn't meet interface IConf requirements";
17983
18011
  }
18012
+ if (!((!object.defaultValueIsFullpath && typeof object.defaultValueIsFullpath != "boolean") || typeof object.defaultValueIsFullpath == 'boolean')) {
18013
+ toret = false;
18014
+ this.errorToLog = "options.defaultValueIsFullpath value '" + object.defaultValueIsFullpath + "' doesn't meet interface IConf requirements";
18015
+ }
17984
18016
  if (!((!object.showAutocomplete && typeof object.showAutocomplete != 'boolean') || typeof object.showAutocomplete == 'boolean')) {
17985
18017
  toret = false;
17986
18018
  this.errorToLog = "options.showAutocomplete value '" + object.showAutocomplete + "' doesn't meet interface IConf requirements";
@@ -18035,7 +18067,7 @@ const HierarchizedPickerComponent = class {
18035
18067
  return;
18036
18068
  }
18037
18069
  await Promise.all(this.theOptions.defaultValue.map(async (element) => {
18038
- if (!(typeof element == 'number') && !strIsNumeric(element)) {
18070
+ if (this.theOptions.defaultValueIsFullpath || (!(typeof element == 'number') && !strIsNumeric(element))) {
18039
18071
  if (this.theOptions.source !== "webservice") {
18040
18072
  let errormsg = 'The loading of nodes based on fullpath is only available on webservice mode for now!';
18041
18073
  this.displayPickerError(errormsg);
@@ -18091,6 +18123,8 @@ const HierarchizedPickerComponent = class {
18091
18123
  this.theOptions.displayRootNode = false;
18092
18124
  if (!this.theOptions.dragAndDropEnabled)
18093
18125
  this.theOptions.dragAndDropEnabled = false;
18126
+ if (!this.theOptions.defaultValueIsFullpath)
18127
+ this.theOptions.defaultValueIsFullpath = false;
18094
18128
  if (!this.theOptions.errorsInInput && this.theOptions.errorsInInput !== false)
18095
18129
  this.theOptions.errorsInInput = true;
18096
18130
  }