@sumaris-net/ngx-components 2.4.73 → 2.4.75

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.
@@ -3680,6 +3680,23 @@ class SharedValidators {
3680
3680
  return null;
3681
3681
  };
3682
3682
  }
3683
+ /**
3684
+ * Check precision. e.g. if precision=0.5 then value=0.6 is invalid
3685
+ * @param precision
3686
+ */
3687
+ static precision(precision) {
3688
+ if (precision)
3689
+ return (control) => {
3690
+ const value = control.value;
3691
+ if (isNil(value) || Number.isNaN(value)) {
3692
+ return null;
3693
+ }
3694
+ if (value % precision !== 0) {
3695
+ return { precision: { precision } };
3696
+ }
3697
+ return null;
3698
+ };
3699
+ }
3683
3700
  static validDate(control) {
3684
3701
  const value = control.value;
3685
3702
  const date = !value || isMoment(value) ? value : DateUtils.moment(value, DATE_ISO_PATTERN);
@@ -13828,7 +13845,7 @@ class LocalSettingsService extends StartableService {
13828
13845
  this.onChange.next(data);
13829
13846
  return data;
13830
13847
  }
13831
- setProperty(keyOrDef, value) {
13848
+ setProperty(keyOrDef, value, opts) {
13832
13849
  if (!this._data || !keyOrDef)
13833
13850
  return;
13834
13851
  if (typeof keyOrDef === 'object') {
@@ -13837,6 +13854,10 @@ class LocalSettingsService extends StartableService {
13837
13854
  }
13838
13855
  this._data.properties = this._data.properties || {};
13839
13856
  this._data.properties[keyOrDef] = isNil(value) ? undefined : value.toString();
13857
+ // Update local settings
13858
+ if (!opts || opts.emitEvent !== false) {
13859
+ this.persistLocally(opts?.immediate);
13860
+ }
13840
13861
  }
13841
13862
  getProperty(keyOrDef, defaultValue) {
13842
13863
  if (typeof keyOrDef === 'object') {