@smartbit4all/ng-client 7.3.15 → 7.3.17

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.
@@ -7632,12 +7632,11 @@ class SmartFormService {
7632
7632
  }
7633
7633
  applyComponentConstraints(widgets, constraints) {
7634
7634
  widgets.forEach((widget) => {
7635
- let widgetConstraints = constraints?.filter(
7636
- //(constraint: SmartFormComponentConstraint) => constraint.dataName === widget.key
7637
- (constraint) => this.antPathMatcher(constraint.dataName, widget.key));
7635
+ let widgetConstraints = constraints?.filter((constraint) => this.antPathMatcher(constraint.dataName, widget.key));
7638
7636
  if (widgetConstraints && widgetConstraints.length) {
7639
7637
  widgetConstraints.forEach((constraint) => {
7640
- if (constraint.visible === undefined) {
7638
+ // null or undefined: not specified, keep what earlier constraints (or the layout) set
7639
+ if (constraint.visible == null) {
7641
7640
  if (widget.isVisible === undefined) {
7642
7641
  widget.isVisible = true;
7643
7642
  }
@@ -7660,10 +7659,10 @@ class SmartFormService {
7660
7659
  let requiredIndex = validators.findIndex((v) => v.validator === Validators.required);
7661
7660
  let wasMandatory = requiredIndex >= 0;
7662
7661
  let tobeMandatory = false;
7663
- if (constraint.mandatory === undefined) {
7664
- // not specified on server, use client state
7665
- // if widget is not visible, client should default to not mandatory
7666
- tobeMandatory = widget.isVisible && wasMandatory;
7662
+ if (constraint.mandatory == null) {
7663
+ // not specified: keep the state left by earlier constraints or the layout;
7664
+ // a hidden widget is not mandatory unless a constraint says so
7665
+ tobeMandatory = !!widget.isVisible && wasMandatory;
7667
7666
  }
7668
7667
  else {
7669
7668
  tobeMandatory = constraint.mandatory;
@@ -7692,7 +7691,7 @@ class SmartFormService {
7692
7691
  }
7693
7692
  this.addEmptyItemToValueList(widget, emptyLabel);
7694
7693
  }
7695
- if (constraint.enabled === undefined || constraint.enabled === null) {
7694
+ if (constraint.enabled == null) {
7696
7695
  if (widget.isDisabled === undefined) {
7697
7696
  widget.isDisabled = false;
7698
7697
  }
@@ -10206,8 +10205,8 @@ class SmartformwidgetComponent {
10206
10205
  }
10207
10206
  onTimePickerBlur(event) {
10208
10207
  event.stopPropagation();
10208
+ this.handleTimeChanged(this.form().controls[`${this.widgetInstance.key}-time`].value, true);
10209
10209
  this.handleBlurEvent(this.widgetInstance);
10210
- this.handleTimeChanged(this.form().controls[`${this.widgetInstance.key}-time`].value);
10211
10210
  }
10212
10211
  ngAfterViewInit() {
10213
10212
  if (this.widgetInstance.type === SmartFormWidgetType.COMPONENT) {
@@ -10265,7 +10264,7 @@ class SmartformwidgetComponent {
10265
10264
  this.widgetInstance.value = dateFormControl.value;
10266
10265
  }
10267
10266
  }
10268
- handleTimeChanged(timeValue) {
10267
+ handleTimeChanged(timeValue, fromBlur = false) {
10269
10268
  const isFocused = document.activeElement === this.timeInputChild?.nativeElement;
10270
10269
  const dateFormControl = this.form().controls[this.widgetInstance.key];
10271
10270
  const timeFormControl = this.form().controls[`${this.widgetInstance.key}-time`];
@@ -10280,9 +10279,9 @@ class SmartformwidgetComponent {
10280
10279
  timeValue) {
10281
10280
  dateFormControl.setValidators(Validators.required);
10282
10281
  }
10283
- // if (isFocused) {
10284
- // return;
10285
- // }
10282
+ if (isFocused && !fromBlur) {
10283
+ return;
10284
+ }
10286
10285
  if (this.hasJustChanged) {
10287
10286
  this.hasJustChanged = false;
10288
10287
  return;
@@ -24378,7 +24377,6 @@ class SmartFilterParamsComponent {
24378
24377
  this.setUp(this.service().model);
24379
24378
  });
24380
24379
  this.setUp(this.service().model);
24381
- console.log(this.service().model);
24382
24380
  }
24383
24381
  ngOnDestroy() {
24384
24382
  this._destroy$.next();