@sumaris-net/ngx-components 2.4.8 → 2.4.9

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.
@@ -13322,7 +13322,7 @@ const DEFAULT_SETTINGS = {
13322
13322
  const APP_LOCAL_SETTINGS = new InjectionToken('DefaultLocalSettings');
13323
13323
  const APP_LOCAL_SETTINGS_OPTIONS = new InjectionToken('LocalSettingsOptions');
13324
13324
  class LocalSettingsService extends StartableService {
13325
- constructor(translate, platform, storage, environment, defaultSettings, defaultOptionsMap) {
13325
+ constructor(translate, platform, storage, environment, defaultSettings, options) {
13326
13326
  super(platform);
13327
13327
  this.translate = translate;
13328
13328
  this.platform = platform;
@@ -13331,7 +13331,8 @@ class LocalSettingsService extends StartableService {
13331
13331
  this.defaultSettings = defaultSettings;
13332
13332
  this.onChange = new Subject();
13333
13333
  this.defaultSettings = { ...DEFAULT_SETTINGS, ...this.defaultSettings };
13334
- this._optionDefs = Object.values(defaultOptionsMap);
13334
+ this._optionDefs = Object.values(options?.options || {});
13335
+ this._serializeAsString = options?.serializeAsString || false;
13335
13336
  this.resetData();
13336
13337
  this._debug = !environment.production;
13337
13338
  if (this._debug)
@@ -13676,6 +13677,10 @@ class LocalSettingsService extends StartableService {
13676
13677
  }
13677
13678
  else {
13678
13679
  console.debug('[settings] Store local settings', this._data);
13680
+ if (this._serializeAsString) {
13681
+ // Fix serialization error, in Sumaris-App
13682
+ return this.storage.set(SETTINGS_STORAGE_KEY, JSON.stringify(this._data));
13683
+ }
13679
13684
  return this.storage.set(SETTINGS_STORAGE_KEY, this._data);
13680
13685
  }
13681
13686
  }