mmhglobal-dynamicform 2.0.1 → 2.0.2
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.
- package/README.md +5 -0
- package/esm2020/lib/components/fieldbase.component.mjs +7 -1
- package/esm2020/lib/services/main.service.mjs +3 -1
- package/esm2020/lib/zgrid/zgrid.component.mjs +13 -1
- package/esm2020/lib/ztextarea/ztextarea.component.mjs +6 -2
- package/esm2020/lib/zudf/zudf.component.mjs +12 -6
- package/fesm2015/mmhglobal-dynamicform.mjs +32 -7
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +32 -6
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -474,6 +474,12 @@ class FieldBase {
|
|
|
474
474
|
this.setRequire = (status) => {
|
|
475
475
|
this.componentProperties.isRequired = status;
|
|
476
476
|
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, Validators.required);
|
|
477
|
+
if (this.data.Type === 'ztexteditor') {
|
|
478
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
482
|
+
}
|
|
477
483
|
};
|
|
478
484
|
}
|
|
479
485
|
initComponent() {
|
|
@@ -2754,6 +2760,8 @@ class MainService {
|
|
|
2754
2760
|
}
|
|
2755
2761
|
if (!fg.valid) {
|
|
2756
2762
|
this.componentErrorHandler.showFormGroupErrorMessage(group, fg);
|
|
2763
|
+
fg.markAsTouched();
|
|
2764
|
+
fg.markAllAsTouched();
|
|
2757
2765
|
return false;
|
|
2758
2766
|
}
|
|
2759
2767
|
return true;
|
|
@@ -7500,8 +7508,7 @@ class ZtextareaComponent extends InputFieldBase {
|
|
|
7500
7508
|
super.focusOnDefault(this.focus.bind(this));
|
|
7501
7509
|
}
|
|
7502
7510
|
setCharCounterDisplayStr() {
|
|
7503
|
-
|
|
7504
|
-
const characterCount = ((_a = this.group.zModel[this.data.Value]) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
7511
|
+
const characterCount = ZComponentHelper.getValueWithoutContinuousSpaces(this.group.zModel[this.data.Value]).length;
|
|
7505
7512
|
this.charCounterDisplayStr = `${characterCount} ${this.data.MaxLength ? (' / ' + this.data.MaxLength) : ''}`;
|
|
7506
7513
|
}
|
|
7507
7514
|
onChange(event, fieldValue) {
|
|
@@ -8984,6 +8991,12 @@ class ZgridComponent extends DataListingFieldBase {
|
|
|
8984
8991
|
const validators = [];
|
|
8985
8992
|
if (col.IsRequired) {
|
|
8986
8993
|
validators.push(Validators.required);
|
|
8994
|
+
if (col.Type === 'ztexteditor') {
|
|
8995
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
8996
|
+
}
|
|
8997
|
+
else {
|
|
8998
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
8999
|
+
}
|
|
8987
9000
|
}
|
|
8988
9001
|
if (col.ValidatorPattern) {
|
|
8989
9002
|
validators.push(Validators.pattern(col.ValidatorPattern));
|
|
@@ -9051,6 +9064,12 @@ class ZgridComponent extends DataListingFieldBase {
|
|
|
9051
9064
|
const validators = [];
|
|
9052
9065
|
if (col.IsRequired) {
|
|
9053
9066
|
validators.push(Validators.required);
|
|
9067
|
+
if (col.Type === 'ztexteditor') {
|
|
9068
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
9069
|
+
}
|
|
9070
|
+
else {
|
|
9071
|
+
validators.push(ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
9072
|
+
}
|
|
9054
9073
|
}
|
|
9055
9074
|
if (col.ValidatorPattern) {
|
|
9056
9075
|
validators.push(Validators.pattern(col.ValidatorPattern));
|
|
@@ -11629,6 +11648,12 @@ class ZudfComponent {
|
|
|
11629
11648
|
this.setRequire = (status) => {
|
|
11630
11649
|
this.componentProperties.isRequired = status;
|
|
11631
11650
|
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, Validators.required);
|
|
11651
|
+
if (this.data.Type === 'ztexteditor') {
|
|
11652
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces_TextEditor);
|
|
11653
|
+
}
|
|
11654
|
+
else {
|
|
11655
|
+
ZComponentHelper.changeValidator(status, this.group, this.data.Value, this.componentProperties, ZComponentHelper.requiredValidator_WithoutWhiteSpaces);
|
|
11656
|
+
}
|
|
11632
11657
|
};
|
|
11633
11658
|
}
|
|
11634
11659
|
ngOnInit() {
|
|
@@ -11830,7 +11855,7 @@ class ZudfComponent {
|
|
|
11830
11855
|
}
|
|
11831
11856
|
else {
|
|
11832
11857
|
// before generate FormControl, we need to add 2 attribute to the field when render.
|
|
11833
|
-
// this for later on, we can easily know this field belong to which zudf and under which container.
|
|
11858
|
+
// this for later on, we can easily know this field belong to which zudf and under which container.
|
|
11834
11859
|
if (containerName) {
|
|
11835
11860
|
field['containerName'] = containerName;
|
|
11836
11861
|
;
|
|
@@ -11849,7 +11874,7 @@ class ZudfComponent {
|
|
|
11849
11874
|
zudfGroup[containerName].push(field.Value);
|
|
11850
11875
|
}
|
|
11851
11876
|
}
|
|
11852
|
-
// set the list of dropdown option to the variable
|
|
11877
|
+
// set the list of dropdown option to the variable
|
|
11853
11878
|
if (this.isDropdownType(field.Type) && field.ZDataOptionName && field.DropdownOptions) {
|
|
11854
11879
|
this.group.zData[field.ZDataOptionName] = Object.assign([], eval('this.' + field.DropdownOptions));
|
|
11855
11880
|
}
|
|
@@ -11872,7 +11897,7 @@ class ZudfComponent {
|
|
|
11872
11897
|
if (!zudfGroup['fieldRequiredDefaultUser']) {
|
|
11873
11898
|
zudfGroup['fieldRequiredDefaultUser'] = [];
|
|
11874
11899
|
}
|
|
11875
|
-
// keep a list of default user need to be filled in the scope
|
|
11900
|
+
// keep a list of default user need to be filled in the scope
|
|
11876
11901
|
zudfGroup['fieldRequiredDefaultUser'].push({
|
|
11877
11902
|
fieldName: field.Name,
|
|
11878
11903
|
childFields: field.ChildFields
|
|
@@ -11982,7 +12007,7 @@ class ZudfComponent {
|
|
|
11982
12007
|
updatedModelData[prefixedPropertyName] = updatedNestedObject;
|
|
11983
12008
|
}
|
|
11984
12009
|
else {
|
|
11985
|
-
// Add the property to the output object with the component prefix
|
|
12010
|
+
// Add the property to the output object with the component prefix
|
|
11986
12011
|
let prefixedPropertyName;
|
|
11987
12012
|
if (containerPrefix) {
|
|
11988
12013
|
prefixedPropertyName = `${this.componentPrefix}_${containerPrefix}_${propertyName}`;
|
|
@@ -12218,7 +12243,7 @@ class ZudfComponent {
|
|
|
12218
12243
|
}
|
|
12219
12244
|
}
|
|
12220
12245
|
clearContainerRelatedFieldValue(group, containerName) {
|
|
12221
|
-
// after set to grid, clear the zmodel.
|
|
12246
|
+
// after set to grid, clear the zmodel.
|
|
12222
12247
|
this.clearContainerFieldElementValue(containerName);
|
|
12223
12248
|
}
|
|
12224
12249
|
removeGridRow(gridValue, gridDataSource, dataItem, index) {
|