mmhglobal-dynamicform 2.0.1 → 2.0.3

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.
@@ -472,6 +472,12 @@ class FieldBase {
472
472
  this.setRequire = (status) => {
473
473
  this.componentProperties.isRequired = status;
474
474
  ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, Validators.required);
475
+ if (this.data.Type === 'ztexteditor') {
476
+ ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
477
+ }
478
+ else {
479
+ ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
480
+ }
475
481
  };
476
482
  }
477
483
  initComponent() {
@@ -2743,6 +2749,8 @@ class MainService {
2743
2749
  }
2744
2750
  if (!fg.valid) {
2745
2751
  this.componentErrorHandler.showFormGroupErrorMessage(group, fg);
2752
+ fg.markAsTouched();
2753
+ fg.markAllAsTouched();
2746
2754
  return false;
2747
2755
  }
2748
2756
  return true;
@@ -7484,7 +7492,7 @@ class ZtextareaComponent extends InputFieldBase {
7484
7492
  super.focusOnDefault(this.focus.bind(this));
7485
7493
  }
7486
7494
  setCharCounterDisplayStr() {
7487
- const characterCount = this.group.zModel[this.data.Value]?.length || 0;
7495
+ const characterCount = ZComponentHelper.getValueWithoutContinuousSpaces(this.group.zModel[this.data.Value]).length;
7488
7496
  this.charCounterDisplayStr = `${characterCount} ${this.data.MaxLength ? (' / ' + this.data.MaxLength) : ''}`;
7489
7497
  }
7490
7498
  onChange(event, fieldValue) {
@@ -8969,6 +8977,12 @@ class ZgridComponent extends DataListingFieldBase {
8969
8977
  const validators = [];
8970
8978
  if (col.IsRequired) {
8971
8979
  validators.push(Validators.required);
8980
+ if (col.Type === 'ztexteditor') {
8981
+ validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
8982
+ }
8983
+ else {
8984
+ validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
8985
+ }
8972
8986
  }
8973
8987
  if (col.ValidatorPattern) {
8974
8988
  validators.push(Validators.pattern(col.ValidatorPattern));
@@ -9036,6 +9050,12 @@ class ZgridComponent extends DataListingFieldBase {
9036
9050
  const validators = [];
9037
9051
  if (col.IsRequired) {
9038
9052
  validators.push(Validators.required);
9053
+ if (col.Type === 'ztexteditor') {
9054
+ validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
9055
+ }
9056
+ else {
9057
+ validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
9058
+ }
9039
9059
  }
9040
9060
  if (col.ValidatorPattern) {
9041
9061
  validators.push(Validators.pattern(col.ValidatorPattern));
@@ -11607,6 +11627,12 @@ class ZudfComponent {
11607
11627
  this.setRequire = (status) => {
11608
11628
  this.componentProperties.isRequired = status;
11609
11629
  ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, Validators.required);
11630
+ if (this.data.Type === 'ztexteditor') {
11631
+ ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
11632
+ }
11633
+ else {
11634
+ ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
11635
+ }
11610
11636
  };
11611
11637
  }
11612
11638
  ngOnInit() {
@@ -11807,7 +11833,7 @@ class ZudfComponent {
11807
11833
  }
11808
11834
  else {
11809
11835
  // before generate FormControl, we need to add 2 attribute to the field when render.
11810
- // this for later on, we can easily know this field belong to which zudf and under which container.
11836
+ // this for later on, we can easily know this field belong to which zudf and under which container.
11811
11837
  if (containerName) {
11812
11838
  field['containerName'] = containerName;
11813
11839
  ;
@@ -11826,7 +11852,7 @@ class ZudfComponent {
11826
11852
  zudfGroup[containerName].push(field.Value);
11827
11853
  }
11828
11854
  }
11829
- // set the list of dropdown option to the variable
11855
+ // set the list of dropdown option to the variable
11830
11856
  if (this.isDropdownType(field.Type) && field.ZDataOptionName && field.DropdownOptions) {
11831
11857
  this.group.zData[field.ZDataOptionName] = Object.assign([], eval('this.' + field.DropdownOptions));
11832
11858
  }
@@ -11849,7 +11875,7 @@ class ZudfComponent {
11849
11875
  if (!zudfGroup['fieldRequiredDefaultUser']) {
11850
11876
  zudfGroup['fieldRequiredDefaultUser'] = [];
11851
11877
  }
11852
- // keep a list of default user need to be filled in the scope
11878
+ // keep a list of default user need to be filled in the scope
11853
11879
  zudfGroup['fieldRequiredDefaultUser'].push({
11854
11880
  fieldName: field.Name,
11855
11881
  childFields: field.ChildFields
@@ -11959,7 +11985,7 @@ class ZudfComponent {
11959
11985
  updatedModelData[prefixedPropertyName] = updatedNestedObject;
11960
11986
  }
11961
11987
  else {
11962
- // Add the property to the output object with the component prefix
11988
+ // Add the property to the output object with the component prefix
11963
11989
  let prefixedPropertyName;
11964
11990
  if (containerPrefix) {
11965
11991
  prefixedPropertyName = `${this.componentPrefix}_${containerPrefix}_${propertyName}`;
@@ -12194,7 +12220,7 @@ class ZudfComponent {
12194
12220
  }
12195
12221
  }
12196
12222
  clearContainerRelatedFieldValue(group, containerName) {
12197
- // after set to grid, clear the zmodel.
12223
+ // after set to grid, clear the zmodel.
12198
12224
  this.clearContainerFieldElementValue(containerName);
12199
12225
  }
12200
12226
  removeGridRow(gridValue, gridDataSource, dataItem, index) {
@@ -12248,8 +12274,10 @@ class ZudfComponent {
12248
12274
  }
12249
12275
  // if container but not multi value group = true, we skip it.
12250
12276
  const container = [controlNameSegments[0], controlNameSegments[1], controlNameSegments[2]].join('_');
12251
- if (!this.group['mvglist'].includes(container)) {
12252
- return;
12277
+ if (this.group['mvglist']) {
12278
+ if (!this.group['mvglist']?.includes(container)) {
12279
+ return;
12280
+ }
12253
12281
  }
12254
12282
  const control = fg.get(key);
12255
12283
  if (!control) {