@smartbit4all/ng-client 4.0.129 → 4.0.130

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.
@@ -6032,46 +6032,48 @@ class SmartformwidgetComponent {
6032
6032
  if (this.widgetInstance.type === SmartFormWidgetType.COMPONENT) {
6033
6033
  this.customComponentRef = this.cfService.createComponent(this.customComponentVcRef, this.widgetInstance.component, this.widgetInstance.input);
6034
6034
  }
6035
- if (this.widgetInstance.type === SmartFormWidgetType.DATE_TIME_PICKER ||
6036
- this.widgetInstance.type === SmartFormWidgetType.MONTH_PICKER) {
6037
- this.isDatePickerRequired = !!this.widgetInstance.validators?.some((smartValidator) => smartValidator.validator === Validators.required);
6038
- let time;
6039
- if (this.widgetInstance.value) {
6040
- let date = new Date(this.widgetInstance.value);
6041
- let hour = SmartWidgetSettings.useUtc ? date.getUTCHours() : date.getHours();
6042
- let min = SmartWidgetSettings.useUtc ? date.getUTCMinutes() : date.getMinutes();
6043
- time = String(hour).padStart(2, '0') + ':' + String(min).padStart(2, '0');
6044
- this.widgetInstance.value = moment(date);
6045
- const dateFormControl = this.form.controls[this.widgetInstance.key];
6046
- if (dateFormControl) {
6047
- dateFormControl.setValue(this.widgetInstance.value);
6035
+ if (this.compLib === this.componentLibrary.MATERIAL) {
6036
+ if (this.widgetInstance.type === SmartFormWidgetType.DATE_TIME_PICKER ||
6037
+ this.widgetInstance.type === SmartFormWidgetType.MONTH_PICKER) {
6038
+ this.isDatePickerRequired = !!this.widgetInstance.validators?.some((smartValidator) => smartValidator.validator === Validators.required);
6039
+ let time;
6040
+ if (this.widgetInstance.value) {
6041
+ let date = new Date(this.widgetInstance.value);
6042
+ let hour = SmartWidgetSettings.useUtc ? date.getUTCHours() : date.getHours();
6043
+ let min = SmartWidgetSettings.useUtc ? date.getUTCMinutes() : date.getMinutes();
6044
+ time = String(hour).padStart(2, '0') + ':' + String(min).padStart(2, '0');
6045
+ this.widgetInstance.value = moment(date);
6046
+ const dateFormControl = this.form.controls[this.widgetInstance.key];
6047
+ if (dateFormControl) {
6048
+ dateFormControl.setValue(this.widgetInstance.value);
6049
+ }
6048
6050
  }
6049
- }
6050
- else {
6051
- time = '';
6052
- }
6053
- let validators = [];
6054
- if (this.widgetInstance.validators) {
6055
- validators = this.widgetInstance.validators?.map((validator) => {
6056
- return validator.validator;
6051
+ else {
6052
+ time = '';
6053
+ }
6054
+ let validators = [];
6055
+ if (this.widgetInstance.validators) {
6056
+ validators = this.widgetInstance.validators?.map((validator) => {
6057
+ return validator.validator;
6058
+ });
6059
+ }
6060
+ const timeFormControl = new UntypedFormControl(time, validators);
6061
+ if (this.widgetInstance.isDisabled) {
6062
+ timeFormControl.disable();
6063
+ }
6064
+ this.form.addControl(`${this.widgetInstance.key}-time`, timeFormControl);
6065
+ this.hasCreated = true;
6066
+ this.form.controls[this.widgetInstance.key].valueChanges
6067
+ .pipe(takeUntil(this._destroy$))
6068
+ .subscribe((_moment) => {
6069
+ this.handleDateChanged(_moment);
6070
+ });
6071
+ this.form.controls[`${this.widgetInstance.key}-time`].valueChanges
6072
+ .pipe(takeUntil(this._destroy$))
6073
+ .subscribe((timeValue) => {
6074
+ this.handleTimeChanged(timeValue);
6057
6075
  });
6058
6076
  }
6059
- const timeFormControl = new UntypedFormControl(time, validators);
6060
- if (this.widgetInstance.isDisabled) {
6061
- timeFormControl.disable();
6062
- }
6063
- this.form.addControl(`${this.widgetInstance.key}-time`, timeFormControl);
6064
- this.hasCreated = true;
6065
- this.form.controls[this.widgetInstance.key].valueChanges
6066
- .pipe(takeUntil(this._destroy$))
6067
- .subscribe((_moment) => {
6068
- this.handleDateChanged(_moment);
6069
- });
6070
- this.form.controls[`${this.widgetInstance.key}-time`].valueChanges
6071
- .pipe(takeUntil(this._destroy$))
6072
- .subscribe((timeValue) => {
6073
- this.handleTimeChanged(timeValue);
6074
- });
6075
6077
  }
6076
6078
  }
6077
6079
  handleDateChanged(_moment) {