@smartbit4all/ng-client 4.1.4 → 4.1.5

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.
@@ -4044,6 +4044,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
4044
4044
  class SmartFormService {
4045
4045
  constructor() {
4046
4046
  this.emptyKey = 'e#m%p@t*y';
4047
+ this.componentLibrary = ComponentLibrary;
4047
4048
  this.group = {};
4048
4049
  this.regexRegexChars = new RegExp(/[\.\-\[\]\/\{\}\(\)\+\^\$\\\|]/g);
4049
4050
  this.regexAsteriskInTheMiddle = new RegExp(/([^\*])\*([^\*])/g);
@@ -4164,7 +4165,7 @@ class SmartFormService {
4164
4165
  });
4165
4166
  return properties;
4166
4167
  }
4167
- setValuesFromModel(widgets) {
4168
+ setValuesFromModel(widgets, compLib) {
4168
4169
  const smartForm = this.smartForm;
4169
4170
  const data = smartForm.componentModel?.data;
4170
4171
  if (!data) {
@@ -4183,6 +4184,16 @@ class SmartFormService {
4183
4184
  if (typeof value === 'boolean' && widget.type !== SmartFormWidgetType.TOGGLE) {
4184
4185
  value = `${value}`;
4185
4186
  }
4187
+ if (compLib === this.componentLibrary.PRIMENG) {
4188
+ if (widget.type === SmartFormWidgetType.DATE_PICKER) {
4189
+ if (value) {
4190
+ widget.value = new Date(value);
4191
+ }
4192
+ else {
4193
+ widget.value = new Date();
4194
+ }
4195
+ }
4196
+ }
4186
4197
  if (widget.type !== SmartFormWidgetType.INDICATOR &&
4187
4198
  widget.type !== SmartFormWidgetType.LABEL &&
4188
4199
  widget.type !== SmartFormWidgetType.CONTAINER &&
@@ -6701,8 +6712,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
6701
6712
  }] } });
6702
6713
 
