reneco-hierarchized-picker 0.5.13 → 0.5.14

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.
@@ -18903,6 +18903,8 @@ const HierarchizedPickerComponent = class {
18903
18903
  newValue = JSON.parse(newValue);
18904
18904
  if (typeof oldValue == 'string')
18905
18905
  oldValue = JSON.parse(oldValue);
18906
+ const savedValue = [...this.value];
18907
+ const shouldRestoreValue = !newValue.defaultValue || (Array.isArray(newValue.defaultValue) && newValue.defaultValue.length === 0);
18906
18908
  this.value = [];
18907
18909
  this.optionsManager.updateOptions(newValue);
18908
18910
  this.setDisplayedValue(this.value);
@@ -18932,7 +18934,6 @@ const HierarchizedPickerComponent = class {
18932
18934
  const filteredDiffs = propDiffs.filter(prop => !ignoredProps.includes(prop));
18933
18935
  if (filteredDiffs.length > 0) {
18934
18936
  if (filteredDiffs.every(item => noReloadProps.includes(item))) {
18935
- const savedValue = [...this.value];
18936
18937
  filteredDiffs.forEach(propChanged => {
18937
18938
  switch (propChanged) {
18938
18939
  case "multiple":
@@ -18940,7 +18941,7 @@ const HierarchizedPickerComponent = class {
18940
18941
  if (this.loadedTreeJs && !this.theOptions.multiple) {
18941
18942
  this.clearPicker();
18942
18943
  }
18943
- else if (this.loadedTreeJs && this.theOptions.multiple) {
18944
+ else if (this.loadedTreeJs && this.theOptions.multiple && shouldRestoreValue && savedValue.length > 0) {
18944
18945
  this.value = savedValue;
18945
18946
  this.setDisplayedValue(this.value);
18946
18947
  }
@@ -167,6 +167,8 @@ export class HierarchizedPickerComponent {
167
167
  newValue = JSON.parse(newValue);
168
168
  if (typeof oldValue == 'string')
169
169
  oldValue = JSON.parse(oldValue);
170
+ const savedValue = [...this.value];
171
+ const shouldRestoreValue = !newValue.defaultValue || (Array.isArray(newValue.defaultValue) && newValue.defaultValue.length === 0);
170
172
  this.value = [];
171
173
  this.optionsManager.updateOptions(newValue);
172
174
  this.setDisplayedValue(this.value);
@@ -196,7 +198,6 @@ export class HierarchizedPickerComponent {
196
198
  const filteredDiffs = propDiffs.filter(prop => !ignoredProps.includes(prop));
197
199
  if (filteredDiffs.length > 0) {
198
200
  if (filteredDiffs.every(item => noReloadProps.includes(item))) {
199
- const savedValue = [...this.value];
200
201
  filteredDiffs.forEach(propChanged => {
201
202
  switch (propChanged) {
202
203
  case "multiple":
@@ -204,7 +205,7 @@ export class HierarchizedPickerComponent {
204
205
  if (this.loadedTreeJs && !this.theOptions.multiple) {
205
206
  this.clearPicker();
206
207
  }
207
- else if (this.loadedTreeJs && this.theOptions.multiple) {
208
+ else if (this.loadedTreeJs && this.theOptions.multiple && shouldRestoreValue && savedValue.length > 0) {
208
209
  this.value = savedValue;
209
210
  this.setDisplayedValue(this.value);
210
211
  }
@@ -18900,6 +18900,8 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18900
18900
  newValue = JSON.parse(newValue);
18901
18901
  if (typeof oldValue == 'string')
18902
18902
  oldValue = JSON.parse(oldValue);
18903
+ const savedValue = [...this.value];
18904
+ const shouldRestoreValue = !newValue.defaultValue || (Array.isArray(newValue.defaultValue) && newValue.defaultValue.length === 0);
18903
18905
  this.value = [];
18904
18906
  this.optionsManager.updateOptions(newValue);
18905
18907
  this.setDisplayedValue(this.value);
@@ -18929,7 +18931,6 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18929
18931
  const filteredDiffs = propDiffs.filter(prop => !ignoredProps.includes(prop));
18930
18932
  if (filteredDiffs.length > 0) {
18931
18933
  if (filteredDiffs.every(item => noReloadProps.includes(item))) {
18932
- const savedValue = [...this.value];
18933
18934
  filteredDiffs.forEach(propChanged => {
18934
18935
  switch (propChanged) {
18935
18936
  case "multiple":
@@ -18937,7 +18938,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18937
18938
  if (this.loadedTreeJs && !this.theOptions.multiple) {
18938
18939
  this.clearPicker();
18939
18940
  }
18940
- else if (this.loadedTreeJs && this.theOptions.multiple) {
18941
+ else if (this.loadedTreeJs && this.theOptions.multiple && shouldRestoreValue && savedValue.length > 0) {
18941
18942
  this.value = savedValue;
18942
18943
  this.setDisplayedValue(this.value);
18943
18944
  }
@@ -18899,6 +18899,8 @@ const HierarchizedPickerComponent = class {
18899
18899
  newValue = JSON.parse(newValue);
18900
18900
  if (typeof oldValue == 'string')
18901
18901
  oldValue = JSON.parse(oldValue);
18902
+ const savedValue = [...this.value];
18903
+ const shouldRestoreValue = !newValue.defaultValue || (Array.isArray(newValue.defaultValue) && newValue.defaultValue.length === 0);
18902
18904
  this.value = [];
18903
18905
  this.optionsManager.updateOptions(newValue);
18904
18906
  this.setDisplayedValue(this.value);
@@ -18928,7 +18930,6 @@ const HierarchizedPickerComponent = class {
18928
18930
  const filteredDiffs = propDiffs.filter(prop => !ignoredProps.includes(prop));
18929
18931
  if (filteredDiffs.length > 0) {
18930
18932
  if (filteredDiffs.every(item => noReloadProps.includes(item))) {
18931
- const savedValue = [...this.value];
18932
18933
  filteredDiffs.forEach(propChanged => {
18933
18934
  switch (propChanged) {
18934
18935
  case "multiple":
@@ -18936,7 +18937,7 @@ const HierarchizedPickerComponent = class {
18936
18937
  if (this.loadedTreeJs && !this.theOptions.multiple) {
18937
18938
  this.clearPicker();
18938
18939
  }
18939
- else if (this.loadedTreeJs && this.theOptions.multiple) {
18940
+ else if (this.loadedTreeJs && this.theOptions.multiple && shouldRestoreValue && savedValue.length > 0) {
18940
18941
  this.value = savedValue;
18941
18942
  this.setDisplayedValue(this.value);
18942
18943
  }