6703
6714
  class SmartformComponent {
6704
- constructor(service) {
6715
+ constructor(service, compLib) {
6705
6716
  this.service = service;
6717
+ this.compLib = compLib;
6706
6718
  this._destroy$ = new Subject();
6707
6719
  this.originalWidgets = [];
6708
6720
  this.sophisticatedValueChange = new SmartSubject(this._destroy$);
@@ -6749,7 +6761,7 @@ class SmartformComponent {
6749
6761
  if (!this.originalWidgets || this.originalWidgets.length === 0) {
6750
6762
  this.originalWidgets = this.smartForm.widgets;
6751
6763
  }
6752
- this.service.setValuesFromModel(this.originalWidgets);
6764
+ this.service.setValuesFromModel(this.originalWidgets, this.compLib);
6753
6765
  this.service.applyConstraints(this.originalWidgets);
6754
6766
  this.smartForm.widgets = this.service.filterWidgetsByVisibility(this.originalWidgets);
6755
6767
  this.form = this.service.toFormGroup();
@@ -6855,13 +6867,16 @@ class SmartformComponent {
6855
6867
  }
6856
6868
  return [];
6857
6869
  }
6858
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartformComponent, deps: [{ token: SmartFormService }], target: i0.ɵɵFactoryTarget.Component }); }
6870
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartformComponent, deps: [{ token: SmartFormService }, { token: COMPONENT_LIBRARY }], target: i0.ɵɵFactoryTarget.Component }); }
6859
6871
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: SmartformComponent, selector: "smartform", inputs: { smartForm: "smartForm" }, providers: [SmartFormService], viewQueries: [{ propertyName: "smartWidgetsQL", predicate: SmartformwidgetComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<form *ngIf=\"smartForm\" (keydown)=\"keyDownFunction($event)\" [formGroup]=\"form\" class=\"flex form\">\r\n <h2 *ngIf=\"smartForm.name\">\r\n {{ smartForm.name }}\r\n </h2>\r\n <div [ngClass]=\"smartForm.direction === direction.ROW ? 'row' : 'col'\">\r\n <div *ngFor=\"let widget of smartForm.widgets\" class=\"item\">\r\n <smartformwidget\r\n *ngIf=\"widget.isVisible === undefined ? true : widget.isVisible\"\r\n [widgetInstance]=\"widget\"\r\n [form]=\"form\"\r\n class=\"grid-item\"\r\n [onBlur]=\"onBlurSubject\"\r\n [onValueChange]=\"onValueChangeSubject\"\r\n [sophisticatedValueChange]=\"sophisticatedValueChange\"\r\n class=\"{{ widget.key }}\"\r\n [labelColor]=\"smartForm.labelTheme\"\r\n ></smartformwidget>\r\n </div>\r\n </div>\r\n</form>\r\n", styles: [".col{display:flex;flex-direction:column;gap:.25em}.row{display:flex;flex-wrap:wrap;gap:.25em}.grid-item{text-align:left}.item{flex:1}.item ::ng-deep .p-inputtext{width:100%!important;min-height:45px!important}.item ::ng-deep p-inputnumber,.item ::ng-deep .p-inputnumber{width:100%!important;height:45px!important}.item ::ng-deep .p-dropdown,.item ::ng-deep .p-multiselect{width:100%!important;height:45px!important}.item ::ng-deep p-overlay{z-index:1002}.item ::ng-deep .p-chips{width:100%!important;height:45px!important}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i10.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i10.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i10.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: SmartformwidgetComponent, selector: "smartformwidget", inputs: ["form", "widgetInstance", "onBlur", "onValueChange", "labelColor", "sophisticatedValueChange"] }] }); }
6860
6872
  }
6861
6873
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: SmartformComponent, decorators: [{
6862
6874
  type: Component,
6863
6875
  args: [{ selector: 'smartform', providers: [SmartFormService], template: "<form *ngIf=\"smartForm\" (keydown)=\"keyDownFunction($event)\" [formGroup]=\"form\" class=\"flex form\">\r\n <h2 *ngIf=\"smartForm.name\">\r\n {{ smartForm.name }}\r\n </h2>\r\n <div [ngClass]=\"smartForm.direction === direction.ROW ? 'row' : 'col'\">\r\n <div *ngFor=\"let widget of smartForm.widgets\" class=\"item\">\r\n <smartformwidget\r\n *ngIf=\"widget.isVisible === undefined ? true : widget.isVisible\"\r\n [widgetInstance]=\"widget\"\r\n [form]=\"form\"\r\n class=\"grid-item\"\r\n [onBlur]=\"onBlurSubject\"\r\n [onValueChange]=\"onValueChangeSubject\"\r\n [sophisticatedValueChange]=\"sophisticatedValueChange\"\r\n class=\"{{ widget.key }}\"\r\n [labelColor]=\"smartForm.labelTheme\"\r\n ></smartformwidget>\r\n </div>\r\n </div>\r\n</form>\r\n", styles: [".col{display:flex;flex-direction:column;gap:.25em}.row{display:flex;flex-wrap:wrap;gap:.25em}.grid-item{text-align:left}.item{flex:1}.item ::ng-deep .p-inputtext{width:100%!important;min-height:45px!important}.item ::ng-deep p-inputnumber,.item ::ng-deep .p-inputnumber{width:100%!important;height:45px!important}.item ::ng-deep .p-dropdown,.item ::ng-deep .p-multiselect{width:100%!important;height:45px!important}.item ::ng-deep p-overlay{z-index:1002}.item ::ng-deep .p-chips{width:100%!important;height:45px!important}\n"] }]
6864
- }], ctorParameters: () => [{ type: SmartFormService }], propDecorators: { smartForm: [{
6876
+ }], ctorParameters: () => [{ type: SmartFormService }, { type: ComponentLibrary, decorators: [{
6877
+ type: Inject,
6878
+ args: [COMPONENT_LIBRARY]
6879
+ }] }], propDecorators: { smartForm: [{
6865
6880
  type: Input
6866
6881
  }], smartWidgetsQL: [{
6867
6882
  type: ViewChildren,